users@jersey.java.net

Re: [Jersey] Custom Parameter Binding

From: Meeraj Kunnumpurath <mkunnumpurath_at_googlemail.com>
Date: Fri, 26 Jun 2009 08:30:48 +0100

Thanks Paul.

On Fri, Jun 26, 2009 at 7:53 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:

>
> On Jun 26, 2009, at 12:54 AM, Meeraj Kunnumpurath wrote:
>
> Paul,
>>
>> Couple of questions on the example ..
>>
>> 1. If I run within a Servlet container instead Grizzly, how do I configure
>> the runtime to use the ResourceParamInjector?
>>
>
> There is no difference. It is annotated with @Provider. Just make sure in
> your web.xml you have:
>
> <init-param>
>
> <param-name>com.sun.jersey.config.property.packages</param-name>
>
> <param-value>com.sun.jersey.samples.resourceinject</param-value>
> </init-param>
>
> (the above is declared programatically in the main method of the example).
> See the following for more details:
>
> https://jersey.dev.java.net/documentation/1.1.0-ea/user-guide.html#d4e115
>
>
>
> 2. Where is the logic of injecting the value of query parameter x into the
>> instance variable x of MyBean?
>>
>>
> You mean in the Jersey code ? Note that it is the same logic if you added
> that field (+annotation) to MyResource.
>
> To understand that i think it might be instructive to do a debug session,
> modify the MyBean to be:
>
> public static class MyBean {
> public MyBean(@QueryParam("x") String x) {
> // Set break point here
> }
>
> @QueryParam("x") String x;
>
> @QueryParam("x)
> public void setFoo(String foo) {
> // Set break point here
> }
> }
>
> Then you can get an idea where in Jersey things get invoked. The that
> performs the injection of a query parameter is here:
>
>
> http://fisheye4.atlassian.com/browse/jersey/trunk/jersey/jersey-server/src/main/java/com/sun/jersey/server/impl/model/parameter/QueryParamInjectableProvider.java?r=2097
>
> Paul.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>