W3C home > Mailing lists > Public > www-jigsaw@w3.org > March to April 2001

RE: Setting timeout in HttpURLConnection

From: Ronen Lazar <RonenL@gilian.com>
Date: Thu, 8 Mar 2001 07:28:26 -0500 (EST)
Message-ID: <1797E7C8F378D411A1CE00D0B77E59CE2A7C93@gilian-mail>
To: "'John Philip Anderson'" <jpanderson_215@hotmail.com>
Cc: www-jigsaw@w3.org
Hi,

Thank you very much for your response.

The thing is that I'm using HttpURLConnection as the layer for managing HTTP
sessions. I.e. for all my needs to issue a GET request, for example, and
receive the content.

So in order to be able to use this class and also manage the timeout value,
I thought maybe deriving another class from it and creating a new function
to set it.
So the method:
public void setTimeout (int ms)
{
	HttpManager.getManager().setTimeout (ms);
}

belongs to this "MyHttpURLConnection" class.
But I doesn't seem to do the work. 
BTW, I also tried to call HttpManager.getManager().setRequestTimeout (ms)
with no luck here also.

But how can I access directly the HttpBasicConnection class from
HttpURLConnection? As far as I could understand it is not "revealed" to the
upper level, but to lower level as HttpManager.

While trying to check which method calls Socket.setSoTimeout (in
HttpBasicConnection), it appears that indeed only
HttpBasicConnection.markUsed() does that. So how can this value be changed
_after_ the initial creation of the socket?

Am I missing something here?

Again, thank a lot,
Ronen Lazar.


-----Original Message-----
From: John Philip Anderson [mailto:jpanderson_215@hotmail.com]
Sent: Wednesday, March 07, 2001 8:18 PM
To: Ronen Lazar
Cc: www-jigsaw@w3.org
Subject: Re: Setting timeout in HttpURLConnection


Dear Mr. Lazar,

	Right now, I am working through the details of Client-Side Jigsaw 
connections.  While I do not fully understand the code yet, I maybe of some 
help you.

	I believe that the fundamental distinction between the class 
"org.w3c.www.protocol.http.HttpURLConnection", from that you proposed to 
derive, and the class "org.w3c.www.protocol.http.HttpBasicConnection" maybe 
pertinent to your question.

	"HttpURLConnection" is associated with a specific Request/Reply
message 
pair.  It does not appear to independently reference the underlying socket.

	"HttpBasicConnection" is an implementation of the abstract class 
"org.w3c.www.protocol.http.HttpConnection."  It directly creates new sockets

and calls setSoTimeout() on them in the HttpBasicConnection.markUsed() 
method.

	So to start with, you could try changing the default value for
"timeout" 
(from 300000 ms to whatever) directly in the HttpBasicConnection source code

(and see if this approach solves your problem) and recompile.

	Are you sure that the HttpManager.setTimeout() is not working?

		Truly yours,
		John Philip Anderson
		jpanderson215@hotmail.com


>From: Ronen Lazar <RonenL@gilian.com>
>To: "'www-jigsaw@w3.org'" <www-jigsaw@w3.org>
>Subject: Setting timeout in HttpURLConnection
>Date: Wed, 7 Mar 2001 05:23:42 -0500 (EST)
>
>Hi all,
>
>How can I control (set) the value of the blocking timeout for a HTTP 
>request
>in HttpURLConnection?
>I'm looking for the effect similar to Socket.setSoTimeout (...).
>
>I tried to derive from the HttpURLConnection object and implement my own
>method like:
>
>	public void setTimeout (int ms)
>	{
>		HttpManager.getManager().setTimeout (ms);
>	}
>
>but it doesn't seem to do the job.
>
>Any idea?
>
>TIA,
>Ronen.
>
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
Received on Thursday, 8 March 2001 08:31:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:35 GMT