Skip to main content

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

  • From: Jan Algermissen <jan.algermissen@...>
  • To: jsr339-experts@...
  • Subject: [jsr339-experts] Re: [jax-rs-spec users] INjecting ResourceContext into a filter.
  • Date: Thu, 8 Nov 2012 15:35:47 +0100


On Nov 8, 2012, at 3:33 PM, Santiago Pericas-Geertsen 
<Santiago.PericasGeertsen@...> wrote:

> Jan,
> 
> Good question. According to the spec this should work. Section 8.1 refers 
> to the context types in Section 8.2 and ResourceContext is there. 
> ResourceContext is in request scope and should be proxied when injected in 
> a provider that is in application scope (the default for providers).

Ok, thanks. I don't care so much to get it working in practice. I just want 
to be sure the spec 'intends' it to work.

I take your reply as a 'yes' :-)

Jan



> 
> -- Santiago
> 
> On Nov 8, 2012, at 2:50 AM, Jan Algermissen <jan.algermissen@...> wrote:
> 
>
>> Using ResourceContext, it would then also be possible to do the following, 
>> or?
>
>> (Enable full per-request DI on arbitrary instance inside a provider)
>
>
>> @Provider
>> class TestFilter implements ContainerRequestFilter {
>>      
>> @Context
>> HttpHeaders headers; 
>
>> @Context
>> ResourceContext rc;
>>              
>
>> void filter(ContainerRequestContext requestContext) ... {
>
>>      SomeHelpingClass h = rc.initResource(new SomeHelpingClass(...))
>
>> } 
>
>
>> }    
>
>
>> public class SomeHelpingClass {
>
>> @PathParam("id") String id;
>
>> public SomeHelpingClass() {
>> }
>
>> }
>
>
>> Would that work?
>
>> Jan
>
>
> 



[jsr339-experts] INjecting ResourceContext into a filter.

Jan Algermissen 11/08/2012

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

Santiago Pericas-Geertsen 11/08/2012

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

Jan Algermissen 11/08/2012

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

Sergey Beryozkin 11/12/2012

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

Santiago Pericas-Geertsen 11/12/2012

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

Sergey Beryozkin 11/12/2012
 
 
Close
loading
Please Confirm
Close