getServletPath() should return the path of the requested resource. So if I call include("/foo.html") - getServletPath() at that point during invocation should be /foo.html.

servletContext.getResource(stuff) returns a URL if the resource exists. For servlets which map to some extension like *.do - servletContext.getResource(stuff) would return null since the controller would decode the URL into some action.


-Tim


Antonio wrote:
2008/10/22 Tim Funk <[EMAIL PROTECTED]>:
 if (null==servletContext.getResource(request.getServletPath())) {

Are you sure that it works? the "getServletPath" returns the path or
the name of the servlet.
Notice that anything could be included, from a JSP page to a called
servlet with parameters.
Anyway I think that the filter suggestion is good (thanks :-) ),
probably a HTTP request wrapper that checks if at least 1 byte is
written to the response could be useful.

Then map the filter as needed (with any additional checks too)

Something like:
<filter-mapping>
        <filter-name>my_filter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>INCLUDE</dispatcher>
</filter-mapping>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to