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:
"+c.isPersistent());
}
String pag = httpget.getResponseBodyAsString();
int idx = pag.indexOf("Welcome");
if (idx >= 0){
System.out.println(pag.substring(idx,idx+200));
}else{
System.out.println("No encontrado!");
}
// Release current connection to the connection pool once you
are done
httpget.releaseConnection();