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

[jsr339-experts] Re: FilterAction and FilterContext

From: Bill Burke <bburke_at_redhat.com>
Date: Fri, 18 Nov 2011 10:09:08 -0500

+1.

On 11/18/11 3:47 AM, Sergey Beryozkin wrote:
> 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
>
>

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com