You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Marten Lehmann <le...@cnm.de> on 2005/07/27 16:01:54 UTC
ho to check if forward-target exists?
Hello,
I can start a forward like this e.g. through a filter:
request.getRequestDispatcher("/test.html").forward(request, response);
But how can I check if the ressource really exists?
request.getRequestDispatcher("/test.html") always gives me a
RequestDispatcher reference. Or is it possible to get the response-code
somehow to check if the forward resulted in a file-not-found error?
Regards
Marten
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: ho to check if forward-target exists?
Posted by Tim Funk <fu...@joedog.org>.
If you are looking for a physical resource use
if (null==servletContext.getResource()) {
... yes it exists ...
}
-Tim
Marten Lehmann wrote:
> Hello,
>
> I can start a forward like this e.g. through a filter:
>
> request.getRequestDispatcher("/test.html").forward(request, response);
>
> But how can I check if the ressource really exists?
>
> request.getRequestDispatcher("/test.html") always gives me a
> RequestDispatcher reference. Or is it possible to get the response-code
> somehow to check if the forward resulted in a file-not-found error?
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org