users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Re: Re: Re: Heads Up: Severe problem when rewriting responses! Is our Filter API suitable?

From: Markus KARG <markus_at_headcrashing.eu>
Date: Mon, 22 Oct 2012 18:53:00 +0200

> > 1) describe exactly what JAX-RS implementations have to do. E.g.
> Ignore getSize() once setOutputStream( ... ) is called.
>
> This option did not occur to me. I am wondering if it would solve all
> the issues though? E.g. what if I really only want to log or audit the
> streamed data? Does it mean that I have to still ignore the
> MBW.getSize()?

This option is the only that occured to me. Maybe now you understand what I
talked about months ago: the different views of API providers and API
consumers. ;-)

Yes it solves all the issues as what comes out in the end is always correct:
Content-Length equals to the absolute byte size of the outermost filter
(hence the only correct value).

If you want to log or audit the streamed data it is still valid to count the
actual bytes from the outermost filter to know what Content-Length the
JAX-RS implementation must set. I do not see why this should be any problem
for logging or auditing, as it simply produces the only correct result. Or
in short: It would be even valid to EVER ignore MBW.getSize() and ALWAYS
count the actual bytes, even if no filter was added at all!

Regards
Markus