users@jersey.java.net

[Jersey] Re: Jersey test framework with JSPs

From: Srinivas Naresh Bhimisetty <shri.naresh_at_gmail.com>
Date: Mon, 11 Jun 2012 12:03:30 +0530

Hi Anuff,

  which test container are you using? Could be that the the JSP viewables
are not supported by the container you are using. Have you tried running
the tests with EmbeddedGlassFish?

- Naresh

On Wed, Jun 6, 2012 at 8:33 PM, Ed Anuff <ed_at_anuff.com> wrote:

>
> I'm doing the following in my unit tests to set up the test server. It
> works fine except that JSP viewables throw an error that they're not
> found. Any thoughts on how to fix this?
>
> descriptor = new WebAppDescriptor.Builder("com.anuff.testapp.rest")
> .contextParam("contextConfigLocation",
> "classpath:testApplicationContext.xml")
> .servletClass(SpringServlet.class)
> .contextListenerClass(ContextLoaderListener.class)
> .requestListenerClass(RequestContextListener.class)
> .initParam("com.sun.jersey.config.property.packages",
> "com.anuff.testapp.rest")
> .initParam("com.sun.jersey.api.json.POJOMappingFeature", "true")
> .initParam(
> "com.sun.jersey.spi.container.ResourceFilters",
>
> "com.sun.jersey.api.container.filter.RolesAllowedResourceFilterFactory")
> .initParam(
> "com.sun.jersey.config.property.JSPTemplatesBasePath",
> "/WEB-INF/jsp")
> .initParam(
> "com.sun.jersey.config.property.WebPageContentRegex",
> "/(((images|css|js|jsp|WEB-INF/jsp)/.*)|(favicon\\.ico))")
> .addFilter(DelegatingFilterProxy.class, "shiroFilter",
> MapUtils.hashMap("targetFilterLifecycle", "true"))
> .clientConfig(clientConfig).build();
>