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), 사이의 and tags. 태그를합니다.


cgi

org.apache.catalina.servlets.CGIServlet org.apache.catalina.servlets.cgiservlet

clientInputTimeout clientinputtimeout 100

debug 디버그 6

cgiPathPrefix cgipathprefix WEB-INF/cgi web-inf/cgi
5


cgi

/cgi-bin/* / cgi - 빈 / *

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. 스타벅스에서합니다.