jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: [jax-rs-spec users] Trailers with JAX-RS

From: Markus KARG <markus_at_headcrashing.eu>
Date: Sat, 29 Sep 2012 09:44:51 +0200

RFC 2616 "Hypertext Transfer Protocol -- HTTP/1.1" chapter 3.6.1 "Chunked
Transfer Coding" says "In other words, the origin server is willing to
accept the possibility that the trailer fields might be silently discarded
along the path to the client.", so I think it is really acceptable that
JAX-RS 2.0 does not support trailers.

Regards
Markus

> -----Original Message-----
> From: Jan Algermissen [mailto:jan.algermissen_at_nordsc.com]
> Sent: Freitag, 28. September 2012 21:25
> To: jsr339-experts_at_jax-rs-spec.java.net
> Subject: [jsr339-experts] Re: [jax-rs-spec users] Trailers with JAX-RS
>
>
> On Sep 28, 2012, at 8:04 PM, Marek Potociar wrote:
>
> >
> > On Sep 26, 2012, at 3:10 PM, Jan Algermissen
> <jan.algermissen_at_nordsc.com> wrote:
> >
> >> Hi,
> >>
> >> verifying my understanding...
> >>
> >> Given the abstraction that JAX-RS creates on top of HTTP connectors,
> it seems impossible to send or receive HTTP trailers with JAX-RS. Even
> if the underlying connector does support them.
> >>
> >> Or am I missing a clever trick?
> >
> > Could an interceptor be used for that?
>
> The problem, as I see it, is that the connector (e.g. Grizzly) is in
> charge of the output stream. If no Content-Length is set by JAX-RS the
> connector will chunk-encode the response stream and from a JAX-RS
> perspective there is no hook to add Trailers after the last chunk.
> Whatever you send will ge chunked, too.
>
> (I am also not entirely sure that Grizzly, for example, provides a hook
> to add trailers.)
>
> Maybe sth for JXA-RS 4.0 :-)
>
> Jan
>
> PS Yes, it is unfortunately an edge case and many clients do not
> support reading the trailers anyhow. Apache Client does, BTW.
>
>
> >
> >>
> >>
> >> Anyone knows the history regarding this detail?
> >
> > Hmm... I don't know but perhaps the reason is that it's not a
> frequently used feature, or is it?
> >
> > Marek
> >>
> >>
> >> Jan
> >>
> >>
> >