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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:49:28+00:00 2026-05-23T15:49:28+00:00

I have a tomcat 7 application which I can get requests from external sources.

  • 0

I have a tomcat 7 application which I can get requests from external sources.

Most of them call my request like this:

http://localhost:8080/MyWeb/exRequest

and I build servlet with URL pattern inside MyWeb app.

However, one external source must send the request like this:

http://localhost:8080/

and in the body:

<xml name="test" />

Since I don’t want to declare a general servlel (like tomcat default) since it means that any request will need to go through my servlet, I thought to change index.jsp of ROOT to redirect to my servlet.

Is it the best option?

Is there an option to create a default servlet that will be invoked only if there is a special parameter in the body?

EDITED

Please note that I get the requests to localhost:8080 and not localhost:8080/MyWeb – it’s general to tomcat and not to a specific web app

  • 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-23T15:49:29+00:00Added an answer on May 23, 2026 at 3:49 pm

    You can’t choose a servlet to invoke based on the request body, but you can set a servlet as the “welcome-file” in your web.xml.

    <servlet>
      <servlet-name>index</servlet-name>
      <servlet-class>com.y.MyWelcomeServlet</servlet-class>
    </servlet>
    
    <servlet-mapping>
      <servlet-name>index</servlet-name>
      <url-pattern>/index</url-pattern>
    </servlet-mapping>
    
    <welcome-file-list>
      <welcome-file>index</welcome-file>
    </welcome-file-list>
    

    If you want to preserve the “welcome” function of some existing index.jsp, your servlet could forward requests without the correct XML in the body to an index.jsp file located under the WEB-INF directory.

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

Sidebar

Related Questions

I have an application i can war up which i usually use with tomcat
I have a web application project which is deployed in tomcat 6. I can
We have recently migrated a large, high demand web application to Tomcat 5.5 from
I'd like to setup Tomcat on Windows and have authentication in my web application
Is there any Tomcat API or configuration available which can tell an application (probably
I have a WEB Application deployed in Tomcat. I would like to intercept all
I have an application which is running on tomcat, one of the methods is,
I have an ubuntu machine, on which a) a web application (Tomcat, on URL
I have a web application that uses a library which resides in TOMCAT_HOME/common/lib. This
I have to to deploy a Ruby on Rails application to an tomcat application

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.