I am not using spring. But I am using the jersey servlet and I have
specified the package where the path endpoints are and my one provider.
The paths are pi Med up. Just not the provider.
Thanks
Brian
On Mar 28, 2013 3:01 PM, "Joseph Mocker" <jmocker_at_velti.com> wrote:
> Maybe your ContextResolver is not being picked up by Jersey. For example
> if you are using the spring-jersey integration you probably have to include
> the parameter "com.sun.jersey.config.property.packages" in your web.xml
> file to tell jersey to scan specific packages for providers, etc.
>
> --joe
>
>
> Joseph Mocker | Velti | Senior Software Architect
> t +1.650.566.7033 m
> e jmocker_at_velti.com @Mobclix
>
> The leading global technology provider of
> mobile marketing and advertising solutions
>
> On Mar 28, 2013, at 2:11 PM, <brian_at_gabey.com>
> <brian_at_gabey.com> wrote:
>
> > I followed the example in the users guide for adding a ContextResolver
> > so I can pick the JSON encoding style.
> > The getContext method is never called on my class.
> > It is in the package with the Path Endpoints (Which are picked up
> > fine).
> > I am very confused and any help would be nice.
> >
> > Thanks,
> > Brian
> > Example code
> > public class JAXBContextResolver implements
> > ContextResolver<JAXBContext> {
> >
> > private JAXBContext context;
> > private Set<Class> types;
> > private Class[] clss =
> > {StorageSystemListResponse.class,StorageSystemResponse.class};
> >
> > public JAXBContextResolver() throws Exception {
> > types=new HashSet<>(Arrays.asList(clss));
> > System.out.println("************************** IN JAXB
> > 1**************************************");
> > System.err.println("************************** IN JAXB
> > 1**************************************");
> > this.context = new
> > JSONJAXBContext(JSONConfiguration.badgerFish().build(),clss);
> > }
> > public JAXBContext getContext(Class<?> objectType) {
> > System.out.println("************************** IN JAXB
> > 2**************************************");
> > System.err.println("************************** IN JAXB
> > 2**************************************");
> >
> > return (types.contains(objectType)) ? context : null;
> > }
> > }
>
>