Skip Headers
Oracle® Application Server Containers for J2EE Servlet Developer's Guide
10
g
Release 2 (10.1.2)
B14017-02
Library
Product
Index
Next
Contents
Title and Copyright Information
Preface
Audience
Documentation Accessibility
Related Documentation
Conventions
1
Servlet Overview
Introduction to Servlets
Review of Servlet Technology
Advantages of Servlets
The Servlet Interface and Request and Response Objects
Servlets and the Servlet Container
Introduction to Servlet Sessions
Introduction to Session Tracking
Introduction to the HttpSession Interface
Introduction to Servlet Contexts
Servlet Context Basics
How to Obtain a Servlet Context
Servlet Context Methods
Introduction to Servlet Configuration Objects
Introduction to Servlet Filters
Introduction to Event Listeners
JSP Pages and Other J2EE Component Types
A First Servlet Example
Hello World Code
Compiling and Deploying the Servlet
Running the Servlet
2
Servlet Development
OC4J Standalone for Development
Overview: Using OC4J Standalone
Key OC4J Flags for Development
Removal of tools.jar from OC4J Standalone
Servlet Development Basics and Key Considerations
Sample Code Template
Servlet Lifecycle
Servlet Preloading
Servlet Classloading and Application Redeployment
OC4J Web Application Redeployment and Class Reloading Features
Loading WAR File Classes Before System Classes in OC4J
Sharing Cached Java Objects Across OC4J Servlets in Oracle Application Server
Servlet Information Exchange
Servlet Includes and Forwards
Servlet Thread Models and Related Considerations
Servlet Performance and Monitoring
General Performance Considerations
Oracle Application Server Dynamic Monitoring Service
JDK 1.4 Considerations: Cannot Invoke Classes Not in Packages
Additional Oracle Features
OC4J Logging
OC4J Logs
Oracle Diagnostic Logging Versus Text-Based Logging
Additional Oracle Application Server Log Files
Servlet Debugging
OC4J Debugging Flags
Setting OC4J Debugging Flags
Timing Considerations for Debugging in Oracle Application Server
Debugging Through JDeveloper and Other IDEs
Oracle JDeveloper Support for Servlet Development
Introduction to OC4J Support for Open Source Frameworks
Servlet Invocation
Summary of URL Components
Servlet Invocation by Class Name During OC4J Development
Servlet Invocation in an Oracle Application Server Production Environment
Key Features for Invocation in Oracle Application Server
Use of Perceived Front-End Hosts by OC4J
Servlet Invocation in an OC4J Standalone Environment
Servlet Sessions
Session Tracking
Overview of Session Tracking
Cookies
URL Rewriting
Other Session Tracking Methods
Session Tracking in OC4J
Features of the HttpSession Interface
Session Cancellation
Cancellation Through a Timeout
Cancellation by the Servlet
Session Replication in a Distributable Application
Overview of Session Replication and Requirements
Possible Clustering Error Conditions and Related Environment Flags
Session Replication Details and Logistics
Session Servlet Example
SessionServlet Code
Deploying and Testing
Servlet Security
Use of Security Features
Using Certificates with OC4J and Oracle HTTP Server
Requesting Client Authentication
Configuration of Oracle HTTP Server and OC4J for SSL
Oracle HTTP Server Configuration Steps for SSL
OC4J Configuration Steps for SSL
SSL Common Problems and Solutions
SSL Common Errors
General SSL Debugging
Additional Security Considerations
Summary of Servlet Best Practices
Best Practices: General Coding
Best Practices: Sessions
Best Practices: Configuration
3
Servlet Filters and Event Listeners
Servlet Filters
Overview of Servlet Filters
How the Servlet Container Invokes Filters
Filtering of Forward or Include Targets
Filter Examples
Filter Example 1
Filter Example 2
Filter Example 3
Event Listeners
Event Categories and Listener Interfaces
Typical Event Listener Scenario
Event Listener Declaration and Invocation
Event Listener Coding and Deployment Guidelines
Event Listener Methods and Related Classes
ServletContextListener Methods, ServletContextEvent Class
ServletContextAttributeListener Methods, ServletContextAttributeEvent Class
HttpSessionListener Methods, HttpSessionEvent Class
HttpSessionAttributeListener Methods, HttpSessionBindingEvent Class
Event Listener Sample
Welcome Page: index.jsp
Deployment Descriptor: web.xml
Listener Class: SessionLifeCycleEventExample
Session Creation Servlet: SessionCreateServlet.java
Session Destruction Servlet: SessionDestroyServlet.java
4
JDBC and EJB Calls from Servlets
Use of JDBC in Servlets
Database Query Servlet
HTML Form
Servlet Code: GetEmpInfo
Deployment and Testing of the Database Query Servlet
EJB Calls from Servlets
Servlet-EJB Overview
Servlet-EJB Scenarios
EJB Local Interfaces Versus Remote Interfaces
EJB Local Lookup
Servlet-EJB Application Code for Local Lookup
Configuration and Deployment for Local Lookup
Invocation of the Servlet-EJB Application
EJB Remote Lookup within the Same Application
Use of the Remote Flag
Servlet-EJB Application Code for Remote Lookup in the Same Application
Configuration for Remote Lookup in the Same Application
EJB Remote Lookup outside the Application
Servlet-EJB Application Code for Remote Lookup outside the Application
Configuration and Deployment for Remote Lookup outside the Application
5
Deployment and Configuration Overview
General Overview of OC4J Deployment and Configuration
Overview: OC4J Standalone Versus the Oracle Application Server Environment
Overview of OC4J Deployment Scenarios
Using Oracle Deployment Tools Versus Expert Modes
Overview of Configuration Files
Introduction to OC4J and J2EE Configuration Files
Summary of Server, Global, and Web Site Configuration Files
Summary of Application-Level Configuration Files
OC4J Top-Level Server Configuration File: server.xml
OC4J and J2EE Application Descriptors
Standard J2EE Application Descriptors
OC4J Global Application Descriptor
OC4J-Specific Application Descriptors
Summary of Relationships Between Application Descriptors
OC4J and J2EE Web Descriptors
Standard J2EE Web Descriptors
OC4J Global Web Application Descriptor
OC4J-Specific Web Descriptors
Summary of Relationships Between Web Descriptors
OC4J Web Site Descriptors
Example: Mappings to and from Web Site Descriptors
Application Packaging
J2EE Application Structure
EAR File and WAR File Structures
Sample EAR and WAR File
Deployment Scenarios to OC4J Standalone
Setting Up an Administrative User and Password
Starting and Stopping OC4J Standalone
OC4J Default Application and Default Web Application
Use of the Default Application and Default Web Application
Configuration of the Default Application and Default Web Application
Deploying an EAR File to OC4J Standalone
Using admin.jar to Deploy the EAR File
Using admin.jar to Bind the Web Application
Sample Deployment
Descriptors for Sample Deployment
Invoking the Sample Application
Deploying Files into a J2EE Application Structure on OC4J Standalone
Deploying an Independent WAR File to OC4J Standalone
Deploying Files into a Web Application Directory Structure on OC4J Standalone
Using a Web Application Directory Structure in the Default Web Application
Using a Web Application Directory Structure in an Alternative Web Application
Application Undeployment or Redeployment in OC4J Standalone
Using admin.jar to Undeploy an Application
Using admin.jar to Redeploy an Application
Manually Redeploying a WAR File
Triggering Application Redeployment after File Manipulation
OC4J Deployment in Oracle Application Server
Overview of OC4J Deployment and Configuration in Oracle Application Server
OC4J Default Web Application in Oracle Application Server
Application Undeployment and Redeployment in Oracle Application Server
Using Enterprise Manager to Undeploy an Application
Using Enterprise Manager to Redeploy an Application
6
Configuration File Descriptions
Configuration for global-web-application.xml and orion-web.xml
Element Descriptions for global-web-application.xml and orion-web.xml
DTD for global-web-application.xml and orion-web.xml
Hierarchical Representation of global-web-application.xml and orion-web.xml
Sample global-web-application.xml Settings
Configuration for Web Site XML Files
Element Descriptions for Web Site XML Files
DTD for Web Site XML Files
Hierarchical Representation of Web Site XML Files
Sample default-web-site.xml File
7
Configuration with Enterprise Manager
Web Module Configuration in Oracle Enterprise Manager 10
g
Application Server Control Console Page Descriptions
Application Server Control Console OC4J Home Page
Application Server Control Console OC4J Applications Page
Application Server Control Console Deploy Application (EAR) Page
Application Server Control Console Deploy Web Application (WAR) Page
Application Server Control Console OC4J Administration Page
Application Server Control Console Website Properties Page
Application Server Control Console Web Module Page
Application Server Control Console Web Module Properties Page
Application Server Control Console Web Module Mappings Page
Application Server Control Console Web Module Filtering and Chaining Page
Application Server Control Console Web Module Environment Page
Application Server Control Console Web Module Advanced Properties Page
A
Open Source Frameworks and Utilities
Configuration and Use of Jakarta Struts in OC4J
Overview of Jakarta Struts
Downloading the Struts Binary Distribution
Unpacking the Struts Binary Distribution
Installing and Accessing Struts Documentation
Installing the Struts Sample Web Application
Deploying Your Own Application with the Struts Framework
Configuration and Use of Jakarta log4j in OC4J
Overview of Jakarta log4j
Downloading the log4j Binary Distribution
Unpacking the log4j Binary Distribution
Installing the log4j Library
Use the log4j Library at a Global Application Level
Package the log4j Library as a Web Application Library
Package the log4j Library as a Shared Library for EJB and Web Applications
Using log4j Configuration Files
Use the Default Files for Automatic log4j Configuration
Use Alternative Files for Automatic log4j Configuration
Programmatically Specify External Configuration Files
Enabling log4j Debug Mode
B
Third-Party Licenses
Apache HTTP Server
The Apache Software License
Index