Changing Servlet's default response
I have a Java web application that has several servlets with the following mappings.
ServletOne → / one
ServletTwo → / two
ServletThree → / three
When I make a request for an action that doesn't exist, I get 403 (Forbidden) i.e.: / foo. I would like to change this to give 404 (Not Found). How can i do this?
If 404 is the default behavior, then where can I find this setting that throws things off? I tried searching the site, but I couldn't find the search term that gave something related.
TIA!
source to share
What servlet container are you using?
Tomcat, by default, maps / * to the DefaultServlet (as per $ TOMCAT_HOME / conf / web.xml) for the server I just confirmed will default to 404 if the mapping doesn't exist.
I would suggest starting by looking at your servlet container web.xml file to see if a similar default mapping exists.
source to share