users@jax-rs-spec.java.net

[jax-rs-spec users] Re: ContainerRequestFilter - acccess to method or annotations?

From: Jan Kronquist <jan.kronquist_at_jayway.com>
Date: Thu, 18 Oct 2012 12:02:53 +0200

>
> The reason why it's not part of the context is that some container request
> filters (pre-matching) are executed before the information is available. In
> any case, according to the spec, you should be able to inject ResourceInfo
> into your (post-matching) filters and get the information you're asking
> for. (Please read about the impl. status below)
>

Ok, but having different behavior for pre-matching and post-matching is not
really strange. For example setMethod only works in pre-matching filters.


> I would prefer to have access to all methods including subresource-methods.
>
> Hmm... access to sub-resource methods is not possible at the moment. At
> the same time, I'm not convinced about the use case.
>

The reason I want to use subresources is that I'd like to have a single
root resource and use subresources among other things as a meta-model when
generating links.

The reason is that I want to use annotations on subresource methods is to
implement for example security and other constraints.


> (Hint: as a temporary workaround, you may try to inject UriInfo in your
> filters and cast it to ResourceInfo in Jersey ;))
>

Already tried that! ;-)

/Jan