users@jersey.java.net

Re: Jersey with Spring always giving 404 for subresources

From: Jason Erickson <jason_at_jasonerickson.com>
Date: Tue, 23 Nov 2010 11:14:48 -0800

OK, I figured out the problem - it was in my web.xml. I had configured several paths for servlet mapping to the Jersey Spring servlet, but that didn't work. What did work was:
        <servlet-mapping>
                <servlet-name>jersey-spring</servlet-name>
                <url-pattern>/</url-pattern>
        </servlet-mapping>

I could not get any other mapping to work - giving me 404's on everything except for the explicit mapping path. Is this a bug? Or is there some reason why this is supposed to be the way it works?

On Nov 17, 2010, at 12:32 PM, Jason Erickson wrote:

> One more thing: When I put a breakpoints in the getTestText() and getTimelineResource() methods below and debug, a request to /reports will break, but a request to /reports/testitem doesn't, implying that it never enters the getTimelineResource method.
>
> On Nov 17, 2010, at 12:10 PM, Jason Erickson wrote:
>
>>> @Path("testitem")
>>> public TestItemResource getTimelinResource() {
>>> return timelineResource;
>>> }
>>>
>>> @GET
>>> @Produces(MediaType.TEXT_PLAIN)
>>> public String getTestText() {
>>> return "Success!\n";
>>> }
>