Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] request.available() == 0 in Servlet implementation

Just saw Joakim beat me by 12 minutes. Damn you Gmail for your slow updates.

On Fri, Feb 6, 2015 at 9:20 AM, Nils Kilden-Pedersen <nilskp@xxxxxxxxx> wrote:

The docs for available states that it’s “an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream“, so that should be expected.

Assuming your servlet is async, you should probably call something like setReadListener(ReadListener).

If not async, you should probably not check available, since it’s not going to tell you anything useful anyway.


On Fri, Feb 6, 2015 at 8:19 AM, Guus der Kinderen <guus.der.kinderen@xxxxxxxxx> wrote:
Hi all,

Over the past few days, I have been fighting with the following issue. The scenario revolves around a Jetty 9.2.7 based application, in which a request gets POSTed to a servlet. The HTTP payload in the request is to be consumed. 

The servlet implementation overrides doPost(HttpServletRequest request, HttpServletResponse response). We experience that request.available() returns zero in this implementation (which causes problems when trying to consume the HTTP payload using the InputStream from the request). This happens with some frequency (approximately once in every 50 requests).

The work-around that we have in place: invoke Thread.sleep(100) when request.available() returns zero. This works, but is an undesirable solution.

The efforts to reproduce the problem in a more compact code-base than the elaborate servlet and client implementations in our products have not been successful.

I am looking for thoughts on the cause of this issue, suggestions for fixes, and/or approaches to create a portable reproduction path. Any help is much appreciated!

Regards,

  Guus

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top