|
WebLogic Server 7.0 Code Examples, BEA Systems, Inc. | |||||
See:
Description
| CGI Example Summary | |
| HelloWorld.pl | This is a simple perl CGI script that outputs a static HTML file. |
This example contains a simple CGI perl script, intended to show you how to use CGI with WebLogic Server. The intent here is not to teach CGI or perl, but to explain the process of configuring your Web Application to include CGI scripts. This functionality is to support your legacy Common Gateway Interface (CGI) scripts. For new projects, we suggest you use HTTP servlets or JavaServer Pages.
Perform the following steps to build and run the example:
Add the following to your the examplesWebApp web.xml file located at:
%SAMPLES_HOME%\server\stage\examples\examplesWebApp\WEB-INF\web.xml:
<servlet>
<servlet-name>CGIServlet</servlet-name>
<servlet-class>weblogic.servlet.CGIServlet</servlet-class>
<init-param>
<param-name>cgiDir</param-name>
<param-value>c:\path\to\cgi-bin</param-value>
</init-param>
<init-param>
<param-name>*.pl</param-name>
<param-value>c:\path\to\perl.exe</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CGIServlet</servlet-name>
<url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>
Where:
This will register the class weblogic.servlet.CGIServlet as a servlet, and map all requests to /examplesWebApp/cgi-bin/*.pl to perl CGI scripts, running the perl executable on each one before the WebLogic Server outputs the result.
http://WebLogicURL:WebLogicPort/examplesWebApp/cgi-bin/HelloWorld.plFor example, this is how you load the HelloWorld.pl example in a browser running on the same NT host as your WebLogic Server, on port 7001:
http://localhost:7001/examplesWebApp/cgi-bin/HelloWorld.pl
|
Documentation is available at http://e-docs.bea.com/wls/docs70/ |
|||||