Hi,
I'm trying to write a general servlet-wrapper for existing C++ based
CGI-programs. Is there something special to consider when calling a C++
based CGI-Program from a Java Servlet using the URLConnection-class?
I mean something like this:
URL myURL;
URLConnection connection;
PrintWriter printout;
String CGIURLString = "http://myhost:myport/mydir/mycgi";
myURL = new URL( CGIURLString );
connection = myURL.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
printout = new PrintWriter( connection.getOutputStream () , true );
content = "VAR1="+URLEncoder.encode( var1 );
...
printout.print(content);
printout.flush();
printout.close ();
connection.connect();
BufferedReader input = new BufferedReader ( new
InputStreamReader(connection.getInputStream ()));
....
input.close ();
The called CGI Programm works and supports POST and GET and resides on the
same host as the servlet. However, it seems that the servlet doesn't give
the parameter var1 to the CGI.
Any hints for such a topic? Did I forget something?
Markus.
--
B + S BANKSYSTEME GmbH, C/S Development
Eugen-Mueller-Str. 1, A 5020 Salzburg, Austria
Tel.: +43 (662) 43 05 91 - 318
http://www.bsbanksysteme.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html