users@jersey.java.net

Re: [Jersey] Jersey and Spring

From: Mike Jones <mike.a.jones_at_gmail.com>
Date: Mon, 7 Jul 2008 09:31:42 +0100

Hi Lars

I'm not sure if I will be much help, but I'm working on a project that
uses the Jersey-Spring module.

You can see the web.xml here:
http://code.google.com/p/caboto/source/browse/trunk/Caboto/caboto-web/src/main/webapp/WEB-INF/web.xml

The spring application context:
http://code.google.com/p/caboto/source/browse/trunk/Caboto/caboto-web/src/main/webapp/WEB-INF/spring/caboto-jaxrs-resources.xml

The resource file:
http://code.google.com/p/caboto/source/browse/trunk/Caboto/caboto/src/main/java/org/caboto/rest/resources/PersonPublicAnnotationResource.java

Cheers
Mike

2008/7/6 Lars Tackmann <lars_at_randompage.org>:
> Hi
>
> I recently tried out the jersey-spring integration. Unfortunately I
> have yet to get it working.
> My web.xml looks like this:
>
> http://svn.randompage.org/java/samples/jax-rs/acegi/src/main/webapp/WEB-INF/web.xml
>
> a example resource is available here:
>
> http://svn.randompage.org/java/sampales/jax-rs/acegi/src/main/java/org/randompage/samples/jaxrs/acegi/resources/UsersResource.java
>
> this resource works fine if I autowire it by hand (i.e use the
> standard Jersey servlet and start spring myself) but when I run it
> with the Jersey Spring servlet
> then something goes completely wrong. The resource still gets
> autowired, but my responses are not working out anymore i.e.
>
> --
> return Response.created(uri).entity(user).build();
> --
>
> does not result in my client getting a 201 response code, instead it
> always recives 200. This happens regardless of what I do in my
> resource code i.e. adding:
>
> --
> if(true)
> new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
> --
>
> still results in 200 OK. It is properly me who have missed something
> obvious so any help is welcome. A working
> Jersey/Spring example (suing the new jersey-spring module) would be
> top notch (especially if I can see the full
> web.xml/applicationContext.xml files).
>
> Thanks in advance
>
> --
> Yours sincerely
>
> Lars Tackmann
>
>
> 1) pom.xml http://svn.randompage.org/java/samples/jax-rs/acegi/pom.xml
> 2) applicationContext.xml
> http://svn.randompage.org/java/samples/jax-rs/acegi/src/main/resources/applicationContext.xml
> 3) security config:
> http://svn.randompage.org/java/samples/jax-rs/acegi/src/main/resources/springSecurity.xml
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>