On Nov 18, 4:45 am, Kazimierz Pogoda <[email protected]> wrote:
> You can pass everything /* through GuiceFilter in web.xml, and then in
> your ServletModule:
>
> serveRegex("^((?!^/index\\.html$|^/test\\.html$).)*$").with(MyServlet.class )

Aesthetically, I think I prefer having a url prefix for the guice
filter. Neither seem to be ideal; I would love something like

serveStatic("/index.html").with(new File("war/static/index.html"))

I'm no servlet expert, but it seems like this could be implemented in
the guice servlet by having a map of urls to files, and maybe a
another servlet that just spits out the file contents when asked for.

--
rwsims

> It will pass every URI to your servlet, except /index.html and
> /test.html which will be served by servlet container's default
> servlet. Maybe this useful trick should be documented in ServletModule
> documentation? It could help a lot when defining request authorization
> with filterRegex, which I consider guice-servlets's unique feature.
>
> On Wed, Nov 17, 2010 at 10:46 PM, decitrig <[email protected]> wrote:
> > I could swear I saw something on serving static files through guice
> > servlet somewhere, but I can find it now, if it ever existed. Right
> > now I have guice servlet listening on /app/* urls, so that, for
> > example, /index.html won't go through the servlet. I would like to be
> > able to listen on /* and have /index.html served up statically (it's a
> > GWT host page). Any suggestions?
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "google-guice" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-guice?hl=en.
>
> --
> "Meaning is differential not referential"
>
> kazik 'morisil' pogodahttp://www.xemantic.com/http://blog.xemantic.com/

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to