users@jersey.java.net

Re: [Jersey] Re: custom TemplateProcessor not having its constructor injected?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 22 Apr 2009 16:45:32 +0200

On Apr 22, 2009, at 1:28 PM, Paul Sandoz wrote:
>>
>> Just to answer my own question - DOH - not enough coffee! (Note to
>> self - have another cup before posting...)
>>
>> The trick is not to use the JSPTemplateProcessor's style of
>> constructor, but just inject the required attributes...
>>
>> @Context
>> HttpServletRequest request;
>>
>> @Context
>> HttpServletResponse response;
>>
>> I wonder if its worth adding a little comment to the constructor of
>> JSPTemplateProcessor to help avoid other folks not having had much
>> coffee and copy and pasting that constructor code then scratching
>> their heads when all the parameters are null?
>>
>
> I will do one better and modify it to be a proper component using
> @Context for injection on the constructor parameters and registering
> in the set of classes of the resource config.
>

Done:

http://fisheye4.atlassian.com/browse/~raw,r=2281/jersey/trunk/jersey/
jersey-server/src/main/java/com/sun/jersey/server/impl/container/
servlet/JSPTemplateProcessor.java

Paul.