My Servlet mapping looks like:
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
So my Servlet responds to requests such as http://bla.com/myservlet/bla/bla/bla
How can I make it respond to http://bla.com/bla/bla/bla and get rid of the myservlet portion of the path.
Further I want to strip the hello world servlet the the default welcome files that come with Jetty.
Thanks.
Note:
- I know how to do this using
mod_rewrite/ Apache — I’m looking for a different solution.
If you are using Jetty installation. There are two ways to do it
root.war, makes it’s context root as/create context.xml for your webapp
context.xml lives under
$JETTY_HOME/contexts. As you can see this directory already has context.xml for test.war. You can get decent idea of how your webapp’s context.xml should look like by seeing the test.xml.Once you are done with creating your own, go ahead and delete
contexts/test.xml,contexts/test.dandwebapps/test.war. (just to clean test stuffs). This answers your second question too.If you are using maven, just do this:
<plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <configuration> <webAppConfig> <contextPath>/</contextPath> </webAppConfig> <!-- snip -->refer: Jetty/Howto/Deploy Web Applications