title: Jersey with Spring AOP
body: <p>I would like my AOP advice to have a handle to the currently executing Jersey resource's HttpContext. The <a href="http://java.net/projects/jersey/sources/svn/content/trunk/jersey/samples/spring-annotations/src/main/java/com/sun/jersey/samples/springannotations/resources/aop/SecurityAdvice.java?rev=5496" rel="nofollow">spring-annotations</a> sample mentions that the user could get hold of the request and authenticate etc.,, but how does one get hold of any of the values in the Context in the advice?</p>
  
  <p>Currently my resource definition looks like this:</p>
  
  <pre><code>    @Singleton
      @Path("/persist")
      public class ContentResource {
  
          @PUT
          @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
          @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
          @Auth
          public Content save(Content content){
             //Do some thing with the data
          }
      }
  </code></pre>
  
  <p>And the aspect is defined so:</p>
  
  <pre><code>    @Aspect
      public class AuthorizeProcessor {
  
          @Around(value="@annotation(package.Auth) and @annotation(auth)", argNames = "auth")
          public Object authorize(ProceedingJoinPoint pjp, Auth auth) throws Throwable{
              //How do I get the HttpContext here?
              return pjp.proceed();
          }
      }
  </code></pre>