[jax-rs-spec users] [jsr339-experts] INjecting ResourceContext into a filter.

From: Jan Algermissen <>
Date: Thu, 8 Nov 2012 08:50:12 +0100

Using ResourceContext, it would then also be possible to do the following, or?

(Enable full per-request DI on arbitrary instance inside a provider)

class TestFilter implements ContainerRequestFilter {
HttpHeaders headers;

ResourceContext rc;

void filter(ContainerRequestContext requestContext) ... {

       SomeHelpingClass h = rc.initResource(new SomeHelpingClass(...))



public class SomeHelpingClass {

 @PathParam("id") String id;

 public SomeHelpingClass() {


Would that work?