jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] FilterAction and FilterContext

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Fri, 18 Nov 2011 08:47:56 +0000

Hi,

In order to block a request and provide a response, filters need to
return FilterAction.STOP and set a Response on FilterContext.

What do you think of dropping FilterAction altogether and removing
FilterContext.setResponse and have filters a Response return type.
If it's not null - it's a blocking action with Response being available,
if it is null - the request is good to continue.

FilterAction is kind of ok, but I'm not quite comfortable with what
seems like a workaround to do with the possible need to effectively
return two parameters (action status and a possible blocking Response
value) and as such FilterAction seems redundant; without it
FilterContext gets simpler, no space for ambiguities like
FilterAction.NEXT with FilterContext.getResponse() returning a non-null
value

Thoughts ?
Sergey


-- 
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend Community Coders
http://coders.talend.com/