DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=33831>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=33831 Summary: RequestDispatcher.forward and resource missing Product: Tomcat 5 Version: 5.0.30 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P3 Component: Servlet & JSP API AssignedTo: tomcat-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] Hi, I think there is a problem with the RequestDispatcher when the resource to forward is missing because we have no way to know it (before receiving a 404 HTTP status) in order to try another thing... In my tests, I do this : When my servlet (http://myVhost/proxy/testProxy) forward to another servlet (in the same Context or not): try { ServletContext ctx = getServletContext(); ctx = ctx.getContext("/myNewContext"); RequestDispatcher dispatcher = ctx.getRequestDispatcher("/myNewServletAlias"); dispatcher.forward(request, response); } catch (Exception e) {e.printStackTrace();} (in server.xml, in the Context /proxy of myVhost, I put crossContext="true") If the Context /myNewContext is deployed in myVhost, the HTTPresponse is : HTTP/1.1 200 OK ... response of myNewServlet If the Context /myNewContext is not deployed, the HTTPresponse is : HTTP/1.1 404 /myNewServlet :-( My problem is here because, in this case, I couldn't know (before the response) this servlet was missing !! I also tested : getContext("/myNewContext/myNewServletAlias") getContext("/proxy") getContext("/proxy/myNewServletAlias") and ctx is always != null !!! (and dispatcher also always != null) 1) In other servlets containers, I read that ctx.getRequestDispatcher(...) returns null if the resource is missing. So, Why Tomcat reacts differently ? Is it a bug ? 2) In my case, I'd want to forward to myNewServlet if it is present, BUT, if it is missing, I'd want to call another url distant (with httpclient)... How can I do this with Tomcat ? Is there an issue ? -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]