Hi,
I'm using a ContainerRequestFilter impl which serves as a Security
Filter and I wanted to use it to pass some custom properties to the
request so that it is accessible from any resource e.g. using @Context
injection on the HttpServletRequest.
I've tried setting InBoundHeaders but this did not seem to work...
Filter code:
public class MyFilter implements ContainerRequestFilter {
...
public ContainerRequest filter(ContainerRequest request) {
InBoundHeaders hdr = new InBoundHeaders();
hdr.addObject("myobj", obj);
request.setHeaders(hdr);
return request;
}
...
}
Resource code:
@Path...
...
public class BaseResource {
@Context
protected HttpServletRequest request;
// Injection onto constructor parameter
public BaseResource() {
System.out.println("My obj is: " + request.getHeader
("myobj")); // IS NULL
}
...
}
Have I missed a trick here or is there another way to do this?
Thanks,
Louis
Louis Polycarpou (founder)
Adjoovo
SERVICE-ORIENTED COLLABORATION
http://adjoovo.com
http://twitter.com/adjoovo
+44 (0) 7786 136653