Op maandag, 5 oktober 2009 00:47 schreef "André Warnier" <a...@ice-sa.com>:
Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> > Ronald,
> > On 10/2/2009 9:20 AM, Ronald Klop wrote:
>> But I don't send any data. My servlet than waits in getParameterMap(),
>> because that try's to read the inputstream and parse the parameters.
>> After 20 seconds (Connector has connectionTimeout="20000") the reading
>> of the inputstream ends, but my application just gets an empty Map in
>> stead of some TimeoutException.
> > What leads you to believe that a TimeoutException would be thrown? The
> documentation for the HTTP connector's "connectionTimeout" attribute says:
> > "
> The number of milliseconds this Connector will wait, after accepting a
> connection, for the request URI line to be presented. The default value
> is 60000 (i.e. 60 seconds).
> "
> > You provided the URI line within plenty of time. If you didn't enter
> anything, Tomcat would disconnect. Since you did, it doesn't.
> ...
Doesn't the fact that the read on the inputstream returns, imply that there is
actually a timeout, even if it is not returned to the webapp ?
And, to Ronald : if the request is a POST, and it has a Content-length, and you
get an empty parameter map after 20 seconds, can't you just reject the request
as invalid ?
And, curiosity : if you set the Connector timeout to 30 seconds, does your
inputstream then return after 30 seconds too ?
Yes it implies there is a timeout, but it is kind of guessing if it was a
timeout or really an empty ParameterMap for the webapp. This can be
workarounded by always including a dummyvar in the parameters as Christopher
Shultz mentions or checking the Content-Length. But maybe Tomcat can do
something better internally.
Yes if I set the connector timeout to 30 seconds it returns after 30 seconds.
My other workaround is doing a GET ajax in stead of POST. For this case the url
wouldn't be too long for Internet Explorer and than more data is send at once
over the network.
Ronald.