users@jersey.java.net

Re: [Jersey] Re: Intercepting requests to resources and invoking other methods which in turn invokes the resource method

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Tue, 14 Sep 2010 07:48:50 -0700

On Sep 10, 2010, at 10:22 AM, DaHoopster wrote:

>
> Thanks for the pointer Paul. I have a couple of more questions though.
>
> 1. How is an instance of ResourceFilterFactory hooked into Spring?
>

You can declare that it is a singleton component using a Spring-based
annotation or by registering it in the XML config. Jersey will defer
to Spring to instantiate and manage.


> 2. I am not too sure about at what stage is ResourceFilterFactory
> being
> invoked by the framework. My thought is this:
>

At initialization. For each of a resource class method it will get
called and you can decide if you want to return a non empty list of
List<ResourceFilter>. It is up to you to analyze the information on
the AbstractMethod to decide if you need to filter or not. The
ResourceFilter will define the request and response filters. It is
those request and response filters that get invoked when a request is
processed, so it is a bit like this:

URL -> resource -> request filter -> resource method -> response
filter -> response

Paul.

> Http request to an URL -----> Resource Filter Factory -----> Resource
> methods
>
> Am I correct on 2?
>
> Thanks,
> Han
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Intercepting-requests-to-resources-and-invoking-other-methods-which-in-turn-invokes-the-resource-metd-tp5516338p5519147.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>