You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by Paulo Borges <ab...@hotmail.com> on 2011/06/23 22:34:15 UTC

Wink Jackson extension

Hi:

I was wondering if dropping Wink Jackson provider extension in WEB-INF/lib is enough to have it registered as a default JSON provider or other configuration is needed. I could not find any info on this one in userguide.pdf doc.

regards,
 		 	   		  

Re: Wink Jackson extension

Posted by Bryant Luk <br...@gmail.com>.
The warning can be ignored. What's happening is that you added it in
your Application sub-class so Wink will find that first. Then Wink
tries to look for the META-INF/wink-application files and built-in
system providers which are automatically registered. So it does
register the first instance but it ignores the auto-registration. The
warning was for situations where someone returns objects of the same
class in the Application.getSingletons() which are ignored (as defined
in the JAX-RS spec I believe since it would lead to potentially
undefined behavior). You can remove the META-INF/wink-application from
the Wink Jackson JAR to make the auto-registration go away.

On Fri, Jun 24, 2011 at 9:10 AM, Paulo Borges <ab...@hotmail.com> wrote:
>
> Hi:
>
> When I add the Jackson provider to the getSingleton method. I get the following warning:
>
> [24/06/11 9:55:13:631 EDT] 00000017 SystemErr     R 524 [ORB.thread.pool : 1] INFO org.apache.wink.common.internal.application.ApplicationFileLoader - The runtime is loading the JAX-RS application from wsjar:file:/C:/projects/rest/wink/winkIBMJackson/winkJackson/WebContent/WEB-INF/lib/wink-jackson-provider-1.1.3-incubating.jar!/META-INF/wink-application
> [24/06/11 9:55:13:929 EDT] 00000017 SystemErr     R 822 [ORB.thread.pool : 1] WARN org.apache.wink.common.internal.application.ApplicationValidator - The class org.apache.wink.providers.jackson.WinkJacksonJaxbJsonProvider was already added to the JAX-RS runtime. The runtime is ignoring this value.  Check that this class was not returned in the javax.ws.rs.core.Application subclass getSingletons() and getClasses() methods.
>
> I am trying to understand what happens here, please correct me if I am wrong:
>
> If I do not add         WinkJacksonJaxbJsonProvider from extension jar wink-jackson-provider-1.1.3-incubating.jar in my singleton method, the provider stills get registered through META-INF/wink-application in the jar. However IT DOES NOT TAKES ANY PRECEDENCE OVER OTHER JASON PROVIDERS.
>
> If I DO ADD WinkJacksonJaxbJsonProvider from extension jar wink-jackson-provider-1.1.3-incubating.jar in my singleton method, It will not only be registered as JASON provider but also it takes precedence over all other JASON providers. The only drawback is that when an attempt is made by the framework to register the provider through META-INF/wink-application, I will get those warnings that it has already been registered and it is ignored.
>
> ----------------------------------------
>> From: bryant.luk@gmail.com
>> Date: Thu, 23 Jun 2011 17:41:11 -0500
>> Subject: Re: Wink Jackson extension
>> To: wink-user@incubator.apache.org
>>
>> Yes, it should take precedence over all JSON providers, and I think
>> your code is correct. You could also return providers in the
>> getClasses() method if you don't have any custom initialization code
>> (i.e. use default constructor only).
>>
>> On Thu, Jun 23, 2011 at 5:17 PM, Paulo Borges <ab...@hotmail.com> wrote:
>> >
>> >,
>> > Bryant:
>> > The extension indeed comes with META-INF/wink-application. When you say:
>> >
>> >>>  If you want it to take precedent over any other provider (versus just having it auto-registered),
>> >>>   you should return it in your Application sub-class or wink-application file.
>> >
>> > Do you mean, it takes precedence over all (basically default) JSON providers. If so, would the following method do it in my
>> > Application class
>> >
>> >     @Override
>> >     public Set<Object> getSingletons() {
>> >         Set<Object> s = new HashSet<Object>();
>> >         //The following is the class file in extension.jar
>> >         WinkJacksonJaxbJsonProvider jacksonProvider = new WinkJacksonJaxbJsonProvider();
>> >         s.add(jacksonProvider);
>> >         return s;
>> >     }
>> >
>> > ----------------------------------------
>> >> From: bryant.luk@gmail.com
>> >> Date: Thu, 23 Jun 2011 16:12:42 -0500
>> >> Subject: Re: Wink Jackson extension
>> >> To: wink-user@incubator.apache.org
>> >>
>> >> Hello,
>> >>
>> >> For the Wink Jackson extension JAR, it should have a
>> >> META-INF/wink-application file in it which auto-registers the
>> >> provider. The logs should also indicate that the
>> >> WinkJacksonJaxbJsonProvider if they are turned on to "all". If you
>> >> want it to take precedent over any other provider (versus just having
>> >> it auto-registered), you should return it in your Application
>> >> sub-class or wink-application file.
>> >>
>> >> On Thu, Jun 23, 2011 at 3:34 PM, Paulo Borges <ab...@hotmail.com> wrote:
>> >> >
>> >> > Hi:
>> >> >
>> >> > I was wondering if dropping Wink Jackson provider extension in WEB-INF/lib is enough to have it registered as a default JSON provider or other configuration is needed. I could not find any info on this one in userguide.pdf doc.
>> >> >
>> >> > regards,
>> >> >
>> >
>

RE: Wink Jackson extension

Posted by Paulo Borges <ab...@hotmail.com>.
Hi:

When I add the Jackson provider to the getSingleton method. I get the following warning:

[24/06/11 9:55:13:631 EDT] 00000017 SystemErr     R 524 [ORB.thread.pool : 1] INFO org.apache.wink.common.internal.application.ApplicationFileLoader - The runtime is loading the JAX-RS application from wsjar:file:/C:/projects/rest/wink/winkIBMJackson/winkJackson/WebContent/WEB-INF/lib/wink-jackson-provider-1.1.3-incubating.jar!/META-INF/wink-application
[24/06/11 9:55:13:929 EDT] 00000017 SystemErr     R 822 [ORB.thread.pool : 1] WARN org.apache.wink.common.internal.application.ApplicationValidator - The class org.apache.wink.providers.jackson.WinkJacksonJaxbJsonProvider was already added to the JAX-RS runtime. The runtime is ignoring this value.  Check that this class was not returned in the javax.ws.rs.core.Application subclass getSingletons() and getClasses() methods.

I am trying to understand what happens here, please correct me if I am wrong:

If I do not add         WinkJacksonJaxbJsonProvider from extension jar wink-jackson-provider-1.1.3-incubating.jar in my singleton method, the provider stills get registered through META-INF/wink-application in the jar. However IT DOES NOT TAKES ANY PRECEDENCE OVER OTHER JASON PROVIDERS.

If I DO ADD WinkJacksonJaxbJsonProvider from extension jar wink-jackson-provider-1.1.3-incubating.jar in my singleton method, It will not only be registered as JASON provider but also it takes precedence over all other JASON providers. The only drawback is that when an attempt is made by the framework to register the provider through META-INF/wink-application, I will get those warnings that it has already been registered and it is ignored.

----------------------------------------
> From: bryant.luk@gmail.com
> Date: Thu, 23 Jun 2011 17:41:11 -0500
> Subject: Re: Wink Jackson extension
> To: wink-user@incubator.apache.org
>
> Yes, it should take precedence over all JSON providers, and I think
> your code is correct. You could also return providers in the
> getClasses() method if you don't have any custom initialization code
> (i.e. use default constructor only).
>
> On Thu, Jun 23, 2011 at 5:17 PM, Paulo Borges <ab...@hotmail.com> wrote:
> >
> >,
> > Bryant:
> > The extension indeed comes with META-INF/wink-application. When you say:
> >
> >>>  If you want it to take precedent over any other provider (versus just having it auto-registered),
> >>>   you should return it in your Application sub-class or wink-application file.
> >
> > Do you mean, it takes precedence over all (basically default) JSON providers. If so, would the following method do it in my
> > Application class
> >
> >     @Override
> >     public Set<Object> getSingletons() {
> >         Set<Object> s = new HashSet<Object>();
> >         //The following is the class file in extension.jar
> >         WinkJacksonJaxbJsonProvider jacksonProvider = new WinkJacksonJaxbJsonProvider();
> >         s.add(jacksonProvider);
> >         return s;
> >     }
> >
> > ----------------------------------------
> >> From: bryant.luk@gmail.com
> >> Date: Thu, 23 Jun 2011 16:12:42 -0500
> >> Subject: Re: Wink Jackson extension
> >> To: wink-user@incubator.apache.org
> >>
> >> Hello,
> >>
> >> For the Wink Jackson extension JAR, it should have a
> >> META-INF/wink-application file in it which auto-registers the
> >> provider. The logs should also indicate that the
> >> WinkJacksonJaxbJsonProvider if they are turned on to "all". If you
> >> want it to take precedent over any other provider (versus just having
> >> it auto-registered), you should return it in your Application
> >> sub-class or wink-application file.
> >>
> >> On Thu, Jun 23, 2011 at 3:34 PM, Paulo Borges <ab...@hotmail.com> wrote:
> >> >
> >> > Hi:
> >> >
> >> > I was wondering if dropping Wink Jackson provider extension in WEB-INF/lib is enough to have it registered as a default JSON provider or other configuration is needed. I could not find any info on this one in userguide.pdf doc.
> >> >
> >> > regards,
> >> >
> >
 		 	   		  

Re: Wink Jackson extension

Posted by Bryant Luk <br...@gmail.com>.
Yes, it should take precedence over all JSON providers, and I think
your code is correct. You could also return providers in the
getClasses() method if you don't have any custom initialization code
(i.e. use default constructor only).

On Thu, Jun 23, 2011 at 5:17 PM, Paulo Borges <ab...@hotmail.com> wrote:
>
>
> Bryant:
> The extension indeed comes with META-INF/wink-application. When you say:
>
>>>  If you want it to take precedent over any other provider (versus just having it auto-registered),
>>>   you should return it in your Application sub-class or wink-application file.
>
> Do you mean, it takes precedence over all (basically default) JSON providers. If so, would the following method do it in my
> Application class
>
>     @Override
>     public Set<Object> getSingletons() {
>         Set<Object> s = new HashSet<Object>();
>         //The following is the class file in extension.jar
>         WinkJacksonJaxbJsonProvider jacksonProvider = new WinkJacksonJaxbJsonProvider();
>         s.add(jacksonProvider);
>         return s;
>     }
>
> ----------------------------------------
>> From: bryant.luk@gmail.com
>> Date: Thu, 23 Jun 2011 16:12:42 -0500
>> Subject: Re: Wink Jackson extension
>> To: wink-user@incubator.apache.org
>>
>> Hello,
>>
>> For the Wink Jackson extension JAR, it should have a
>> META-INF/wink-application file in it which auto-registers the
>> provider. The logs should also indicate that the
>> WinkJacksonJaxbJsonProvider if they are turned on to "all". If you
>> want it to take precedent over any other provider (versus just having
>> it auto-registered), you should return it in your Application
>> sub-class or wink-application file.
>>
>> On Thu, Jun 23, 2011 at 3:34 PM, Paulo Borges <ab...@hotmail.com> wrote:
>> >
>> > Hi:
>> >
>> > I was wondering if dropping Wink Jackson provider extension in WEB-INF/lib is enough to have it registered as a default JSON provider or other configuration is needed. I could not find any info on this one in userguide.pdf doc.
>> >
>> > regards,
>> >
>

RE: Wink Jackson extension

Posted by Paulo Borges <ab...@hotmail.com>.

Bryant:
The extension indeed comes with META-INF/wink-application. When you say:

>>  If you want it to take precedent over any other provider (versus just having it auto-registered), 
>>   you should return it in your Application sub-class or wink-application file.

Do you mean, it takes precedence over all (basically default) JSON providers. If so, would the following method do it in my
Application class

    @Override
    public Set<Object> getSingletons() {
        Set<Object> s = new HashSet<Object>();
        //The following is the class file in extension.jar
        WinkJacksonJaxbJsonProvider jacksonProvider = new WinkJacksonJaxbJsonProvider();
        s.add(jacksonProvider);
        return s;
    }

----------------------------------------
> From: bryant.luk@gmail.com
> Date: Thu, 23 Jun 2011 16:12:42 -0500
> Subject: Re: Wink Jackson extension
> To: wink-user@incubator.apache.org
>
> Hello,
>
> For the Wink Jackson extension JAR, it should have a
> META-INF/wink-application file in it which auto-registers the
> provider. The logs should also indicate that the
> WinkJacksonJaxbJsonProvider if they are turned on to "all". If you
> want it to take precedent over any other provider (versus just having
> it auto-registered), you should return it in your Application
> sub-class or wink-application file.
>
> On Thu, Jun 23, 2011 at 3:34 PM, Paulo Borges <ab...@hotmail.com> wrote:
> >
> > Hi:
> >
> > I was wondering if dropping Wink Jackson provider extension in WEB-INF/lib is enough to have it registered as a default JSON provider or other configuration is needed. I could not find any info on this one in userguide.pdf doc.
> >
> > regards,
> >
 		 	   		  

Re: Wink Jackson extension

Posted by Bryant Luk <br...@gmail.com>.
Hello,

For the Wink Jackson extension JAR, it should have a
META-INF/wink-application file in it which auto-registers the
provider. The logs should also indicate that the
WinkJacksonJaxbJsonProvider if they are turned on to "all". If you
want it to take precedent over any other provider (versus just having
it auto-registered), you should return it in your Application
sub-class or wink-application file.

On Thu, Jun 23, 2011 at 3:34 PM, Paulo Borges <ab...@hotmail.com> wrote:
>
> Hi:
>
> I was wondering if dropping Wink Jackson provider extension in WEB-INF/lib is enough to have it registered as a default JSON provider or other configuration is needed. I could not find any info on this one in userguide.pdf doc.
>
> regards,
>