Jan Luehe wrote:

Remy/Bill,

Remy Maucherat wrote:


[EMAIL PROTECTED] wrote:




luehe       2004/10/14 17:00:35

Modified:    catalina/src/share/org/apache/catalina/core
                     ApplicationHttpResponse.java
Log:
Expose any errors on an included resource.

For example, a JSP with this include action:
 <jsp:include page="nonexistent">
or
 <jsp:include page="nonexistent.jsp">
where nonexistent[.jsp] does not exist, currently returns silently, hiding the
fact that the resource to be included does not exist.

This patch returns a 404 with the name of the nonexistent resource.

Yes, SRV.8.3 ("The Include Method") mentions that

 "it [the target servlet] cannot set headers or call any method that
 affects the headers of the response. Any attempt to do so must be
 ignored."

but i don't think it is referring to the error case.

Let me know if you see any problems.



Same as Bill. It would be logical that it refers to the whole HTTP header(all of its elements already are), since the idea is that it might already have been sent.



I agree the above section needs to be clarified.



It's true that we have no good way of reporting problems when including. This has always been a problem from a user perspective.



OK, do you think it would be a better idea to return a null RequestDispatcher in this case?

In ApplicationContext.getRequestDispatcher(path), we could check if the
wrapper that the given path is being mapped to corresponds to the
JspServlet or DefaultServlet, and only in that case, call getResource()
to make sure the requested resource actually exists. If it doesn't,
return null.


That's IMO well beyond the spec.

I really don't like the idea of not reporting anything to the user.


OTOH, I don't see anything which prevents the default servlet from reporting such an error as plain text "This resource foo is not found" when invoked from an include, which would likely be good enough for users.

Rémy


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to