[jax-rs-spec users] [jsr339-experts] Re: Re: Gzipping Interceptors

From: Markus KARG <>
Date: Mon, 29 Oct 2012 20:13:31 +0100





From: Santiago Pericas-Geertsen []

Sent: Montag, 29. Oktober 2012 15:29
Subject: [jsr339-experts] Re: [jax-rs-spec users] Re: Gzipping Interceptors



On Oct 29, 2012, at 3:30 AM, Jan Algermissen <>

On Oct 27, 2012, at 4:41 PM, Marek Potociar <
<>> wrote:

The examples in the spec illustrate JAX-RS APIs not any particular feature
implemented with these APIs. So I think we should keep the examples
simplistic in the spec. The features you're talking about will be most
likely provided by more skilled developers anyway.

After mulling this over, I disagree. The examples also bother to show
finishing the gzip OS and restoring the original OS.


 It's certainly not the intent of the spec samples to be 100% precise;
conciseness is a more important goal IMO. However, it wouldn't affect
conciseness much to write:


    Object aroundReadFrom(ReaderInterceptorContext ctx) ... {
       if (isGzipped(ctx)) {
            InputStream old = ctx.getInputStream();
            ctx.setInputStream(new GZIPInputStream(old));
            try {
                return ctx.proceed();
            } finally {
        } else {
            return ctx.proceed();
    void aroundWriteTo(WriterInterceptorContext ctx) ... {
        OutputStream old = ctx.getOutputStream();
        GZIPOutputStream gzipOutputStream = new GZIPOutputStream(old);
        try {
        } finally {


 Could we move on from this discussion with this simple change?


-- Santiago