You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "Langston, James" <Ja...@compuware.com> on 2010/05/04 21:47:45 UTC

defaulthttpclient - connected ?

Hi all,

Is there a way to check that I'm still connected w/ defaulthttpclient ?
Essentially,
I'm logged into a server and if the login session gets timed out or not,
I just quickly
want to check, but I don't see any easy methods to utilize ...

Thanks,

Jim

////////////////

Jim Langston
Technical Consultant
james.langston@compuware.com



The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.


Re: defaulthttpclient - connected ?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2010-05-04 at 15:47 -0400, Langston, James wrote:
> Hi all,
> 
> Is there a way to check that I'm still connected w/ defaulthttpclient ?
> Essentially,
> I'm logged into a server and if the login session gets timed out or not,
> I just quickly
> want to check, but I don't see any easy methods to utilize ...
> 
> Thanks,
> 
> Jim
> 

HTTP session and HTTP connection are two completely different things.
HTTP session may well span across multiple HTTP connections. If a
connection gets closed it does not mean the session get automatically
invalidated.

Oleg


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


Re: defaulthttpclient - connected ?

Posted by Ken Krugler <kk...@transpac.com>.
On May 4, 2010, at 1:26pm, Langston, James wrote:

> I'm trying not to continually login/out, what I want to do is
> hold the session open, but if I'm not active, I will get logged
> out. If I am, I can start the login session again, but I want
> to check ahead to see if I was logged out.
>
> Or, if I open the session, just because I'm not active on the
> connection, are you saying that, unlike, coming in through
> a browser, the connection will always stay active and I shouldn't
> be logged out ?

No, I'm saying that this login/logout stuff is all server dependent.

What you need to do depends on the server and its session management,  
which has nothing to do with HttpClient.

For example, maybe you need to just go a GET to a URL every hour, and  
that activity is sufficient for the server to keep your session active.

There's also the issue of state stored in cookies, but again whether  
or not that's important depends on the server's session management  
implementation.

-- Ken

> I have not experimented to see if the connection
> will always stay open over an long period, say 24 hrs.
>
> Jim
>
> ////////////////////////
>
>
> Jim Langston
> Technical Consultant
> james.langston@compuware.com
>
>
> -----Original Message-----
> From: Ken Krugler [mailto:kkrugler_lists@transpac.com]
> Sent: Tuesday, May 04, 2010 4:20 PM
> To: HttpClient User Discussion
> Subject: Re: defaulthttpclient - connected ?
>
> This sounds like an issue with the session management of the server,
> not HttpClient.
>
> If so, then all you can do is try to ping a URL and check the response
> for a 403 (if the server is well behaved). Some servers will just
> silently redirect you to a login page, so you'd need to watch for a
> temp redirect response.
>
> -- Ken
>
> On May 4, 2010, at 12:47pm, Langston, James wrote:
>
>> Hi all,
>>
>> Is there a way to check that I'm still connected w/
>> defaulthttpclient ?
>> Essentially,
>> I'm logged into a server and if the login session gets timed out or
>> not,
>> I just quickly
>> want to check, but I don't see any easy methods to utilize ...
>>
>> Thanks,
>>
>> Jim
>>
>> ////////////////
>>
>> Jim Langston
>> Technical Consultant
>> james.langston@compuware.com
>>
>>
>>
>> The contents of this e-mail are intended for the named addressee
>> only. It contains information that may be confidential. Unless you
>> are the named addressee or an authorized designee, you may not copy
>> or use it, or disclose it to anyone else. If you received it in
>> error please notify us immediately and then destroy it.
>>
>
> --------------------------------------------
> Ken Krugler
> +1 530-210-6378
> http://bixolabs.com
> e l a s t i c   w e b   m i n i n g
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>

--------------------------------------------
Ken Krugler
+1 530-210-6378
http://bixolabs.com
e l a s t i c   w e b   m i n i n g





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


RE: defaulthttpclient - connected ?

Posted by "Langston, James" <Ja...@compuware.com>.
I'm trying not to continually login/out, what I want to do is
hold the session open, but if I'm not active, I will get logged 
out. If I am, I can start the login session again, but I want
to check ahead to see if I was logged out.

Or, if I open the session, just because I'm not active on the 
connection, are you saying that, unlike, coming in through
a browser, the connection will always stay active and I shouldn't
be logged out ? I have not experimented to see if the connection 
will always stay open over an long period, say 24 hrs.

Jim

////////////////////////


Jim Langston
Technical Consultant
james.langston@compuware.com


-----Original Message-----
From: Ken Krugler [mailto:kkrugler_lists@transpac.com] 
Sent: Tuesday, May 04, 2010 4:20 PM
To: HttpClient User Discussion
Subject: Re: defaulthttpclient - connected ?

This sounds like an issue with the session management of the server,  
not HttpClient.

If so, then all you can do is try to ping a URL and check the response  
for a 403 (if the server is well behaved). Some servers will just  
silently redirect you to a login page, so you'd need to watch for a  
temp redirect response.

-- Ken

On May 4, 2010, at 12:47pm, Langston, James wrote:

> Hi all,
>
> Is there a way to check that I'm still connected w/  
> defaulthttpclient ?
> Essentially,
> I'm logged into a server and if the login session gets timed out or  
> not,
> I just quickly
> want to check, but I don't see any easy methods to utilize ...
>
> Thanks,
>
> Jim
>
> ////////////////
>
> Jim Langston
> Technical Consultant
> james.langston@compuware.com
>
>
>
> The contents of this e-mail are intended for the named addressee  
> only. It contains information that may be confidential. Unless you  
> are the named addressee or an authorized designee, you may not copy  
> or use it, or disclose it to anyone else. If you received it in  
> error please notify us immediately and then destroy it.
>

--------------------------------------------
Ken Krugler
+1 530-210-6378
http://bixolabs.com
e l a s t i c   w e b   m i n i n g





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


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


Re: defaulthttpclient - connected ?

Posted by Ken Krugler <kk...@transpac.com>.
This sounds like an issue with the session management of the server,  
not HttpClient.

If so, then all you can do is try to ping a URL and check the response  
for a 403 (if the server is well behaved). Some servers will just  
silently redirect you to a login page, so you'd need to watch for a  
temp redirect response.

-- Ken

On May 4, 2010, at 12:47pm, Langston, James wrote:

> Hi all,
>
> Is there a way to check that I'm still connected w/  
> defaulthttpclient ?
> Essentially,
> I'm logged into a server and if the login session gets timed out or  
> not,
> I just quickly
> want to check, but I don't see any easy methods to utilize ...
>
> Thanks,
>
> Jim
>
> ////////////////
>
> Jim Langston
> Technical Consultant
> james.langston@compuware.com
>
>
>
> The contents of this e-mail are intended for the named addressee  
> only. It contains information that may be confidential. Unless you  
> are the named addressee or an authorized designee, you may not copy  
> or use it, or disclose it to anyone else. If you received it in  
> error please notify us immediately and then destroy it.
>

--------------------------------------------
Ken Krugler
+1 530-210-6378
http://bixolabs.com
e l a s t i c   w e b   m i n i n g





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