You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Eric Portalez <er...@rdb.ap-hop-paris.fr> on 2005/08/26 17:25:19 UTC

session not closed tomcat's manager

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


Re: session not closed tomcat's manager

Posted by Eric Portalez <er...@rdb.ap-hop-paris.fr>.
I have done my tests without any success.
I continue to accumulate my sessions.

----- Original Message ----- 
From: "Ortwin Glück" <od...@odi.ch>
To: "HttpClient Project" <ht...@jakarta.apache.org>
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.getHttpConnection
Manager().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: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: session not closed tomcat's manager

Posted by Eric Portalez <er...@rdb.ap-hop-paris.fr>.
OK, I will remove it from my code.
In fact, it's the first time I use this API.
I have observe this problem with my Webdav server (project Slide of
jakarta).
I had to examinate the code of the differents jar.
My first conclusion was that the releaseConnection was absent. But it
remains the problem of the existence of my session.

What you say seems very logical, indeed. So, I supposed I have to modify the
code of the slide server api. Damn it !

Thank you Ortwin.

Eric PORTALEZ



----- Original Message ----- 
From: "Ortwin Glück" <od...@odi.ch>
To: "HttpClient Project" <ht...@jakarta.apache.org>
Sent: Friday, August 26, 2005 5:52 PM
Subject: Re: session not closed tomcat's manager


Eric,

client.getHttpConnectionManager().getConnection(client.getHostConfiguration(
 > )).setConnectionTimeout(1);

This line pops a new connection from the connection manager. Don't do
that! You will disrupt connection management like this.

A new session in Tomcat is openend as soon as a new connection is
established to the server without a valid session cookie. This session
will remain until you explicitly invalidate it or it times out. The
session will survive a closed connection of course. Once again: You can
not control session lifecycle from the client. Connection timeout has
nothing to do with session timeout.

Ortwin Glück

Eric Portalez wrote:
> Thank you.
>
> I call HttpMethod.releaseConnection, indeed.
>
> You perfectly right about my intention : destroy the opened session on my
> server.
> My problem is that I have to fix the timeout at 2 hours (I can't explain
why
> here, it would be too long).
> But, in some cases, I don't want my session exist too long.
>
> The line
>
client.getHttpConnectionManager().getConnection(client.getHostConfiguration(
> )).setConnectionTimeout(1);
> is not taken into account, maybe because I have to call it before the call
> of the executeMethod() ?
>
> I will do some tests.
>
> If you have any others suggestions, I would appreciate them.
>
> Thanks.
>
> Eric Portalez.
>
> ----- Original Message ----- 
> From: "Ortwin Glück" <od...@odi.ch>
> To: "HttpClient Project" <ht...@jakarta.apache.org>
> 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.getHttpConnection
> Manager().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: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: session not closed tomcat's manager

Posted by Ortwin Glück <od...@odi.ch>.
Eric,

client.getHttpConnectionManager().getConnection(client.getHostConfiguration(
 > )).setConnectionTimeout(1);

This line pops a new connection from the connection manager. Don't do 
that! You will disrupt connection management like this.

A new session in Tomcat is openend as soon as a new connection is 
established to the server without a valid session cookie. This session 
will remain until you explicitly invalidate it or it times out. The 
session will survive a closed connection of course. Once again: You can 
not control session lifecycle from the client. Connection timeout has 
nothing to do with session timeout.

Ortwin Glück

Eric Portalez wrote:
> Thank you.
> 
> I call HttpMethod.releaseConnection, indeed.
> 
> You perfectly right about my intention : destroy the opened session on my
> server.
> My problem is that I have to fix the timeout at 2 hours (I can't explain why
> here, it would be too long).
> But, in some cases, I don't want my session exist too long.
> 
> The line
> client.getHttpConnectionManager().getConnection(client.getHostConfiguration(
> )).setConnectionTimeout(1);
> is not taken into account, maybe because I have to call it before the call
> of the executeMethod() ?
> 
> I will do some tests.
> 
> If you have any others suggestions, I would appreciate them.
> 
> Thanks.
> 
> Eric Portalez.
> 
> ----- Original Message ----- 
> From: "Ortwin Glück" <od...@odi.ch>
> To: "HttpClient Project" <ht...@jakarta.apache.org>
> 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.getHttpConnection
> Manager().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: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: session not closed tomcat's manager

Posted by Eric Portalez <er...@rdb.ap-hop-paris.fr>.
Thank you.

I call HttpMethod.releaseConnection, indeed.

You perfectly right about my intention : destroy the opened session on my
server.
My problem is that I have to fix the timeout at 2 hours (I can't explain why
here, it would be too long).
But, in some cases, I don't want my session exist too long.

The line
client.getHttpConnectionManager().getConnection(client.getHostConfiguration(
)).setConnectionTimeout(1);
is not taken into account, maybe because I have to call it before the call
of the executeMethod() ?

I will do some tests.

If you have any others suggestions, I would appreciate them.

Thanks.

Eric Portalez.

----- Original Message ----- 
From: "Ortwin Glück" <od...@odi.ch>
To: "HttpClient Project" <ht...@jakarta.apache.org>
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.getHttpConnection
Manager().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: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: session not closed tomcat's manager

Posted by Ortwin Glück <od...@odi.ch>.

Eric Portalez wrote:
> This is in the class org.apache.webdav.lib.WebdavSession.java in
> jakarta-slide-webdavlib-2.1.jar

uh oh...

> 
>> You must not manage your connections manually. The connection
>> manager will take care of that.
> 
> You means I have nothing to do ?

Exactly.

> How does manager do this ? 

This depends on the connection manager that is used. The multi-threaded 
connection manager will keep a connection open for a while so it can be 
reused. But connections time out evetuall. Normally this happens after 
30 seconds to 1 minute.

 > Is there
> something to parameter ? I ask this question because my connections
> are not released.

I assume you connect to a Slide WebDav server using the slide WebDav 
client library. What makes you think your connections are not released 
properly?

 > I had to make my connections become not persistants
> by adding the following attribute to the launching of my server : 
> -Dhttp.keepAlive=false

This system property is used by Sun's HttpUrlConnection. This should not 
have any effect on Tomcat's server connections.

> 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: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: session not closed tomcat's manager

Posted by Eric Portalez <er...@rdb.ap-hop-paris.fr>.
This is in the class org.apache.webdav.lib.WebdavSession.java in jakarta-slide-webdavlib-2.1.jar

> You must not manage your connections manually. The connection manager will take care of that.
You means I have nothing to do ? How does manager do this ? Is there something to parameter ?
I ask this question because my connections are not released. I had to make my connections become not persistants by adding the following attribute to the launching of my server :
-Dhttp.keepAlive=false

Eric PORTALEZ

----- Original Message ----- 
From: "Ortwin Glück" <od...@odi.ch>
To: "HttpClient Project" <ht...@jakarta.apache.org>
Sent: Monday, August 29, 2005 11:10 AM
Subject: Re: session not closed tomcat's manager


> 
> 
> Eric Portalez wrote:
> > It is exactly what I'm saying, Ortwin.
> > This explains the origin of my funny code. I belived it was correct.
> 
> No, this code is stupid. Please tell me, is this code in Slide? In which 
> class? This would be really bad!
> 
> > Otherwise, is there a mean of getting the current connection, or are we just
> > supposed the manage it after the "method.execute()" ?
> 
> You must not manage your connections manually. The connection manager 
> will take care of that.
> 
> Once again, it has *nothing* to do with HTTP session management.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> 
> 

Re: session not closed tomcat's manager

Posted by Ortwin Glück <od...@odi.ch>.

Eric Portalez wrote:
> It is exactly what I'm saying, Ortwin.
> This explains the origin of my funny code. I belived it was correct.

No, this code is stupid. Please tell me, is this code in Slide? In which 
class? This would be really bad!

> Otherwise, is there a mean of getting the current connection, or are we just
> supposed the manage it after the "method.execute()" ?

You must not manage your connections manually. The connection manager 
will take care of that.

Once again, it has *nothing* to do with HTTP session management.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: session not closed tomcat's manager

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, Aug 29, 2005 at 11:02:25AM +0200, Eric Portalez wrote:
> It is exactly what I'm saying, Ortwin.
> This explains the origin of my funny code. I belived it was correct.
> Otherwise, is there a mean of getting the current connection, or are we just
> supposed the manage it after the "method.execute()" ?
> 
> Eric Portalez
> 

Eric,

If you want to have a greater control over connection management, you
should implement a custom connection manager. The code you posted below,
will have the desired effect with the simple connection manager that has
just one connection, but is completely meaningless if used with the
pooled connection manager

Oleg

> ----- Original Message ----- 
> From: "Ortwin Gl?ck" <od...@odi.ch>
> To: "HttpClient Project" <ht...@jakarta.apache.org>
> Sent: Monday, August 29, 2005 10:52 AM
> Subject: Re: session not closed tomcat's manager
> 
> 
> 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" <od...@odi.ch>
> > To: "HttpClient Project" <ht...@jakarta.apache.org>
> > 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.getHttpConnection
> Manager().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: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: session not closed tomcat's manager

Posted by Eric Portalez <er...@rdb.ap-hop-paris.fr>.
It is exactly what I'm saying, Ortwin.
This explains the origin of my funny code. I belived it was correct.
Otherwise, is there a mean of getting the current connection, or are we just
supposed the manage it after the "method.execute()" ?

Eric Portalez

----- Original Message ----- 
From: "Ortwin Glück" <od...@odi.ch>
To: "HttpClient Project" <ht...@jakarta.apache.org>
Sent: Monday, August 29, 2005 10:52 AM
Subject: Re: session not closed tomcat's manager


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" <od...@odi.ch>
> To: "HttpClient Project" <ht...@jakarta.apache.org>
> 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.getHttpConnection
Manager().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: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: session not closed tomcat's manager

Posted by Ortwin Glück <od...@odi.ch>.
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" <od...@odi.ch>
> To: "HttpClient Project" <ht...@jakarta.apache.org>
> 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: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: session not closed tomcat's manager

Posted by Roland Weber <RO...@de.ibm.com>.
Hi Eric,

there still seems to be a little confusion about what you want
to do and how to achieve it. HTTP is *not* a connection-based
protocol. Closing a connection on the client side - and that is
all you can do with our connection manager - will *not* cancel
the session on the server. The server will keep the session and
just wait for the next request in that session, which can come
over a new connection at any time.

If you want to destroy the session that resides on the server,
you need to install code on the server. Then you have to send
a *request* to the server, requesting that the server session
be destroyed by your code there. Ways to do this ("logout") have
been pointed out before in this thread, though details will
depend on the servlet container.

hope that helps,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: session not closed tomcat's manager

Posted by Eric Portalez <er...@rdb.ap-hop-paris.fr>.
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" <od...@odi.ch>
To: "HttpClient Project" <ht...@jakarta.apache.org>
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: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: session not closed tomcat's manager

Posted by Ortwin Glück <od...@odi.ch>.
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: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org