Running cgi-bin on Tomcat: Simple steps & gotchas cgi - 빈에 tomcat을 실행 : 간단한 단계 & & gotchas
cgi-bin programs (common executables) can be run from Tomcat. cgi - 빈 프로그램 (일반적인 실행 파일을) tomcat에서 실행할 수있습니다. It is however not enabled by default. 그러나 기본적으로 활성화되지 않았습니다.
To enable it carefully follow the steps below: 이를 활성화 신중하게 다음 단계를 따르십시오 :
1. Uncomment (or add) the following sections to $CATALINA_HOME/conf/web.xml (%CATALINA_HOME%\conf\web.xml on windows), between the 주석 (또는 추가) 다음 섹션을 $ catalina_home / 구성 / web.xml (% catalina_home % \ 구성 \ web.xml에 windows), 사이의
2. 두합니다. Rename the $CATALINA_HOME/server/lib/servlets-cgi.renametojar (%CATALINA_HOME%\server\lib\servlets-cgi.renametojar on windows) file to $CATALINA_HOME/server/lib/servlets-cgi.jar (%CATALINA_HOME%\server\lib\servlets-cgi.jar on windows) catalina_home의 이름을 바꿉니다 달러 / 서버 / lib / 서블릿 - cgi.renametojar (% catalina_home % \ 서버 \ lib \ 서블릿 - cgi.renametojar에 windows) 파일을 $ catalina_home / 서버 / lib / 서블릿 - cgi.jar (% catalina_home % \ 서버 \ lib \ 서블릿 - cgi.jar에 windows)
3. 3합니다. Restart Tomcat tomcat를 다시 시작
Testing with Hello.bat 테스트 hello.bat
A simple way to test would be to create a cgi directory under WEB-INF directory of your Web application. 을 테스트하는 간단한 방법을 만들려는 웹 - inf 디렉토리의 cgi 디렉토리 웹 응용 프로그램을합니다.
Lets add a simple file called hello.bat (for windows users). 라는 파일을 사용 장바구니 간단한 hello.bat (창 사용자의 경우).
The file contains just the line: 이 파일에는 단지 행 :
echo Hello World! 에코 여러분, 안녕하세요!
This displays the String “Hello World!” 이것을 표시합니다 문자열 "여러분, 안녕하세요!"
Create a file called env.bat env.bat라는 파일을 만드십시오
The file contains just the line: 이 파일에는 단지 행 :
set 세트
This displays all the available environment variables for the cgi-bin program. 모두 표시를 사용할 수있는 환경 변수에이 cgi - 빈 프로그램을합니다.
Gotchas on windows windows & gotchas에서
—————— ------
Normally we use @echo off in a batch file to turn off displaying the command. 일반적으로 배치 파일을 사용 @ 에코 거리에 명령을 표시하는 기능을 해제합니다. However when we do the following, no output is displayed: 그러나 그렇게되면 다음과 같은, 아니 출력은 조회수 :
@echo off @ 에코 따로
echo Hello World! 에코 여러분, 안녕하세요!
It just needs a newline to be happy. 단지의 행복을 줄 바꿈이 필요합니다. So create a file (say empty.txt) which just contains a newline. 그래서 파일을 만드십시오 (예 : empty.txt)을 포함하는 단지 개행합니다. Then change hello.bat to the following: 을 변경하려면 다음 hello.bat :
@echo off @ 에코 따로
type empty.txt 유형 empty.txt
echo Hello World! 에코 여러분, 안녕하세요!
echo on 에코에
This works as intended. 이 의도했던대로 작동합니다.
Note: Would you like to show a 참고 사항 : 하시겠습니까 보여주는 token of appreciation 감사의 표시요 for my hard work? 에 대한 내 하드 작동합니까? I enjoy a cup of 나는 한 잔 즐긴다 Cafe Estima Blend 카페 혼합 estima from Starbucks. 스타벅스에서합니다.
Filed under 밑에 Headline News 헤드 라인 뉴스 , How To 하는 방법을 , Java Software 자바 소프트웨어 | |
| |
RSS 2.0 rss 2.0 | |
Email this Article 전자 우편이 문서
You may also like to read 같은를 읽을 수있습니다 |





April 23rd, 2004 at 1:07 pm 2004년 4월 23일에서 오후 1시 7분
Don’t forget to uncomment the servlet-mapping for cgi 서블릿 - 매핑을 잊지 마세요에 대한 주석 표시를 제거합니다 cgi
December 11th, 2004 at 2:11 pm 2004년 12월 11일에서 오후 2시 11분
I did at the bottom. 나는 맨 아래에 한합니다.
March 25th, 2005 at 1:58 pm 2005년 3월 25일에서 오후 1시 58분
I had to specify an executable init param equal to the full path of perl in order to get this to work. 나는 param init를 지정하는 실행 파일의 전체 경로를 평등을 얻기 위하여 펄이 일을합니다.
executable 실행 파일
full path of perl 펄의 전체 경로
I am not sure why I had to do this since perl should already be in the path. 나는 왜 이렇게하지 모르겠 펄 이후의 경로가 이미있습니다. I’m running TomCat 5 on Windows XP Professional. windows XP 용 tomcat 5를 실행하는 나는 직업합니다.
April 4th, 2005 at 3:14 pm 2005년 4월 4일에서 오후 3시 14분
@Giles Specifying full-path looks logical to me. @ 자일스 - 경로를 지정하는 모든 논리적인 말 것. Java doesn’t invoke executables by looking at the path variable. 자바 실행 파일을 호출하지 않습니다 변수에 대한 경로를보고합니다.
May 6th, 2005 at 1:43 am 2005년 5월 6일에서 오전 1시 43분
Add 추가
executable 실행 파일
or (windows xp) 또는 (windows XP 용)
executable 실행 파일
cmd /c cmd / c
May 6th, 2005 at 1:47 am 2005년 5월 6일에서 오전 1시 47분
add 추가
param-name=executable param - 이름 = 실행
value= 값 =
or (windows xp) 또는 (windows XP 용)
param-name=executable param - 이름 = 실행
value=cmd /c 값 = cmd / c
May 6th, 2005 at 1:49 am 2005년 5월 6일에서 오전 1시 49분
Directly add executables including batch files. 실행 파일을 직접 추가 배치 파일을 포함합니다.
However if your want to execute cmd commands like dir then you will have to use cmd /c dir. 그러나 원하는 경우 같은 명령을 실행 dir cmd를 사용하면 cmd / c dir.
October 4th, 2005 at 5:04 am 2005년 10월 4일에서 오전 5시 4분
December 2nd, 2005 at 4:55 am 2005년 12월 2일에서 오전 4시 55분
hi all.can anybody help me to send and receive mail from my localhost.im using tomcat5 as my localserver.plz help me out..thanks to all 안녕하세요 아무도 도와 all.can 내 localhost.im에서 메일을 보내거나받을 tomcat5 제를 사용하여 모든 localserver.plz 도와 .. 감사합니다
December 2nd, 2005 at 7:24 am 2005년 12월 2일에서 오전 7시 24분
Hi Rock, 안녕하세요 암,
Please refer to this article - 이 문서를 참조하시기 바랍니다 -
How to Send / Receive Emails (SMTP & POP) From Localhost; Simple Freeware MailServer 를 보내는 방법 / 수신 이메일 (smtp & 팝)에서 로컬 호스트; 간단한 프리웨어 메일 서버
It has been written to address your question. 그것은 귀하의 질문에 주소를 기록합니다.
Best, 최선의,
Angsuman angsuman
December 15th, 2005 at 10:14 am 2005년 12월 15일에서 오전 10시 14분
Please, what is the URL that I shoul enter in order to get the cgi executed? 제발, 무엇입니까를 입력하십시오을 위해 내가 가져와 cgi 실행해야합니다?
Does the url below shouldn’t work? 아래는해서는 안합니다 작동합니까? it isn’t. 그것은합니다.
http:localhost:8080//cgi-bin/foo.sh
thanks 감사합니다
Breno Leitão breno leitão
December 15th, 2005 at 11:44 am 2005년 12월 15일에서 오전 11시 44분
Try: 시도 :
http://localhost:8080/Your http://localhost:8080/your web application directory]/cgi-bin/foo.sh 웹 응용 프로그램 디렉터리] / cgi-bin/foo.sh
Please closely follow the instructions above. 위의 지침에 따라 밀접하게하시기 바랍니다.
April 20th, 2006 at 12:42 pm 2006년 4월 20일에서 오후 12시 42분
I have been trying to put perl scripts in webapps/ROOT/WEB-INF/cgi-bin: 나는 펄 스크립트를 쥐어 주려고 webapps / 루트 / 웹 - inf / cgi - 빈 :
A) printEnv.cgi 원정) printenv.cgi
#!/usr/bin/perl #! / usr / 빈 / 펄
print “Content-type: text/html\n\n”; 인쇄 "컨텐츠 - 유형 : 텍스트 / html \ n \ n";
print “\n”; 인쇄 "\ n";
foreach $key (sort keys(%ENV)) { foreach $ 키 (정렬 키 (% env)) (
print “$key = $ENV{$key}”; 인쇄 "$ 열쇠 = $ env ($ 키)";
} )
B) Changes to web.xml 나) 변경 사항을 web.xml
cgi
org.apache.catalina.servlets.CGIServlet org.apache.catalina.servlets.cgiservlet
executable 실행 파일
/usr/bin/perl / usr / 빈 / 펄
clientInputTimeout clientinputtimeout
100
debug 디버그
6 육
cgiPathPrefix cgipathprefix
WEB-INF/cgi-bin web-inf/cgi-bin
5 오
cgi
/cgi-bin/* / cgi - 빈 / *
D) Renamed to servlets-cgi.jar 패) 이름을 서블릿 - cgi.jar
E) Restarted server 이메일) 다시 서버
But when I do: 하지만 그렇게되면 난 :
http://mydomain/cgi-bin/printEnv.cgi http://mydomain/cgi-bin/printenv.cgi
it does not go to the URL 로 이동합니다하지 않습니다
April 28th, 2006 at 12:24 pm 2006년 4월 28일에서 오후 12시 24분
The steps have worked perfectly for many including myself. 많은 단계를 포함하여 완벽하게 나 자신이 제대로 작동합니다.
Unfortunately I don’t have time at this moment to support your specific issue. 불행히도 지금이 순간 나는 시간이 없어 귀하의 특정 문제를 지원합니다.
April 25th, 2007 at 1:47 pm 2007년 4월 25일에서 오후 1시 47분
Hi, 안녕,
I followed the steps but I cannot start bat file as cgi script on WinXP. 당신을 따라 단계를 수행하지만 전에서 스크립트 파일을 시작할 수없습니다 박쥐 winxp합니다. The error is: “java.io.IOException: Cannot run program “perl” (in directory “C:\Program Files\Tomcat 5.5\webapps\test\WEB-INF\cgi”) 이 오류는 : "를 던졌다 java.io.IOException : 프로그램을 실행할 수없습니다"펄 "(이 디렉토리"c : \ 프로그램 파일 \ tomcat 5.5 \ webapps \ 테스트 \ 웹 - inf \ 비디오 ")
I tried to add 보았습니다에 추가
param-name=executable param - 이름 = 실행
value=cmd /c 값 = cmd / c
or param-name=executable 또는 param - 이름 = 실행
value=cmd 값 = cmd
but without success. 하지만 성공을합니다. Any ideas? 어떤 아이디어?
October 19th, 2007 at 3:37 am 2007년 10월 19일에서 오전 3시 37분
test.cgi is : test.cgi는 :
#!\perl\bin\perl.exe#! \ 펄 \ 빈 \ perl.exeprint “Content-type: text/html\n\n”; 인쇄 "컨텐츠 - 유형 : 텍스트 / html \ n \ n";
print “IN TEST!\n”; 인쇄 "를 테스트하기위한! \ n";
print “\n”; 인쇄 "\ n";
print “IN TEST!\n”; 인쇄 "를 테스트하기위한! \ n";
print “\n”; 인쇄 "\ n";
Store Location of test.cgi is : webapps/test/ 저장할 위치를 test.cgi는 : webapps / 시험 /
Output in 출력을 http://localhost:8080/test/test.cgi http://localhost:8080/test/test.cgi
#!\perl\bin\perl.exe print “Content-type: text/html\n\n”; print “\n”; print “\n”; print “#! \ 펄 \ 빈 \ perl.exe 인쇄 "컨텐츠 - 유형 : 텍스트 / html \ n \ n"; 인쇄 "\ n"; 인쇄 "\ n"; 인쇄 "IN TEST!테스트!\n”; print “\n”;\ n "; 인쇄"\ n ";October 19th, 2007 at 3:48 am 2007년 10월 19일에서 오전 3시 48분
Please help me to fix the working of CGI which I mentioned above. cgi를 수정하는 작업을 도와주세요 전 위에서 언급한합니다. I am not able to execute ang CGI through TOMCAT. cgi를 통해 나는한다 tomcat을 실행할 수없습니다.