users@jersey.java.net

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

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Fri, 10 Sep 2010 12:04:39 +0200

Hi,

I think you may be able to use a ResourceFilterFatory. See the
RolesAllowedResourceFilter, you should be able to modify that code
appropriately to your requirements:

https://fisheye4.atlassian.com/browse/jersey/trunk/jersey/jersey-server/src/main/java/com/sun/jersey/api/container/filter/RolesAllowedResourceFilterFactory.java?r=HEAD

Paul.

On Sep 10, 2010, at 12:04 AM, DaHoopster wrote:

>
> Hi all,
>
> So I am developing web services that need to have change of roles
> dynamically. The users have a hierarchical role system. When user
> first logs
> in, it's at the top of the role hierarchy. So by default, the
> service only
> access resources available to the top level hierarchy. We have
> requirements
> that the web services should be able to take a query param of role
> and the
> services will access the the resources available to the provided role.
>
> The complication is that at the business logic layer, we can only do
> "getCurrentRole()". There is a framework in our current code base that
> allows this to happen:
>
> ApplicationServices.asRole(int roleID){
> public void invoke()
> {
> // other code
> }
> }
>
> I would like to execute the appropriate resource method inside the
> invoke()
> method there after intercepting the request.
>
> Can someone advise me on how to do this?
> --
> 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-tp5516338p5516338.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
>