cgi-bin programs (common executables) can be run from Tomcat. cgi-bin programmes (exécutables commun) peut être utilisé par Tomcat. It is however not enabled by default. Il n'est cependant pas activé par défaut.
To enable it carefully follow the steps below: Pour lui permettre de suivre attentivement les étapes ci-dessous:
1. Uncomment (or add) the following sections to $CATALINA_HOME/conf/web.xml (%CATALINA_HOME%\conf\web.xml on windows), between the Décommenter (ou ajouter) les sections suivantes à $ CATALINA_HOME / conf / web.xml (% CATALINA_HOME% \ conf \ web.xml sur les fenêtres), entre le and et tags. balises.


cgi CGI

org.apache.catalina.servlets.CGIServlet

clientInputTimeout 100

debug 6

cgiPathPrefix WEB-INF/cgi
5


cgi CGI

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

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) Renommer l'$ CATALINA_HOME / server / lib / servlet-cgi.renametojar (% CATALINA_HOME% \ server \ lib \ servlets-cgi.renametojar sur les fenêtres) file à $ CATALINA_HOME / server / lib / servlet-cgi.jar (% CATALINA_HOME% \ serveur \ lib \ servlets-cgi.jar sur les fenêtres)

3. Restart Tomcat Redémarrez Tomcat

Testing with Hello.bat Essais avec Hello.bat
A simple way to test would be to create a cgi directory under WEB-INF directory of your Web application. Un moyen simple de tester serait de créer un répertoire cgi sous WEB-INF de votre application Web.

Lets add a simple file called hello.bat (for windows users). Permet d'ajouter un simple fichier appelé hello.bat (Pour les utilisateurs de Windows).
The file contains just the line: Le fichier contient la ligne:
echo Hello World! echo Bonjour tout le monde!

This displays the String “Hello World!” Cela affiche la chaîne "Bonjour le monde!"

Create a file called env.bat Créer un fichier nommé env.bat
The file contains just the line: Le fichier contient la ligne:
set définir

This displays all the available environment variables for the cgi-bin program. Cela affiche toutes les variables d'environnement pour le cgi-bin.

Gotchas on windows Pièges sur les fenêtres
—————— ------
Normally we use @echo off in a batch file to turn off displaying the command. Normalement, nous utilisons @ echo off dans un fichier batch pour désactiver l'affichage de commande. However when we do the following, no output is displayed: Toutefois, lorsque nous faire les choses suivantes, pas de sortie est affichée:

@echo off @ echo off
echo Hello World! echo Bonjour tout le monde!

It just needs a newline to be happy. Il a juste besoin d'un retour à la ligne pour être heureux. So create a file (say empty.txt) which just contains a newline. Ainsi, créer un fichier (par exemple empty.txt) qui ne contient qu'un retour à la ligne. Then change hello.bat to the following: Ensuite, changez de hello.bat sur les points suivants:
@echo off @ echo off
type empty.txt Type de empty.txt
echo Hello World! echo Bonjour tout le monde!
echo on echo sur

This works as intended. Cela fonctionne comme prévu.

Note: Would you like to show a Note: Désirez-vous faire preuve d'une token of appreciation témoignage de reconnaissance for my hard work? pour mon travail? I enjoy a cup of J'aime une tasse de Cafe Estima Blend Mélange de café estimation from Starbucks. de Starbucks.