users@jersey.java.net

Re: [Jersey] not-working custom provider in Jersey 1.1 (?)

From: Bruno De Nys <brunodenys_at_gmail.com>
Date: Fri, 26 Jun 2009 06:22:05 -0700 (PDT)

Thanks for clearing things out. During my searches across the internet I
didn't find much information pointing to this particular aspect (the
appropriate settings in web.xml when defining a customer resolver). I
actualy had been looking for a while how to correctly "register" those
custom providers. I found how to do it for the Apache implementation and
for Spring implementations, but I never obtained a hit via Google which told
me how to do it correctly for my setup.

Thanks for your time!

On Fri, Jun 26, 2009 at 3:13 PM, Paul Sandoz (via Nabble) <
ml-user+51078-16148994_at_n2.nabble.com<ml-user%2B51078-16148994_at_n2.nabble.com>
> wrote:

> Hi,
>
> Glad things are working.
>
> Given your set up there should be no scanning for resources because
> you are referring explicitly to an implementation of Application that
> does not do scanning.
>
> I am presuming given your set up the following servlet declaration in
> your web.xml should work:
>
> <servlet>
> <display-name>Jersey Web Application</display-name>
> <servlet-name>JSONThesauriServlet</servlet-name>
> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</
> servlet-class>
> <init-param>
>
> <param-name>com.sun.jersey.config.property.packages</param-name>
> <param-value>be.kvvcr.thesauri.rest</param-value>
> </init-param>
> </servlet>
>
> Paul.
>
> On Jun 26, 2009, at 3:00 PM, Bruno De Nys wrote:
>
> >
> > Thanks for your swift reply. I immediately noticed that your
> > example worked.
> > Hence the cause of the problem was probably in the setup/
> > configuration of my
> > project.
> >
> > The messages in the log-file of my tomcat 6.0.14 server made me
> > conclude
> > that my resolver was properly registered. This was a wrong
> > conclusion. The
> > solution was to explicitly include the resolver in the application
> > that I
> > had to register in the web.xml file.
> >
> > This is the excerpt of the web.xml file:
> > <servlet>
> > <display-name>Jersey Web Application</display-name>
> > <servlet-name>JSONThesauriServlet</servlet-name>
> >
> > <servlet-
> > class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-
> > class>
> > <init-param>
> > <param-name>javax.ws.rs.Application</param-name>
> > <param-value> be.kvvcr.thesauri.rest.ThesauriRestApp</param-
> > value>
> > </init-param>
> > </servlet>
> > and here is my new ThesauriRestApp (the line that was added is
> > "s.add(JAXBXSLResolver.class);"):
> > package be.kvvcr.thesauri.rest;
> >
> > import java.util.HashSet;
> > import java.util.Set;
> >
> > import javax.ws.rs.core.Application;
> >
> > public class ThesauriRestApp extends Application {
> >
> > @Override
> > public Set<Class<?>> getClasses() {
> > Set<Class<?>> s = new HashSet<Class<?>>();
> > s.add(DescriptorResource.class);
> > s.add(JAXBXSLResolver.class);
> > return s;
> > }
> >
> > }
> > There was one more hickup: the vendor specific JAXB extension for the
> > xmlHeaders property is not available when using the JAXB-support of
> > Java
> > 6.0. As a consequence I had to copy a more recent JAXB
> > implementation (I
> > took the JAXB reference implementation 20081030) to the tomcat
> > directory
> > containing the bootstrap classes (and make sure it was loaded before
> > loading
> > rt.jar).
> >
> > The strange thing is that I now no longer see a message in my tomcat
> > log-file saying that my resolver is loaded. It is as if the automatic
> > scanning no longer works. I have no idea why at first the JAX-RS
> > runtime
> > scanned for my resource and now no longer scans for my resources.
> >
> > Anyway, things now seem to work as expected.
> > --
> > View this message in context:
> http://n2.nabble.com/not-working-custom-provider-in-Jersey-1.1-%28-%29-tp3149611p3161381.html
> > Sent from the Jersey mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3161449&i=0>
> > For additional commands, e-mail: users-help@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3161449&i=1>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3161449&i=2>
> For additional commands, e-mail: users-help@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3161449&i=3>
>
>
>
> ------------------------------
> This email is a reply to your post @
> http://n2.nabble.com/not-working-custom-provider-in-Jersey-1.1-%28-%29-tp3149611p3161449.html
> You can reply by email or by visting the link above.
>
>

-- 
View this message in context: http://n2.nabble.com/not-working-custom-provider-in-Jersey-1.1-%28-%29-tp3149611p3161500.html
Sent from the Jersey mailing list archive at Nabble.com.