I have two simple resource classes in my Spring configured web service application. The root one (/reports) works correctly while any path after that returns a 404. Here are the resource classes:
package com.factorlab.ws.reports;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Component
@Scope("prototype")
@Path("reports")
public class ReportsResource {
@Autowired
private TestItemResource timelineResource;
@Path("testitem")
public TestItemResource getTimelinResource() {
return timelineResource;
}
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getTestText() {
return "Success!\n";
}
}
And the sub-resource is here:
package com.factorlab.ws.reports;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Component
@Scope("prototype")
public class TestItemResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Success!\n";
}
}
I deploy the application to Jetty in a webapp called factorlab-ws. curl
http://localhost:8080/factorlab-ws/reports yields success. However curl
http://localhost:8080/factorlab-ws/reports/testitem gives a 404 status.
What could I be missing?