accessing environment variables on a JSP

D

D. Alvarado

Hi,
It occurred to me different app servers might deal with this
differently, but here goes:

I'm running WebLogic 5.1 sp12 with an Apache 1.3.27 web server.
Apache sets an environment variable ('REDIRECT_URL') upon occurence of
a 40x error. How do I access such an environment variable from my jsp
page? Thanks - Dave
 
D

Dilantha Seneviratne

Process p;
InputStream myIs;
BufferedReader br;
String REDIRECT_URL = "";

try {
p = Runtime.getRuntime().exec("cmd.exe /c echo
%REDIRECT_URL%");
myIs = p.getInputStream();
br = new BufferedReader (new InputStreamReader(myIs));
REDIRECT_URL = br.readLine();
br.close();
myIs.close();
}
catch (java.io.IOException e) {
System.err.println("IOException thrown" +
e.getMessage());
}
 
J

John C. Bollinger

D. Alvarado said:
Hi,
It occurred to me different app servers might deal with this
differently, but here goes:

I'm running WebLogic 5.1 sp12 with an Apache 1.3.27 web server.
Apache sets an environment variable ('REDIRECT_URL') upon occurence of
a 40x error. How do I access such an environment variable from my jsp
page? Thanks - Dave

I would strongly recommend that you find another way to do whatever it
is you want to do. Not only will consulting the environment be highly
specific to your configuration, you may find that it doesn't even work.
That is, if a request is handed of to the application server, you may
find that Apache does not exhibit the environment mangling behavior you
describe. You also certainly have to worry about _which_ environment is
modified and when. You are asking for more trouble than it is worth.


John Bollinger
(e-mail address removed)
 
Joined
Sep 16, 2008
Messages
2
Reaction score
0
cmd.exe from jsp

This is a little off topic, but I thot this thread may be the answer. I need to be able to call a very simple VB.exe from a jsp. I am very, very new to this, so please bear with me. I have tried the following, but nothign happened, please help??


Process p;
InputStream myIs;
BufferedReader br;
String REDIRECT_URL = "";

try {
p = Runtime.getRuntime().exec("cmd.exe /c c:\\test.exe");
myIs = p.getInputStream();
br = new BufferedReader (new InputStreamReader(myIs));
REDIRECT_URL = br.readLine();
br.close();
myIs.close();
}
catch (java.io.IOException e) {
System.err.println("IOException thrown" +
e.getMessage());
}

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top