hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aruba bulk <b...@jacquesbotha.net>
Subject cookie question - Sorry : Retrying
Date Mon, 22 Dec 2003 15:27:28 GMT
Hi there (pls ignore my previous post)

I'm using HttpClient to write a Cactus unit test. I'd
like to simulate a browser, sending a cookie to the
server with a request. So the cookie originates at the
client side :

HttpClient client = new HttpClient();
HttpMethod method = new getMethod(url);
String cookieValue = "testValue";
String cookieName = "testname";
Cookie cookie = new Cookie("localhost", cookieName,
cookieValue);
cookie.setPath("/");

HttpState httpState=new HttpState();
httpState.addCookie(cookie);
client.setState(httpState);

// Execute the method.
int statusCode = -1;
try {
  statusCode = client.executeMethod(method);
} catch (HttpRecoverableException e) {} 
  catch (IOException e) {}

// Read the response body.
byte[] responseBody = method.getResponseBody();

My question is this : I need to check whether the
server has set any additional cookies in the response.
How do i do this ? 

Any help greatly appreciated.

Regards
Jacques



=====
"All one's life is music, if one touches the notes rightly, and in time."
    - John Ruskin

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Mime
View raw message