I've been reading the Ranch for a long time, but this is my first time actually submitting a question. I appreciate any advice I can get! I'm having some trouble understanding the way servlet mapping and URL patterns work.
Here's the problem: I'm trying to get my server to take an HTTP request with or without parameters (ex: http://my.server:31337/CONTEXT_PATH/index.jsp?param1=X ) and run a servlet which sends back either a text file with data based on the parameters (if everything works right) or the error page "/error.jsp" (if an exception is thrown while attempting to make the file).
What I get is that no matter what I throw at the server, I'm getting the same index.jsp file back, UNLESS I set the URL map from "/" to "/*" (which is bad, because now responding with error.jsp causes the server to go back to the servlet, thus perpetuating an infinite loop).
So, the intention is that regardless of what URL string I get from the client (no parameters, bad parameters, or good parameters), my server sends it to the servlet and lets it either send a file or an error page back to the client.
My understanding is that having <url-pattern>/</url-pattern> in the servlet mapping means anything that goes to my servlet's context path and isn't otherwise defined automatically goes through that Srv.
Instead, what I get with the above mapping is that Srv seems to get ignored altogether, and the client only sees the index.jsp page. Am I overlooking something here?
If it's request parameters you are concerned with, they have nothing at all to do with the mapping. A URL that addresses a servlet mapping will invoked the serve lets regardless of the presence of parameters or not.