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 8962601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:09:51+00:00 2026-06-15T16:09:51+00:00

In my web.xml I have URL pattern for servlet like this: <url-pattern>/*/myservice</url-pattern> So I

  • 0

In my web.xml I have URL pattern for servlet like this:

<url-pattern>/*/myservice</url-pattern>

So I want to call it using blablabla/myservice also as anyWord/myservice.

But it doesn’t work. It work only if I call it using this URL: /*/myservice (with asterisk in URL).

  • 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-15T16:09:53+00:00Added an answer on June 15, 2026 at 4:09 pm

    You can’t do that.
    According to the Servlet 2.5 Specification (and things aren’t that different in other levels of the specification), chapter SRV.11.2:

    • A string beginning with a / character and ending with a /* suffix
      is used for path mapping.
    • A string beginning with a *. prefix is used as an extension mapping.
    • A string containing only the / character indicates the “default” servlet of the application. In this case the servlet path is the request URI minus the context path and
      the path info is null.
    • All other strings are used for exact matches only.

    Your case falls under the 4th bullet, so exact mapping is used.

    To circumvent that, use a mapping of / (third case). Map all requests to go to a particular servlet, and have that servlet re-route requests to handlers of some sort (either other servlets, or some custom classes).

    For example:

    <url-pattern>/</url-pattern>
    <servlet-name>MyServlet</servlet-name>
    

    And then, within MyServlet‘s code, inspect the URL that you received in the request (using request.getPathInfo()) and use the value to forward the request to other handlers.

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

Sidebar

Related Questions

I have these two lines in my web.xml <url-pattern>/</url-pattern> : Index Servlet and <url-pattern>/login</url-pattern>
In my web.xml I have the following mapping <servlet-mapping> <servlet-name>mySite</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>mySite</servlet-name>
I have 2 servlets, there they mapping inside web.xml : <url-pattern>/archiving/archive</url-pattern> <url-pattern>/archiving/reportgenerator</url-pattern> From servlet
I have a xml web service which I would like to track using Google
Let's say that I have something like this in my web.xml file. <filter name=foo>
In web.xml I have this <session-config> <session-timeout>2</session-timeout> </session-config> <listener> <listener-class>myapplication.SessionListener</listener-class> </listener> In the SessionListener.java
I have configured in following way that spring MVC app using Spring 3.1.1.RELEASE web.xml
I have an xml file I need to modify: ... </web-app> I want to
I have an XML (first.xml) which looks like :: <?xml version=1.0 encoding=utf-8?> <saw:jobInfo xmlns:saw=com.analytics.web/report/v1.1>
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>

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.