Hi,
I'm having trouble get Viewable JSPs to work in 1.3. All GETs result in
404.
I'm configuring Jersey via Guice as follows
[[[
public class ResourceBindingModule extends ServletModule
{
public ResourceBindingModule() {
}
@Override
protected void configureServlets() {
Map<String, String> params = new HashMap<String, String>();
params.put(PackagesResourceConfig.PROPERTY_PACKAGES,
"com.foo");
params.put(ResourceConfig.FEATURE_TRACE, "true");
serve("/api/*").with(com.sun.jersey.guice.spi.container.servlet.GuiceContainer.class, params);
}
}
]]]
And I've copied in IndexManagementServlet
(
http://jersey.576304.n2.nabble.com/problem-with-jsp-Viewable-not-being-evaluated-td4101170.html) to test things:
[[[
@Path("manager")
@Produces({"text/html", "application/xhtml+xml", "application/xml"})
public class IndexManagementServlet {
@GET
@Path("count")
public Viewable index() {
return new Viewable("/count", "THE MODEL");
}
}
]]]
with count.jsp placed where it should be - I can access it directly as a
JSP. I can see the index() method was found and the Viewable was matched
to ViewableMessageBodyWriter:
[[[
HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
X-Jersey-Trace-000: accept root resource classes: "/manager/count"
X-Jersey-Trace-001: match path "/manager/count" -> "/application
\.wadl(/.*)?", "/oauth2/foo(/.*)?", "/WebLogout(/.*)?",
"/WebLogin(/.*)?", "/manager(/.*)?", "/account(/.*)?", "/oauth2(/.*)?",
"/wrap(/.*)?", "(/.*)?"
X-Jersey-Trace-002: accept right hand path
java.util.regex.Matcher[pattern=/manager(/.*)? region=0,14
lastmatch=/manager/count]: "/manager/count" -> "/manager" : "/count"
X-Jersey-Trace-003: accept resource: "manager" -> @Path("/manager")
com.foo.webauth.web.resource.IndexManagementServlet_at_1b0b765
X-Jersey-Trace-004: match path "/count" -> "/count(/)?", ""
X-Jersey-Trace-005: accept right hand path
java.util.regex.Matcher[pattern=/count(/)? region=0,6 lastmatch=/count]:
"/count" -> "/count" : ""
X-Jersey-Trace-006: accept sub-resource methods: "manager" : "/count",
GET -> com.foo.webauth.web.resource.IndexManagementServlet_at_1b0b765
X-Jersey-Trace-007: matched sub-resource method: @Path("/count") public
com.sun.jersey.api.view.Viewable
com.foo.webauth.web.resource.IndexManagementServlet.index()
X-Jersey-Trace-008: matched message body writer:
com.sun.jersey.api.view.Viewable_at_1ddc55f, "text/html" ->
com.sun.jersey.server.impl.template.ViewableMessageBodyWriter_at_354093
Content-Type: text/html;charset=utf-8
Content-Length: 1006
Date: Fri, 27 Aug 2010 13:37:13 GMT
]]]
But after that, a 404. Is this something to do with being configured via
Guice?
Bill