lotsToLearn
Programmer
Hi, <br>
<br>
I am creating a servlet that executes some thrid party CGI scripts. I have got the servlet set up so that it executes a perl, reads the results of the program and outputs it to the client. See code snippet. <br>
<br>
BufferedOutputStream out;<br>
Runtime rt;<br>
Process p;<br>
BufferedInputStream in;<br>
String s;<br>
byte[] buff;<br>
int read;<br>
<br>
buff=new byte[4096];<br>
rt=Runtime.getRuntime(); <br>
p=rt.exec("perl D:\\InetPub\\ in=new BufferedInputStream(p.getInputStream());<br>
out=new BufferedOutputStream(res.getOutputStream());<br>
while ((read=in.read(buff, 0, 4096))!=-1) {<br>
if (read>0) { out.write(buff, 0, read); }<br>
}<br>
in.close();<br>
out.close();<br>
<br>
<br>
Where alh.cgi is. <br>
<br>
#!/usr/bin/perl<br>
<br>
print "Content-type: text/html\n\n";<br>
print "<HTML><HEAD><TITLE>Missing Much Data</TITLE><br>
<br>
<script LANGUAGE=JAVASCRIPT><br>
<br>
<!--<br>
<br>
function _CF_checkgetquestion(_CF_this)<br>
<br>
{<br>
<br>
return true;<br>
<br>
}<br>
<br>
<br>
//--><br>
<br>
</script><br>
<br>
</HEAD>";<br>
print "<BODY BGCOLOR='#FFFFFF'>";<br>
print "<TITLE>Unauthorized</TITLE><H1>You are Unauthorized</H1> BLAH BLAH BLAH";<br>
print "</BODY></HTML>";<br>
<br>
<br>
Now incredibly, thanks to OTTO (incredible given my coding experience ) this works. However to take it to the next stage I need to pass the Environment variables to the the perl script being executed. <br>
<br>
If you know how to do this, or can offer any suggestions as to how might do this please respond. <br>
<br>
Thanks<br>
<br>
Alastair Handley
<br>
I am creating a servlet that executes some thrid party CGI scripts. I have got the servlet set up so that it executes a perl, reads the results of the program and outputs it to the client. See code snippet. <br>
<br>
BufferedOutputStream out;<br>
Runtime rt;<br>
Process p;<br>
BufferedInputStream in;<br>
String s;<br>
byte[] buff;<br>
int read;<br>
<br>
buff=new byte[4096];<br>
rt=Runtime.getRuntime(); <br>
p=rt.exec("perl D:\\InetPub\\ in=new BufferedInputStream(p.getInputStream());<br>
out=new BufferedOutputStream(res.getOutputStream());<br>
while ((read=in.read(buff, 0, 4096))!=-1) {<br>
if (read>0) { out.write(buff, 0, read); }<br>
}<br>
in.close();<br>
out.close();<br>
<br>
<br>
Where alh.cgi is. <br>
<br>
#!/usr/bin/perl<br>
<br>
print "Content-type: text/html\n\n";<br>
print "<HTML><HEAD><TITLE>Missing Much Data</TITLE><br>
<br>
<script LANGUAGE=JAVASCRIPT><br>
<br>
<!--<br>
<br>
function _CF_checkgetquestion(_CF_this)<br>
<br>
{<br>
<br>
return true;<br>
<br>
}<br>
<br>
<br>
//--><br>
<br>
</script><br>
<br>
</HEAD>";<br>
print "<BODY BGCOLOR='#FFFFFF'>";<br>
print "<TITLE>Unauthorized</TITLE><H1>You are Unauthorized</H1> BLAH BLAH BLAH";<br>
print "</BODY></HTML>";<br>
<br>
<br>
Now incredibly, thanks to OTTO (incredible given my coding experience ) this works. However to take it to the next stage I need to pass the Environment variables to the the perl script being executed. <br>
<br>
If you know how to do this, or can offer any suggestions as to how might do this please respond. <br>
<br>
Thanks<br>
<br>
Alastair Handley