apache - Pipe Java output to calling script -
my goal run cgi on apache webserver. cgi written in java. i'm using batch file (later perl script) kicks off java cgi business.
the batch file works , kicks off java cgi. java program works. nothing sent browser java code. i'm doing simple system.out.println send stuff browser. i'm using this reference
my batch file
echo content-type: text/html echo. echo ^<html^>^<head^>^</head^>^<body^> echo hello world!!! java -cp my.jar myclass echo ^</body^>^</html^>
my java file
new file("c:\\wamp\\www\\cgi-bin\\" + new date().gettime()).mkdir(); system.out.println("<b>hello world java</b>");
side note - i'm doing because (not using servlet container etc) task 2 3 minutes long , don't want block servlet. @ same time, need update user on progress of task. non-public facing , dont want make complicated, using jms, ajax etc run inside container...
i wondered if,
if java -cp my.jar myclass
displays should individual command, doesn't work in batch, maybe there workaround for /f
...
@echo off rem works in wampserver's apache cgi-bin... rem http://localhost/cgi-bin/testbat.bat echo content-type: text/html echo. echo ^<html^>^<head^>^</head^>^<body^> echo ^<h1^>hello world!!!^</h1^> echo ^<pre^> /f "usebackq delims==" %%i in (`dir`) echo %%i echo ^</pre^> echo ^</body^>^</html^>
anyhow, glad solved problem anyway :) cheers
Comments
Post a Comment