Configuring WebLogic Server to Use CGI
7.7 Using CGI with WebLogic Server
WebLogic Server supports all CGI scripts through an internal WebLogic servlet called the CGIServlet. To use CGI, register the CGIServlet in the Web application deployment descriptor. See Section 3.4, Configuring How a Client Accesses a Web Application .7.7.1 Configuring WebLogic Server to Use CGI
To configure CGI in WebLogic Server: 1. Declare the CGIServlet in your Web application by using the servlet and servlet-mapping elements in the J2EE standard Web application deployment descriptor, web.xml. The web.xml file is located in the WEB-INF directory of your Web application. The class name for the CGIServlet is weblogic.servlet.CGIServlet. You do not need to package this class in your Web application. 2. Register the following initialization attributes for the CGIServlet by defining the following init-param elements: ■ cgiDir—The path to the directory containing your CGI scripts. You can specify multiple directories, separated by a ; Windows or a : UNIX. If you do not specify cgiDir, the directory defaults to a directory named cgi-bin under the Web application root. ■ useByteStream—By default, character streams are used to read the output of CGI scripts. When scripts produce binary data, the stream may become corrupted due to character encoding. Use the useByteStream parameter to keep the stream from becoming corrupted. Using this parameter for ascii output also improves performance. ■ extension mapping—Maps a file extension to the interpreter or executable that runs the script. If the script does not require an executable, this initialization attribute may be omitted. ■ The param-name for extension mappings must begin with an asterisk followed by a dot, followed by the file extension, for example, .pl. ■ The param-value contains the path to the interpreter or executable that runs the script. You can create multiple mappings by creating a separate init-param element for each mapping. Example 7–5 Example Web Application Deployment Descriptor Entries for Registering the CGIServlet servlet servlet-nameCGIServletservlet-name Note: Because the ClasspathServlet serves any resource located in the system CLASSPATH, do not place resources that should not be publicly available in the system CLASSPATH. Note: WebLogic Server provides functionality to support your legacy Common Gateway Interface CGI scripts. For new projects, we suggest you use HTTP servlets or JavaServer Pages. Configuring Resources in a Web Application 7-7 servlet-classweblogic.servlet.CGIServletservlet-class init-param param-namecgiDirparam-name param-value beawlserver6.0configmydomainapplicationsmyWebAppcgi-bin param-value init-param init-param param-name.plparam-name param-valuebinperl.exeparam-value init-param servlet ... servlet-mapping servlet-nameCGIServletservlet-name url-patterncgi-binurl-pattern servlet-mapping7.7.2 Requesting a CGI Script
Parts
» Oracle Fusion Middleware Online Documentation Library
» Document Scope and Audience Guide To This Document
» Servlets and Java EE What You Can Do with Servlets
» JSPs and Java EE What You Can Do with JSPs Overview of How JSP Requests Are Handled
» Related Documentation New and Changed Features In This Release Web Application Security
» Avoiding Session Fixation Attacks in Programmatic Login Avoiding Redirection Attacks
» Step One: Create the Enterprise Application Wrapper Step Two: Create the Web Application
» Servlet Mapping Configuring Servlets
» Setting Up a Default Servlet Servlet Initialization Attributes
» Writing a Simple HTTP Servlet
» Advanced Features Complete HelloWorldServlet Example
» Usage Tracking a Request Handle Footprint
» WebLogic JSP and Java EE Configuring Java Server Pages JSPs Registering a JSP as a Servlet
» Configuring JSP Tag Libraries Configuring Welcome Files
» Customizing HTTP Error Responses Determining the Encoding of an HTTP Request
» JavaServer Faces JSF JavaServer Pages Standard Tag Libraries JSTL
» Referencing External EJBs More about the ejb-ref Elements
» Referencing Application-Scoped EJBs Oracle Fusion Middleware Online Documentation Library
» Configuring WebLogic Server to Use CGI
» Web Component Classes That Support Annotations
» Initializing a Servlet when WebLogic Server Starts Overriding the init Method
» Serving Resources from the CLASSPATH with the ClasspathServlet Providing an HTTP Response
» Methods for Using the HTTP Request Example: Retrieving Input by Using Query Parameters
» Setting Cookies in an HTTP Servlet Retrieving Cookies in an HTTP Servlet
» Forwarding a Request Including a Request
» Setting Up a Proxy to a Secondary Web Server
» Sample Deployment Descriptor for the Proxy Servlet
» Using WebLogic Services from an HTTP Servlet Threading Issues in HTTP Servlets Clustering Servlets
» Referencing a Servlet in a Web Application URL Pattern Matching
» doRequest doResponse doTimeOut Abstract Asynchronous Servlet
» Future Response Servlet A Future Response Model for HTTP Servlets
» HTTP Session Properties Session Timeout Configuring WebLogic Server Session Cookies
» Configuring Application Cookies That Outlive a Session Logging Out
» Configuring JDBC-based Persistent Storage
» Caching and Database Updates for JDBC Session Persistence Using Cookie-Based Session Persistence
» Coding Guidelines for URL Rewriting URL Rewriting and Wireless Access Protocol WAP
» A History of Session Tracking Tracking a Session with an HttpSession Object
» Lifetime of a Session How Session Tracking Works
» Detecting the Start of a Session Setting and Getting Session NameValue Attributes
» Configuring Session Tracking Using URL Rewriting Instead of Cookies
» Scenarios to Avoid When Using Sessions Use Serializable Attribute Values
» How the Pub-Sub Server Works
» Channels Message Delivery and Order of Delivery Guarantee
» Creating the weblogic-pubsub.xml File
» Overview of the Main API Classes and Interfaces
» Getting a Pub-Sub Server Instance and Creating a Local Client Publishing Messages to a Channel
» Programming the Message Filter Class Configuring the Message Filter Chain
» Updating a Browser Client to Communicate with the Pub-Sub Server
» Overriding the Default Servlet Mapping of the pubsub Java EE Library
» Specify Access to Channel Operations Restricting Access to All Channel Operations
» Map Roles to Principals Configure SSL for Pub-Sub Communication
» Use AuthCookieEnabled to Access Resources Locking Down the Pub-Sub Server
» Configuring JMS as a Handler
» Configuring Persistent Channels Advanced Topic: Persisting Messages to Physical Storage
» Declarations Scriptlets Oracle Fusion Middleware Online Documentation Library
» Expressions Example of a JSP with HTML and Embedded Java
» Instantiating the JavaBean Object Doing Setup Work at JavaBean Instantiation
» Forwarding Requests Including Requests
» Expressions and Attribute Values
» JSP Expression Language Implicit Objects
» Literals Errors, Warnings, Default Values Operators Operator Precedence
» JSP Compiler Syntax JSP Compiler Options
» Using the JSPClassServlet Precompiling JSPs
» Configuring a Filter Configuring Filters
» Writing a Filter Class Filtering the Servlet Response Object Additional Resources
» Overview of WebLogic JSP Form Validation Tags Using WebLogic JSP Form Validation Tags in a JSP
» Sample JSP with Validator Tags
» Refreshing a Cache Flushing a Cache
» Repeat Tag Overview of the WebLogic EJB-to-JSP Integration Tool
» Basic Operation Interface Source Files
» Build Options Panel Troubleshooting
Show more