tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From M Butcher <>
Subject Re: OT: java programming Q
Date Wed, 10 May 2000 14:33:10 GMT
So the servlet executes a C program? And the C program doesn't behaive as
expected? That is probably because none of the CGI environment variables are set
for the program. You are executing it outside of the normal CGI context, so any
particular information that _was_ being sent to the CGI (in the form of env. vars
or arguments) is now being sent to the servlet engine. If you really want to make
this method work, you need to have the java set all of the correct environment
variables for the C program.

Christoph Kukulies wrote:

> The more I'm playing with servlets the more I like it and the more
> I'm moving the CGI program parts to servlets.
> But for efficiency reasons there's a lot I'd still prefer to be done with CGI
> programs (C programs).
> One thing I found when I tried to concentrate several buttons in
> an ACTION=/servlets/Some which should dispatch dependent on the button
> pressed.
> As long as I stay in Java, everything is fine.
> Now I want to exec my CGI-C program and the whole CGI context gets lost,
> even the outputstream.
> I'm using java.lang.Runtime exec() for this.
> Is there a way to let the exec'ed process inherit the environment?
> Don't know how this could be achieved but writing everything
> in Java would be too much for the moment.
> E.g:
> public void doGet (HttpServletRequest request,
>                    HttpServletResponse response)
>         throws ServletException, IOException
>         {
>          String type =  request.getParameter("type");
>          if(type.compareTo("Reportausgabe")==0){
>                   out.println("Reportausgabe");
>                   try {
>                    out.println("executing...");
>                    action="/usr/local/www/cgi-bin/";
>                    runner.exec(action);
>                   } catch(Exception e) {
>                       out.println("EXEC error");
>                       out.flush();
>                       e.printStackTrace();
>                     }
>                   return;
>             }
> You can also email me directly if this pollutes the list.
> --
> Chris Christoph P. U. Kukulies
> --------------------------------------------------------------------------
> To unsubscribe, email:
> For additional commmands, email:

M Butcher

View raw message