Hi Lars,
I would say that your UsersResource is not set up correctly: I'd say
that it is not create by spring and therefore the UserManager should not
be injected. That you receive status 200 all the time sounds really
weird to me!
But let's first check if your UsersResource is set up as expected.
Can you please check, if the UserManager is already injected? If not,
you should add @Component to your UsersResource, so that spring is aware
of this class.
Creating examples showing how to use spring is completely true, only
time is the issue :)
Right now the tests for the spring-integration show how to use it, have
a look in the sources for this ([1], [2].
Regarding the issue that you always get status 200, I'd suggest that you
create some HelloWorldResource that does not depend on spring but simply
throws a WebApplicationException as you showed below. Just to see, if it
has anything to do with the spring-integration or not...
Cheers,
Martin
[1]
https://jersey.dev.java.net/source/browse/jersey/trunk/jersey/contribs/spring/src/test/java/com/sun/jersey/spring25/
[2]
https://jersey.dev.java.net/source/browse/jersey/trunk/jersey/contribs/spring/src/test/conf/
On Sun, 2008-07-06 at 16:05 +0200, Lars Tackmann wrote:
> 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