users@jax-rs-spec.java.net

[jax-rs-spec users] Filters and Entity Interceptors

From: Arun Gupta <arun.p.gupta_at_oracle.com>
Date: Thu, 03 Jan 2013 17:07:18 -0800

Filters are meant for processing headers only and Entity Interceptors
for HTTP bodies. Is that a good qualification ?

I have a resource method as:

@GET
     public String getList() {
         System.out.println("endpoint invoked");
         return "apple";
     }

and the following reader and writer interceptor:

@Override
     public Object aroundReadFrom(ReaderInterceptorContext ric) throws
IOException, WebApplicationException {
         System.out.println("aroundReadFrom");
         return ric.proceed();
     }

@Override
     public void aroundWriteTo(WriterInterceptorContext wic) throws
IOException, WebApplicationException {
         System.out.println("aroundWriteTo");
         wic.proceed();
     }

The invocation sequence says

endpointInvoked
aroundWriteTo
aroundReadFrom

The slides from JavaOne session seem to indicate it should be:

aroundReadFrom
endpointInvoked
aroundWriteTo

Can you please explain the sequence ?

Arun

-- 
http://twitter.com/arungupta
http://blogs.oracle.com/arungupta