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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:45:23+00:00 2026-05-27T01:45:23+00:00

Is it possible to map URLs to servlets (maybe something specific with Tomcat) so

  • 0

Is it possible to map URLs to servlets (maybe something specific with Tomcat) so that the two following URLs (with {id}’s being variables retrievable from code),

/users/{id}/a

/users/{id}/b

map to two different servlets, or will I have to implement some sort of filter of my own for a servlet mapped to /users/*?

To be more clear, any URL with the pattern /users/*/a should map to the same servlet. The same goes for /users/*/b.

  • 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-05-27T01:45:24+00:00Added an answer on May 27, 2026 at 1:45 am

    You could map it on /users/* and extract information from HttpServletRequest#getPathInfo():

    @WebServlet("/users/*")
    public class UsersController extends HttpServlet {
    
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            String[] pathInfo = request.getPathInfo().split("/");
            String id = pathInfo[1]; // {id}
            String command = pathInfo[2]; // a or b
            // ...
        }
    
    }
    

    (obvious validation on array size omitted)

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

Sidebar

Related Questions

Is it possible to add an image overlay to a google map that scales
Is it possible to map http://localhost:8080/controller/action to something like http://myApp/controller/action with Grails mappings?
Is it possible to map all file extensions in a folder to a specific
I am looking to take a map<char, vector<char> > and generate each possible map<char,
Is it possible to map an enum as a string using Fluent Nhibernate?
Is it possible to map a route with MapRoute and specify a generic controller
Is it possible to map an array to a new array and to sort
I'm wondering, is it possible to somehow map a key-press event to act like
Possible Duplicate: What does map(&:name) mean in Ruby? I was watching a railscast and
Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic According

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.