[jax-rs-spec users] [jsr339-experts] Re: Altering response headers in a buffering writer interceptor
+1
> -----Original Message-----
> From: Jan Algermissen [mailto:jan.algermissen_at_nordsc.com]
> Sent: Dienstag, 6. November 2012 17:52
> To: jsr339-experts_at_jax-rs-spec.java.net
> Subject: [jsr339-experts] Altering response headers in a buffering
> writer interceptor
>
> One of the canonical examples for interceptors is to buffer the output
> stream, derive some form of value from it (e.g. in the digital
> signature case) and add that value to the response headers *before*
> streaming out the buffer.
>
> In order to make this work, there needs to be a guarantee that the
> runtime definitely waits for the first byte to arrive in the output
> stream before sending out the headers.
>
> While that is, to my knowledge, common practice in HTTP server software
> it is AFAIK an implementation choice. I cannot see JAX-RS runtime
> implementations to be required to behave like this. It would be
> perfectly valid to implement a runtime that sends the headers
> immediately, e.g. when <mbw>.getSize() returns -1.
>
> Wouldn't it be a good idea to add to the spec a constraint to require
> the runtime to not send any response headers until the first byte hits
> the output stream?
>
> Jan