-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------
Previously, I had an application running the code that is listed below. The
application streamed a String to a perl filter and then read it back on the
runtime input stream. This evening when I run this code from a servlet, I
don't appear to be getting any output from Perl. Hence my original question.
If there is a problem with the code below, will the use of
javax.servlet.ServletOutputStream and javax.servlet.ServletInputStream be of
better use than OutputStramWriter/InputStreamWriter?
Thanks
Nigel
public String filterContent (String filterName) {
String perlFilter = ".." + fs + "util" + fs + filterName,
command = "perl " + getPath(perlFilter);
try {
int ch = 0;
Process filter = r.exec(command);
BufferedWriter toFilter = new BufferedWriter (new OutputStreamWriter
(filter.getOutputStream()));
toFilter.write(content, 0, content.length());
toFilter.close();
reset();
// Now read the output from Perl
BufferedReader fromFilter = new BufferedReader (new InputStreamReader
(filter.getInputStream()));
while ((ch = fromFilter.read()) != -1)
content += (char) ch;
fromFilter.close();
filter.destroy();
}
catch (IOException e) {
System.out.println(e.getMessage());
}
return content;
}
Nimret Sandhu wrote:
> > Should there be any problem with servlets using java.lang.Runtime on my
> > JServ installation? Or is the Runtime API java-application only?
>
> no .. there are no problems accessing the java.lang.Runtime class via
> servlets.
>
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]