Servlet tag problem
Hi everyone,
I have a servlet which is supposed to execute a shell command and display the output. The shell command is as follows and this is the output at the command line:
localhost:~ # serctl ul show 2045
<sip:2045:xxx.xxx.xxx.xxx<;q=1;expires=45678
My servlet code (which I have included below) only prints ";q=1;expires=45678" to the screen. It leaves out the line in the "< >". I suspect this is a problem with the tags. Can anyone tell me how to rectify this?
My servlet code is as follows:
String[] command = { "serctl", "ul", "show", "2045" }; // Only change!
Runtime runtime = Runtime.getRuntime();
Process process = null;
try {
process = runtime.exec(command);
BufferedReader in =
new BufferedReader(new InputStreamReader(process.getInputStream()));
// Read and print the output
String line = null;
while ((line = in.readLine()) != null) {
out.println(line);
}
}
catch (Exception e) {
out.println("Problem with finger: " +
ServletUtils.getStackTraceAsString(e));
}
Many thanks in advance for help.
Aisling.
|