users@jersey.java.net

[Jersey] Re: jersey-guice static content configuration problem

From: cowwoc <cowwoc_at_bbs.darktech.org>
Date: Tue, 11 Dec 2012 17:30:47 -0500

     Your resources should be under /js and /css, not /WEB-INF/js and
/WEB-INF/css.

Gili

On 11/12/2012 3:24 PM, Philippe N wrote:
> Hi,
>
> I am having some trouble serving static content via the
> GuiceContainer. Here is my injector logic.
>
> @Override
> protected Injector getInjector() {
> return Guice.createInjector(new JerseyServletModule() {
> @Override
> protected void configureServlets() {
> install(new JpaPersistModule("my-persistence-unit"));
> filter("/*").through(PersistFilter.class);
> ApplicationConfiguration.bindResources(binder());
> bind(RestController.class);
> final Map<String, String> parameters = new HashMap<String,
> String>();
> parameters.put(ServletContainer.JSP_TEMPLATES_BASE_PATH,
> "/WEB-INF/jsp");
> //
> parameters.put(ServletContainer.FEATURE_FILTER_FORWARD_ON_404, "true");
> parameters.put(ServletContainer.PROPERTY_WEB_PAGE_CONTENT_REGEX,
> "/(js|css)/.*");
> filter("/*").through(GuiceContainer.class, parameters);
> }
> });
> }
>
> According to the documentation using the GuiceContainer as a filter
> should do the trick as long as I specify the
> PROPERTY_WEB_PAGE_CONTENT_REGEX.Unfortunately this does not work, I
> have also tried FEATURE_FILTER_FORWARD_ON_404 but it also doesn't give
> me any results.
>
> All the resources are under:
> /WEB-INF/js/*
> /WEB-INF/css/*
>
> The war file is properly build and when expanded through Tomcat 7.0.32
> all is in place.
>
> Any ideas?
>
> Thank you.