commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Sutton <>
Subject RE: HttpClient - Want all cookies in a single header line
Date Sun, 20 Jul 2003 22:27:48 GMT
Hi Derek,
Good to hear that you've found the answer to this however, I wanted to note

Cookie: foo=1; baa=2


Cookie: foo=1
Cookie: baa=2

should be treated in exactly the same way by the server, so if your
developing a server side process that acts differently, you should look at
fixing this so that it complies with the HTTP spec.

Adrian Sutton, Software Engineer
Ephox Corporation 

-----Original Message-----
From: Derek Alexander []
Sent: Sunday, 20 July 2003 12:04 AM
Subject: HttpClient - Want all cookies in a single header line


I'm trying to make an HTTP GET request with all the Cookies on one header
For some reason the request is built with each cookie on a separate line.

i.e., I want:

Cookie: foo=1; baa=2

but I am getting

Cookie: foo=1
Cookie: baa=2

I've looked at the source for HttpMethodBase where I saw that this depends
on whether it is in strictMode. So, I set it to strictMode first.

Doesn't seem to make any difference though.

Here's my code. Can someone tell me where I've gone wrong.

// ...
HttpClient client = new HttpClient();
HttpState state = client.getState();
state.addCookie(new Cookie("","foo","1","/",null,false));
state.addCookie(new Cookie("","baa","2","/",null,false));
GetMethod method = new GetMethod("");
int statusCode = client.executeMethod(method);
// ...

Hope someone can help.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message