Eric,

Are you saying that code is in Slide?
This code is complete bollocks in my opinion. It gets a new connection from the connection manager and closes it again.

Ortwin Glück

Eric Portalez wrote:
Hello,

I prefere to be sure of well understanding your recommandations.
Here is the original code of the closeSession() method, extract from the webdav 
API.

public void closeSession()
        throws IOException
    {
        if(client != null)
        {
            
client.getHttpConnectionManager().getConnection(client.getHostConfiguration()).close();
            client = null;
        }
    }

My question is : Does "client.getHttpConnectionManager().getConnection(client.getHostConfiguration())" get an existing connection or create a new connection ?
And thus, am I supposed not to write this line (with" close()" at the end) ?

Thanks

Eric

----- Original Message ----- From: "Ortwin Glück" <[EMAIL PROTECTED]>
To: "HttpClient Project" <[email protected]>
Sent: Friday, August 26, 2005 5:30 PM
Subject: Re: session not closed tomcat's manager


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.getHttpConnectionManager().getConnection(client.getHostConfiguration()));
  
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





--
[web]  http://www.odi.ch/
[blog] http://www.odi.ch/weblog/
[pgp]  key 0x81CF3416
       finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to