cgi-bin programs (common executables) can be run from Tomcat. - برامج CGI بن (برامج مشتركة) يمكن ان تدار من قط. 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 على ويندوز) ، وبين and و tags. العلامات.


cgi 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

/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 / الخادم / ليب / Servlets - cgi.renametojar (catalina_home ٪ ٪ \ الخادم \ مكتبه \ Servlets - cgi.renametojar على ويندوز) الى ملف دولار catalina_home / الخادم / ليب / Servlets - cgi.jar (catalina_home ٪ ٪ \ خادم \ مكتبه \ Servlets - cgi.jar على ويندوز)

3. Restart 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. طريقة بسيطة لاختبار وسيكون لانشاء 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 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. من ستاربكس.