Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8729495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:50:41+00:00 2026-06-13T08:50:41+00:00

My Servlet mapping looks like: <servlet-mapping> <servlet-name>myservlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> So my Servlet responds to

  • 0

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:

  1. I know how to do this using mod_rewrite / Apache — I’m looking for a different solution.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:50:42+00:00Added an answer on June 13, 2026 at 8:50 am

    If you are using Jetty installation. There are two ways to do it

    1. you can rename your war file as root.war, makes it’s context root as /
    2. create context.xml for your webapp

      <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
      <!-- Required minimal context configuration :                        -->
      <!--  + contextPath                                                  -->
      <!--  + war OR resourceBase                                          -->
      <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
      <Set name="contextPath">/</Set>
      <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/blawh.war</Set>
      

      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.d and webapps/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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in my web.xml <servlet> <servlet-name>channelConnected</servlet-name> <servlet-class>ChannelConnected</servlet-class> </servlet> <servlet-mapping> <servlet-name>channelConnected</servlet-name> <url-pattern>/_ah/channel/connected</url-pattern> </servlet-mapping> my servlet public
How can I use a Servlet Filter to change an incoming URL from http://nm-java.appspot.com/Check_License/Dir_My_App/Dir_ABC/My_Obj_123
Welcome file is not displayed correctly on hosting. web.xml: <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping>
<servlet> <servlet-name>Hello</servlet-name> <servlet-class>HelloWorld</servlet-class> </servlet> <servlet-mapping> <servlet-name>Hello</servlet-name> <url-pattern>/HelloWorld.do</url-pattern> </servlet-mapping> Why do we use url-pattern inside
In the java servlet, how to do mapping with this url : http://localhost8080/myproject/client/1234 the
I have an issue. It looks like PrettyFaces is overriding my webservlet url pattern.
I have a Struts2 (2.1.8.1) web application. My web.xml looks like, <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
I'm using gwt with maven plugin. My web.xml looks like this: <web-app xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://java.sun.com/xml/ns/javaee
I would like to send only the requests ending in .html through dispatcher-servlet and
I am using Struts 1.2.7 and have the standard servlet mapping that uses *.do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.