On May 31, 2008, at 8:34 AM, Ralf Edmund Stranzenbach wrote:
>
> 1) Content negotiation
>
> As far as i can see, the content negotiation based on url extensions
> (such as .de.xml) does not work.
> Is there anything - like Restlets TunnelFilter - that needs to be
> enabled to activate this feature ?
>
Did you define the extension to media-type mappings in your
ApplicationConfig instance ?
>
> 2) POST request method is *not* accepted by infrastructure
>
> The following fragment is part of my UsersResource class.
>
> @Path("/users")
> public class UsersResource {
> ...
> @POST
> @ConsumeMime("application/xml")
> @ProduceMime("application/xml")
> public Response createUser(User user) {
> Session session = HibernateUtil.getSessionFactory().openSession();
> Transaction tx = session.beginTransaction();
>
> user.setId(null);
> session.save(user);
> tx.commit();
> session.close();
> return Response.ok(user).build();
> }
> ...
>
Hmm, it looks OK at first glance. What does the
de.reswi.jersey.domain.User class look like - is it a JAXB class ?
Thanks,
Marc.
> Enclosed you may find the exception message raised by the container:
>
> 31.05.2008 14:21:53 com.sun.jersey.api.core.ClasspathResourceConfig
> init
> INFO: Root resource classes found:
> class de.reswi.jersey.resources.UsersResource
> class de.reswi.jersey.resources.HelloWorldResource
> 31.05.2008 14:21:53 com.sun.jersey.api.core.ClasspathResourceConfig
> init
> INFO: Provider classes found:
> 31.05.2008 14:21:54
> com.sun.jersey.impl.application.ResourceMethodDispatcherFactory
> getDispatcher
> SCHWERWIEGEND: Error processing method, public
> javax.ws.rs.core.Response
> de
> .reswi
> .jersey
> .resources.UsersResource.createUser(de.reswi.jersey.domain.User),
> for WebResourceInvoker,
> com
> .sun
> .jersey
> .impl
> .model
> .method.dispatch.FormDispatchProvider.java.lang.NullPointerException
> at
> com
> .sun
> .jersey
> .impl
> .model
> .method
> .dispatch
> .FormDispatchProvider.processParameters(FormDispatchProvider.java:178)
> at
> com
> .sun
> .jersey
> .impl
> .model
> .method
> .dispatch.FormDispatchProvider.create(FormDispatchProvider.java:152)
> at
> com
> .sun
> .jersey
> .impl
> .application
> .ResourceMethodDispatcherFactory
> .getDispatcher(ResourceMethodDispatcherFactory.java:60)
> at
> com
> .sun
> .jersey
> .impl.model.method.ResourceHttpMethod.<init>(ResourceHttpMethod.java:
> 48)
> at
> com
> .sun
> .jersey
> .impl.model.method.ResourceHttpMethod.<init>(ResourceHttpMethod.java:
> 41)
> at
> com
> .sun
> .jersey.impl.model.ResourceClass.processMethods(ResourceClass.java:
> 231)
> at
> com.sun.jersey.impl.model.ResourceClass.<init>(ResourceClass.java:95)
> at
> com
> .sun
> .jersey
> .impl
> .application
> .WebApplicationImpl.newResourceClass(WebApplicationImpl.java:272)
> at
> com
> .sun
> .jersey
> .impl
> .application
> .WebApplicationImpl.getResourceClass(WebApplicationImpl.java:243)
> at
> com
> .sun
> .jersey
> .impl
> .application
> .WebApplicationImpl.processRootResources(WebApplicationImpl.java:675)
> at
> com
> .sun
> .jersey
> .impl
> .application.WebApplicationImpl.initiate(WebApplicationImpl.java:562)
> at
> com
> .sun
> .jersey
> .impl
> .application.WebApplicationImpl.initiate(WebApplicationImpl.java:433)
> at
> com
> .sun
> .jersey
> .spi
> .container.servlet.ServletContainer.initiate(ServletContainer.java:
> 385)
> at
> com
> .sun
> .jersey
> .spi.container.servlet.ServletContainer.load(ServletContainer.java:
> 313)
> at
> com
> .sun
> .jersey
> .spi.container.servlet.ServletContainer.init(ServletContainer.java:
> 121)
>
> This exception was raised during the discovery phase of the resource
> classes.
> Based on my very limited understanding of JAX-RS im confident, this
> resources basic configuration should be correct.
>
> Is there anything i've missed ?
>
>
>
> Regards
> Ralf E. Stranzenbach
>
>
>
>
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.