Hi Christopher,
It should work if you extend from the JerseyServletModule:
http://jersey.java.net/nonav/apidocs/latest/contribs/jersey-guice/com/sun/jersey/guice/JerseyServletModule.html
and change @Context to @Inject
To fix this to work as you expect we need to add TypeListener support:
http://code.google.com/docreader/#p=google-guice&s=google-
guice&t=CustomInjections
so that Jersey can inject on stuff that it does not directly have
access to.
Thanks,
Paul.
On Jan 24, 2011, at 10:33 PM, Christopher Piggott wrote:
> Should this work?
>
> @RequestScoped
> @Path("/something")
> public class Resource {
> @Context SecurityContext sc; /* gets there just fine!!! */
>
> @Path("something");
> public Subresource returnSubResource(@In_at_InjectParam
> SubResource.Factory provider)
> {
> return provider.create("xyzzy");
> }
> }
>
> @RequestScoped
> public class SubResource {
> @Context SecurityContext sc; /* Where is it??? */
>
> @Path("something")
> public String returnSomething() { ... }
> }
>
>
> the sub resource is created using assisted injection. The Resource
> gets a SecurityContext injected into him just fine, but SubResource
> does not.
>
> Once I use assisted injection, is it my responsibility to inject
> context items like SecurityContext myself (as part of the Factory, for
> example)?
>
> --Chris