Hi,
(I work on Tomcat 5.0.30).

When my servlet (http://myVhost/proxy/testProxy) forward to another servlet :
try {
  ServletContext ctx = getServletContext();
  ctx = ctx.getContext("/myNewContext");
  RequestDispatcher dispatcher = ctx.getRequestDispatcher("/myNewServlet");
  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 
:-(


1) In other servlets containers, I read that ctx.getRequestDispatcher(...) 
returns null if the resource is absent.
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 absent, I'd want to call another url distant (with httpclient)...
How can I do this with Tomcat ?

Thanks in advance.

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

Reply via email to