Hello, you can simply make use of the code below for getting more knowledg about the HTTP headers. It is quiet simple code to understand. Make use of it.
Code:
import java.io.IOException;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.PostMethod;
import org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor;
import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration;
Public class Titi extends CommonsHttpInvokerRequestExecutor
{
private Final ThreadLocal <String> ThreadLocal = new ThreadLocal <String>();
@ Override protected PostMethod createPostMethod(Final HttpInvokerClientConfiguration config) throws IOException
{
Final String = ppauth ThreadLocal.get();
if (ppauth == null)
{
throw new RuntimeException("No authentication cookie found for this query?");
}
Final PostMethod post = great.createPostMethod(config);
post.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
post.setRequestHeader(new Header("Cookie", "ppauth =" + Ppauth));
return post;
}
Public void setPPAuthCookie(Final String cookie)
{
ThreadLocal.set(Cookie);
}
}
Bookmarks