Platform was set correctly, since search worked with tiny under Windows 7 64 Bit OS. Nevertheless, today I could get it running.
I needed to understand, that the search parameters are transfered via environment variables like QUERY_STRING, as you do it in your native sample code for making use of the search.cgi.
The "interface" is probably laid down in the GATEWAY_INTERFACE=CGI/1.1 specification. The CGIServelet prepares the envirenment suitable, before the call.
This web.xml worked for me.
Code:
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="pps-onlinehelp" version="3.0"> <servlet> <servlet-name>cgi</servlet-name> <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>10</param-value> </init-param> <init-param> <param-name>cgiPathPrefix</param-name> <param-value>cgi-bin</param-value> </init-param> <init-param> <param-name>executable</param-name> <param-value>search.bat</param-value> </init-param> <load-on-startup>5</load-on-startup> </servlet> <servlet-mapping> <servlet-name>cgi</servlet-name> <url-pattern>/cgi-bin/*</url-pattern> </servlet-mapping> </web-app>
One line with a simple %1 ist sufficent in this batch.
Sinse I didn't know how the call is done, I used for testing this batch search.bat which produces a log in the same folder where the batch ist stored.
Code:
@echo off set CurrentPath=%~dp0 echo ============================================ >> %CurrentPath%searchlog.txt echo Search executed from JBoss >> %CurrentPath%searchlog.txt date /T >> %CurrentPath%searchlog.txt time /T >> %CurrentPath%searchlog.txt echo %1 %2 %3 %4 >> %CurrentPath%searchlog.txt if '%1'=='' exit 1 %1 %2 %3 %4
I stored the batch file in the JBossServer\bin folder, which was one of the frist where the Search for this file happens. The CGIServlet passes the location of the search.cgi to this batch which receives it in %1 parameter and just executes this file.
Thats it.
If you or someone else has hints for improvemenst, you are welcome to post them.
Leave a comment: