I'm not sure, but I think you'd need to look at how Resteasy's Guice integration sets up the GuiceServletContextListener and how you can modify it.
Outside of Resteasy, I might use a regex to either include or exclude certain URLs. Eg. if user IDs are numeric, you could use "/\\d/". Also, putting all your CSS and JS files in a single folder, such as assets, will probably make things easier. You could then simply exclude or not map the assets folder. In a Servlet 3 container, files in META-INF/resources (if I'm not mistaken) can be served up directly via /resources/... Resteasy may have built-in support for that. (Webjars are a great way to take advantage of this feature) Finally, if you don't want to mess with the mapping, you could have a JAX-RS endpoint for index.html that returns the file. Mwanji On Apr 7, 2013 5:51 PM, "Xybrek" <[email protected]> wrote: > How can I allow my Guice configuration to serve static files from the > `root ("/")` context when this is my configuration: > > **web.xml** > > <context-param> > <param-name>resteasy.guice.modules</param-name> > <param-value>org.jboss.errai.ui.demo.server.MyModule</param-value> > </context-param> > > <listener> > <listener-class> > > org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener > </listener-class> > </listener> > > <servlet> > <servlet-name>Resteasy</servlet-name> > <servlet-class> > org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher > </servlet-class> > </servlet> > > <servlet-mapping> > <servlet-name>Resteasy</servlet-name> > <url-pattern>/*</url-pattern> > </servlet-mapping> > > > **Guice module:** > > public class MyModule implements Module { > public void configure(final Binder binder) { > binder.bind(MyResource.class); // Jax-RS resource i.e. GET, PUT > etc... > } > } > > The basic idea of I want to do is that keep my Resteasy configuration to > be able to serve Restful api from within the root context like * > http://localhost:8888/{userId}* > > As well as be able to serve static contents like: * > http://localhost:8888/index.html* or like *http://localhost:8888/main.css > *etc. > > Static files I need to serve include index.html and the like which are > stored in the *webapp* folder. > > What should be reconfigured to my current configuration to fit this need? > > > > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/google-guice?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-guice?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
