Many web sites solve this problem by adding an additional request to the
server to terminate the session. A "log out" command, if you will. I
have done so myself.
Within your web application, you might be able to pick an unused URL,
map that to a new servlet in web.xml, and catch a POST request to logout
- it almost doesn't matter what the POST request contains. In handling
that request, simply terminate the session. You shouldn't have to touch
any of the existing server side code, just add new stuff. As this is
the HttpClient mailing list, you should collect further help from the
user/dev mailing list of your chosen servlet engine.
-Eric.
Eric Portalez wrote:
Hi Steve,
don't die from laughing...
Yes, your suggestion seems good. But I'm afraid of modifying that code,
because it is a bit complexe (slide server api).
Thanks.
Eric PORTALEZ
----- Original Message -----
From: "Steve Johnson" <[EMAIL PROTECTED]>
To: "'HttpClient Project'" <[email protected]>
Sent: Friday, August 26, 2005 5:37 PM
Subject: RE: session not closed tomcat's manager
I can't stop laughing.
Anyway, wouldn't it be reasonable that if you properly
closed the client side connection that the server side
session would be informed of this and close its session?
thanks,
Eric,
this code looks funny - and is completely useless. Remove it.
All you have to do is call HttpMethod.releaseConnection.
You are trying to destroy a server-side session from the client side.
This is simply impossible. Your *webapplication* has to destroy the
session with a call to HttpSession.invalidate(). Or you can simply wait
until it expires. Default timeout is something like 30 minutes or so.
Normally a session is destroyed upon "logout" from the webapp. How that
happens is not standardized and depends completely on the concrete
implementation.
Ortwin Glück
Eric Portalez wrote:
Hello,
I'm trying to terminate properly my session, but I don't manage.
Here my code :
public void closeSession() throws IOException{
if(client != null){
client.getHttpConnectionManager().getConnection(client.getHostConfiguration(
)).setConnectionTimeout(1);
client.getHttpConnectionManager().releaseConnection(client.getHttpConnection
Manager().getConnection(client.get
HostConfiguration()));
client.getHttpConnectionManager().getConnection(client.getHostConfiguration(
)).close();
client.setConnectionTimeout(1);
client = null;
}
}
I've tried differents combinations without any success. My manager in
tomcat always shows me that the
session is opende.
I precise that my session disapear correctly at the end of the timeout.
Any ideas ?
Thanks.
Eric Portalez
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]