hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalnichevski, Oleg" <oleg.kalnichev...@bearingpoint.com>
Subject RE: Seeking help using Cookie and Session
Date Wed, 17 Sep 2003 14:56:56 GMT
Dan,
Before I could give you a more precise answer, I would need some additional input from you.


- What kind of cookie policy have you been using? Have you tried using browser compatibility
policy?
  If unsure, you may want to consult our cookie guide:
  <http://jakarta.apache.org/commons/httpclient/cookies.html>

- What kind of servlet engine are you running on the server?

- Could you produce the wire log of the session in question. 
  Take a look at the logging guide for the instructions on how to activate wire logging:
  <http://jakarta.apache.org/commons/httpclient/logging.html>

Cheers

Oleg

-----Original Message-----
From: Dan Tran [mailto:danttran@hotmail.com]
Sent: Wednesday, September 17, 2003 4:44 PM
To: Commons HttpClient Project
Subject: Seeking help using Cookie and Session


Hi I am write a small client/server web app to understand more about httpclient/cookie/and
httpsession.

On the httpclient side, I use a get method to keep calling a servlet on server.

<clientcode>
    HttpClient client = new HttpClient();
    GetMethod method = new GetMethod(url);
    while ( !done ) {
        client.executeMethod(method);
        if (method.getStatusCode() == HttpStatus.SC_OK) {
          method.getResponseBody();
          method.releaseConnection();
        } else {
          System.out.println("Unexpected failure: " +  method.getStatusLine().toString());
          done = true;
        }

      method.recycle();
      method.setPath(url);

      sleep(sometime)

   }
</clientcode>


on the server side, the doGet() method use this

<servercode>
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
    request.getSession();
  }
</servercode>


The first loop, the client is happy.  I found a cookie in the response.

After that it throws the following warning message in my lo4j

<warning-snippet>
  06:22:37,843 - WARN org.apache.commons.httpclient.HttpMethodBase - Cookie reject
  ed: "$Version=0; JSESSIONID=6D150D24B3D022F9AB835EF4E0AFEC5E; $Path=/webtest". I
  llegal path attribute "/webtest". Path of origin: "http://localhost:8080/webtest   /webgenservlet"
</waring-snippet>

On server side, new session is created for each request

Questions are:

   Why server keeps creating new session instead of reuse the old one?
   What does it mean regarding the Warning.

Advices are greately appreciated.

Happy Coding

-Dan

---------------------------------------------------------------------
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