Jan,
If you haven't, please refer to the alias archive for the original discussions, I'm sure there are more examples there.
>> Here are some of the differences:
>>
>> (i) Clearly they are in different extension points in the pipeline
>
> Yes, however the respective extension points are adjacent and there is really nothing I can do in an interceptor I could not do at the filter extension point directly before the interceptor extension point.
They are not always adjacent, consider the following:
Response r = client.target(...).request().get(); // Filters called here
callLongRunningMethod();
Foo f = r.getEntity(Foo.class); // Interceptors called here
>
>> (ii) Interceptors are wrapping and can access the entity in marshalled and unmarshalled forms
>
> Filters can do that, too.
That's not true. For example, a ContainerRequestFilter only has access to the unmarshalled form since it is executed before MBRs, which in turn, are executed only if needed.
>
>> (iii) ReaderInterceptors, just like MBRs, are called only if needed (based on application logic, for example, when Response.getEntity() is called on the client)
>
> This I do not understand. Can you explain further.
See example above, and add a conditional around r.getEntity(Foo.class).
-- Santiago