users@jersey.java.net

[Jersey] How to get the value of a PathParam outside a Resource class

From: DirkM <dirk_at_olx.com>
Date: Mon, 19 Oct 2009 08:45:53 -0700 (PDT)

I'm writing a ResourceFilterFactory, and I need to get the value of a path
param, so that I can validate it.

In this case I want to check that the token supplied in the oAuth
authentication header matches the userId specified in the request:

user/{userId}/getPrivateStuff

if(userId != oAuthUserId) {
  throw AuthenticationException("This is not your stuff");
}

This is easy enough to do for a single method, but I'd like to do it in the
ResourceFilterFactory so that I can check any method that has a userId
parameter in the query or path.

I can get the query parameter using
ContainerRequest.getQueryParameters().containsKey("userId");
Is it possible to get the PathParam?

Thanks,
Dirk
-- 
View this message in context: http://n2.nabble.com/How-to-get-the-value-of-a-PathParam-outside-a-Resource-class-tp3849795p3849795.html
Sent from the Jersey mailing list archive at Nabble.com.