I'm attempting to make use of JAX-RS' (Jersey) MVC pattern. Attempts to reach http://localhost:8080/myproject/foos/test result in an error that reads:
java.io.IOException: The template name, /view, could not be resolved to a fully qualified template name
http://localhost:8080/myproject/foos results in the same error.
What am I missing?
Resource:
package resources; import com.sun.jersey.api.view.Viewable; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("foos") public class FooResource { @GET @Produces(MediaType.TEXT_HTML) public Viewable get() { return new Viewable("/index", this); } @GET @Path("{id}") @Produces(MediaType.TEXT_HTML) public Viewable get(@PathParam("id") String id) { return new Viewable("/view", id); } }
Views:
WEB-INF / jsp / resources / FooResource
- index.jsp
- view.jsp
web.xml:
jersey com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.WebPageContentRegex /(resources|images|js|styles|(WEB-INF/jsp))/.* jersey /* ServletAdaptor com.sun.jersey.spi.container.servlet.ServletContainer Set the default, base template path to the WEB-INF folder. com.sun.jersey.config.property.JSPTemplatesBasePath /WEB-INF/jsp 1 ServletAdaptor /* 30