users@jersey.java.net

Re: [Jersey] Re: Jersey Guice JSP how to?

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Wed, 20 Oct 2010 11:07:22 +0200

On Oct 16, 2010, at 5:07 PM, Zhanming Qi wrote:

>
> Hi Paul,
>
> Thanks for your reply. I use jersey 1.4, It works.
> I thought, maybe it was my mistake for 1.3, whatever it works now.
>
> Here is another question. The static css file doesn't work.
>
> I found some solution from this url:
> http://jersey.576304.n2.nabble.com/WebPageContentRegex-and-Guice-integration-td3615214.html
> and this: http://github.com/charliek/jersey-guice-example
>
> here is my ServletModule()
>
> new JerseyServletModule() {
> @Override
> protected void configureServlets() {
> // bind web resources
> bind(Index.class);
> // setup Jersey
> Map<String, String> params = new HashMap<String, String>();
> params.put("com.sun.jersey.config.feature.ImplicitViewables",
> "true");
> params.put("com.sun.jersey.config.feature.Redirect", "true");
> params.put("com.sun.jersey.config.property.packages",
> "org.example.jersey.action");
> // this serves the static content
> serveRegex("/(images|style)/.*").with(DefaultWrapperServlet.class);
> serve("/*").with(GuiceContainer.class, params);
> }
> }
>
> But it didn't works for me. Is there some other fix?

Try:

   filter("/*").through(GuiceContainer.class, params);

See the following thread:

http://markmail.org/search/?q=list%3Anet.java.dev.jersey.users+Viewable+JSPs+via+Guice+%28Jersey+1.3%29.#query
:list%3Anet.java.dev.jersey.users%20Viewable%20JSPs%20via%20Guice
%20%28Jersey%201.3%29.+page:1+mid:blizrclnhfkilfzw+state:results

There are some bugs in the Guice servlet support.

Paul.