jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: [servlet-spec users] Re: Re: Re: Re: Re: Re: Re: Re: Trailer header implementation

From: Greg Wilkins <gregw_at_webtide.com>
Date: Thu, 11 May 2017 17:29:00 +0200

On 11 May 2017 at 16:35, Martin Mulholland <mmulholl_at_us.ibm.com> wrote:

> If getTrailerFileds() is called before -1 is read on the request, why
> would we throw an exception if the headers have already been received?
>


Because allowing access to the trailers before a well specified event is
opening up applications to be dependent on particular server behaviour.

For example, Jetty has a mode where we delay dispatching a request to the
servlet container until at least one content packet has arrived. This can
avoid dispatching a thread only to immediately block trying to read
content. An app run on jetty would thus often be able to see trailers
before -1 is read, because Jetty will have waited for the body before
calling the servlet, yet it would fail on a container that did not delay
dispatch.

So for portability, we need a precise condition that must be met before
trailers are made available. Containers that have the trailers in advance
must not make them available until the application has met its part of the
contract.

cheers



-- 
Greg Wilkins <gregw@webtide.com> CTO http://webtide.com