hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juan Luis de Amaya Robles" <JuanLuisdeAm...@concatel.com>
Subject Persistent connections
Date Thu, 02 Feb 2006 18:48:50 GMT
Hi everybody,
I tell you:
I have two urls to call (PHP pages). One sets a language variable in
session. Another returns data depending on the session var.
i think, i need stablish persistent connection to connect web pages with
session data.
When i call the first one url, it returns a cookie with a PHPSESSID
(it's a php). ok.
I understand that cookie is sended when I call the second one url, but i
get a incorrect second page, well, the language is not correct.
This is because the session is incorrect. I think.
What's the problem?
When i print the "isPersistent()" method is returned false. I must
configure anything else?
where the cookie is stored?
Thanks a lot!
A piece of my code is:
// Get HTTP GET method
     GetMethod httpget = new GetMethod(strURL);
        // Execute HTTP GET
        int result = httpclient.executeMethod(httpget);
        // Display status code
        System.out.println("Response status code: " + result);
        // Get all the cookies
        Cookie[] cookies = httpclient.getState().getCookies();
        System.out.println("Present cookies: ");
        for (int i = 0; i < cookies.length; i++) {
         Cookie c = cookies[i];         
            System.out.println(" - " + c.toExternalForm()+", PERSISTENT:
        String pag = httpget.getResponseBodyAsString();
        int idx = pag.indexOf("Welcome");
  if (idx >= 0){
   System.out.println("No encontrado!");
        // Release current connection to the connection pool once you
are done

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message