On Oct 18, 2011, at 6:50 AM, Konstantin Kolinko wrote:
2011/10/17 Nathan Potter <npot...@opendap.org>:
Greetings,
I am new to this list and I apologize in advance if this has been
covered
(although searching the archives did not lead me to a related
thread):
In my web application I need to utilize the JSP servlet, but I need
to use a
different servlet mapping:
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/jsp/*</url-pattern>
</servlet-mapping>
This mapping works great, but I have noticed an odd thing:
- If I request a URL that references an existing JSP it works.
http://localhost:8080/test/jsp/index.jsp
- If I request a URL that references a file that does not exist I
get a 404
error, as expected.
http://localhost:8080/test/jsp/doesnotexist
- If I request a URL (with a trailing "/" character) that
references an
existing directory within the the JSP servlet's purview. I get a
404 error
(which seems reasonable).
http://localhost:8080/test/jsp/foo
- BUT, If I request a URL (without a trailing slash) that
references an
existing directory within the the JSP servlet's purview, I get an
HTTP
status 500 (Internal Server Error).
http://localhost:8080/test/jsp/foo
I think this is incorrect behavior.
When I do the same experiment with the default servlet I get an empty
directory, but no error.
I looked at the Tomcat code referenced by the stack trace:
org.apache.jasper.JasperException: File "/jsp/foo" not found
org
.apache
.jasper
.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
org
.apache
.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org
.apache
.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
org.apache.jasper.compiler.JspUtil.getInputStream(JspUtil.java:851)
org
.apache
.jasper
.xmlparser.XMLEncodingDetector.getEncoding(XMLEncodingDetector.java:
108)
org
.apache
.jasper
.compiler
.ParserController.determineSyntaxAndEncoding(ParserController.java:
348)
org
.apache
.jasper.compiler.ParserController.doParse(ParserController.java:207)
org
.apache
.jasper
.compiler.ParserController.parseDirectives(ParserController.java:120)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:180)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
org
.apache
.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org
.apache
.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:
260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
And I can see that in JspServlet in lines 312 - 316:
try {
wrapper.service(request, response, precompile);
} catch (FileNotFoundException fnfe) {
handleMissingResource(request, response, jspUri);
}
The call is being serviced. Unfortunately when this problem occurs a
"JasperException" is throw, not a FileNotFoundException and the
handleMissingResource() path way is skipped....
Any thoughts? It strikes me that this situation is one that can
easily be
incurred by a type in the URL and so I don't that that an HTTP
staus of 500
should be returned in this situation.
What exactly x.y.z Tomcat version is that?
6.0.33
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
= = =
Nathan Potter ndp at opendap.org
OPeNDAP, Inc. +1.541.231.3317
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org