You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Philipp Leusmann <ph...@post.rwth-aachen.de> on 2003/03/04 14:25:54 UTC

[httpclient] Problems receiving cookies

Hi,

I am in trouble receiving cookies with httpclient. Exactly, only one cookie
of two is received.
The packet I get back from the webserver sniffed with ethereal looks like
this:
---snip----
HTTP/1.1 200 OK
Date: Tue, 04 Mar 2003 13:18:27 GMT
Server: Apache/1.3.26 (Unix) Debian GNU/Linux PHP/4.1.2 mod_jk/1.1.0
Set-Cookie: IPS_PAY_PAGE_URL=/paypage/paystart.do
Set-Cookie: JSESSIONID=904F15BE85221EECB578B990C3606B52;Path=/paypage
Transfer-Encoding: chunked
Content-Type: text/plain; charset=iso-8859-1
---snip----
But only the IPS_PAY_PAGE_URL-cookie is received.

my code looks like this:
---snip----
URL url = new URL("http://192.168.0.1/cgi-bin/sendpay/sendpay");
// Prepare HTTP post
PostMethod post = new PostMethod(url.toString());
// Get initial state object
NameValuePair form_data[] = new NameValuePair[12];
   [...] some form data [...]
post.setRequestBody(form_data);
post.setRequestContentLength(PostMethod.CONTENT_LENGTH_AUTO);
// Get HTTP client
HttpClient httpclient = new HttpClient();
// Execute request
int result = httpclient.executeMethod(post);
// Get all the cookies
Cookie[] cookies = httpclient.getState().getCookies();
---snip----
I also tried setting the CookiePolicy, but no matter what I put in, the
result stays the same.

I am using HttpClient 2.0alpha1

Hope someone can help,
 Philipp



AW: [httpclient] Problems receiving cookies

Posted by Philipp Leusmann <ph...@post.rwth-aachen.de>.
> I am using HttpClient 2.0alpha1
Sorry, it´s alpha3