You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by C F <gi...@hotmail.com> on 2002/07/01 07:50:42 UTC

RequestDispatcher.forward to CGI

Hello,

I've been trying to use the following procedure to forward a request from my 
servlet to a CGI program within the same application space....
getServletContext().getRequestDispatcher("/cgi-bin/my_cgi_prog").forward(request,response);

... which results in the following error....
"Servlet invoker is currently unavailable"

Looking at Sun's servlet tutorial, they indicate that this would be 
possible.
http://java.sun.com/docs/books/tutorial/servlets/communication/request-dispatcher.html

However, I did notice that Tomcat's documentation makes no mention of being 
able to forward requests in this manner to CGI... only other JSPs and 
servlets.  All I want is to pass the HTTP request to my CGI program via a 
servlet, the CGI program will respond with HTML and pass it back to the 
client browser via the servlet.  So I have a few questions...

1)  Has anybody been successful doing this? How?

2)  If it's not possible in the current Tomcat, is it something that might 
be available soon (I noticed that this release is Tomcat's first shot at CGI 
availability)?

2)  If it is not possible to do this in Tomcat, can anybody think of another 
solution?  Response.sendRedirect is NOT an option.  The reason I'm 
attempting this is because I want to control access and input to my CGI 
program through a servlet.  I don't want the browser calling it directly.  
I'm thinking maybe the URLConnection class might be of use, but then I still 
have the issue of controlling access to it and maybe another performance 
hit.  Or maybe I'm wrong.  Ideas?

Environment:
Tomcat 4.0.4 (standalone)
JDK 1.4
Redhat Linux 7.3

Thanks!

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>