Documentation Home
> Oracle GlassFish Server 3.0.1 Application Development Guide
Oracle GlassFish Server 3.0.1 Application Development Guide
Book Information
Index
Numbers and Symbols
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Preface
Part I Development Tasks and Tools
Chapter 1 Setting Up a Development Environment
Installing and Preparing the Server for Development
Development Tools
The asadmin Command
The Administration Console
GlassFish Server Ant Tasks
Scripting Language Support
The Migration Tool
The NetBeans IDE
The Eclipse IDE
Debugging Tools
Profiling Tools
Sample Applications
Chapter 2 Class Loaders
The Class Loader Hierarchy
Delegation
Using the Java Optional Package Mechanism
Using the Endorsed Standards Override Mechanism
Class Loader Universes
Application-Specific Class Loading
Circumventing Class Loader Isolation
Using the Common Class Loader
Packaging the Client JAR for One Application in Another Application
To Package the Client JAR for One Application in Another Application
Chapter 3 Using Ant with GlassFish Server
Setting Up Your Ant Environment
Defining the ANT_OPTS Variable
Defining a Target
GlassFish Server Ant Tasks
The sun-appserv-deploy Task
Subelements of sun-appserv-deploy
Attributes of sun-appserv-deploy
Examples of sun-appserv-deploy
The sun-appserv-undeploy Task
Subelements of sun-appserv-undeploy
Attributes of sun-appserv-undeploy
Examples of sun-appserv-undeploy
The sun-appserv-instance Task
Subelements of sun-appserv-instance
Attributes of sun-appserv-instance
Examples of sun-appserv-instance
The sun-appserv-component Task
Subelements of sun-appserv-component
Attributes of sun-appserv-component
Examples of sun-appserv-component
The sun-appserv-admin Task
Subelements of sun-appserv-admin
Attributes of sun-appserv-admin
Examples of sun-appserv-admin
The sun-appserv-jspc Task
Attributes of sun-appserv-jspc
Example of sun-appserv-jspc
The sun-appserv-update Task
Attributes of sun-appserv-update
Example of sun-appserv-update
The wsgen Task
Attributes of wsgen
Example of wsgen
The wsimport Task
Attributes of wsimport
Example of wsimport
Reusable Subelements
The server Subelement
Attributes of server
Examples of server
The component Subelement
Attributes of component
Examples of component
The fileset Subelement
Chapter 4 Debugging Applications
Enabling Debugging
To Set the Server to Automatically Start Up in Debug Mode
JPDA Options
Generating a Stack Trace for Debugging
Application Client Debugging
GlassFish Message Queue Debugging
Enabling Verbose Mode
GlassFish Server Logging
Profiling Tools
The NetBeans Profiler
The HPROF Profiler
To Use HPROF Profiling on UNIX
The JProbe Profiler
To Enable Remote Profiling With JProbe
Part II Developing Applications and Application Components
Chapter 5 Securing Applications
Security Goals
GlassFish Server Specific Security Features
Container Security
Declarative Security
Application Level Security
Component Level Security
Programmatic Security
Roles, Principals, and Principal to Role Mapping
Realm Configuration
Supported Realms
How to Configure a Realm
How to Set a Realm for an Application or Module
Creating a Custom Realm
JACC Support
Pluggable Audit Module Support
Configuring an Audit Module
The AuditModule Class
The server.policy File
Default Permissions
System Properties
Changing Permissions for an Application
Enabling and Disabling the Security Manager
Configuring Message Security for Web Services
Message Security Providers
Message Security Responsibilities
Application Developer
Application Deployer
System Administrator
Application-Specific Message Protection
Using a Signature to Enable Message Protection for All Methods
To Enable Message Protection for All Methods Using Digital Signature
Configuring Message Protection for a Specific Method Based on Digital Signatures
To Enable Message Protection for a Particular Method or Set of Methods Using Digital Signature
Understanding and Running the Sample Application
To Set Up the Sample Application
To Run the Sample Application
Programmatic Login
Programmatic Login Precautions
Granting Programmatic Login Permission
The ProgrammaticLogin Class
User Authentication for Single Sign-on
Adding Authentication Mechanisms to the Servlet Container
The GlassFish Server and JSR 196
Writing a Server Authentication Module
Sample Server Authentication Module
Compiling and Installing a Server Authentication Module
Configuring a Server Authentication Module
Binding a Server Authentication Module to Your Application
Chapter 6 Developing Web Services
Creating Portable Web Service Artifacts
Deploying a Web Service
The Web Service URI, WSDL File, and Test Page
GlassFish Java EE Service Engine
Using the jbi.xml File
Chapter 7 Using the Java Persistence API
Specifying the Database
Additional Database Properties
Configuring the Cache
Setting the Logging Level
Using Lazy Loading
Primary Key Generation Defaults
Automatic Schema Generation
Annotations
Generation Options
Query Hints
Changing the Persistence Provider
Restrictions and Optimizations
Oracle Database Enhancements
Extended Persistence Context
Using @OrderBy with a Shared Session Cache
Using BLOB or CLOB Types with the Inet Oraxo JDBC Driver
Database Case Sensitivity
Unique Constraints
Foreign Key Mapping
SQL Result Set Mapping
Named Native Queries and JDBC Queries
PostgreSQL Case Sensitivity
Sybase Finder Limitation
MySQL Database Restrictions
Chapter 8 Developing Web Applications
Using Servlets
Caching Servlet Results
Caching Features
Default Cache Configuration
Caching Example
The CacheKeyGenerator Interface
About the Servlet Engine
Instantiating and Removing Servlets
Request Handling
Using JavaServer Pages
JSP Tag Libraries and Standard Portable Tags
JSP Caching
Enabling JSP Caching
Caching Scope
The cache Tag
Attributes of cache
Example of cache
The flush Tag
Attributes of flush
Examples of flush
Options for Compiling JSP Files
Creating and Managing Sessions
Configuring Sessions
HTTP Sessions, Cookies, and URL Rewriting
Coordinating Session Access
Saving Sessions During Redeployment
Logging Session Attributes
Session Managers
The memory Persistence Type
The file Persistence Type
Using Comet
Introduction to Comet
The Grizzly Implementation of Comet
Client Technologies to Use With Comet
Types of Comet Connections
HTTP Streaming
Long Polling
How to Choose the Type of Connection
Grizzly Comet
The Grizzly Comet API
The Hidden Frame Example
Creating a Comet-Enabled Application
Developing the Web Component
To Create a Web Component to Support Comet
To Register the Servlet With the Comet Engine
To Define a Comet Handler to Send Updates to the Client
To Add the Comet Handler to the Comet Context
To Notify the Comet Handler of an Event
Creating the Client Pages
To Create a HTML Welcome Page That Contains IFrames for Receiving and Sending Updates
To Create a HTML Page That Updates and Displays the Content
To Create the HTML Page That Allows Submitting Updates
Creating the Deployment Descriptor
To Create the Deployment Descriptor
Deploying and Running a Comet-Enabled Application
Enabling Comet in the GlassFish Server
To Deploy the Example
To Run the Example
Bayeux Protocol
Enabling Comet
To Configure the web.xml File
To Write, Deploy, and Run the Client
Advanced Web Application Features
Internationalization Issues
The Server's Default Locale
Servlet Character Encoding
Servlet Request
Servlet Response
Virtual Server Properties
Class Loader Delegation
Using the default-web.xml File
To Use the default-web.xml File
Configuring Logging and Monitoring in the Web Container
Header Management
Configuring Valves and Catalina Listeners
Alternate Document Roots
Using a context.xml File
Enabling WebDav
Using SSI
Using CGI
Chapter 9 Using Enterprise JavaBeans Technology
Value Added Features
Read-Only Beans
The pass-by-reference Element
Pooling and Caching
Pooling Parameters
Caching Parameters
Bean-Level Container-Managed Transaction Timeouts
Priority Based Scheduling of Remote Bean Invocations
Immediate Flushing
EJB Timer Service
Using Session Beans
About the Session Bean Containers
Stateless Container
Stateful Container
Session Bean Restrictions and Optimizations
Optimizing Session Bean Performance
Restricting Transactions
Using Read-Only Beans
Read-Only Bean Characteristics and Life Cycle
Read-Only Bean Good Practices
Refreshing Read-Only Beans
Invoking a Transactional Method
Refreshing Periodically
Refreshing Programmatically
Deploying Read-Only Beans
Using Message-Driven Beans
Message-Driven Bean Configuration
Connection Factory and Destination
Message-Driven Bean Pool
Domain-Level Settings
Message-Driven Bean Restrictions and Optimizations
Pool Tuning and Monitoring
The onMessage Runtime Exception
Handling Transactions With Enterprise Beans
Flat Transactions
Global and Local Transactions
Commit Options
Administration and Monitoring
Chapter 10 Using Container-Managed Persistence
GlassFish Server Support for CMP
CMP Mapping
Mapping Capabilities
The Mapping Deployment Descriptor File
Mapping Considerations
Join Tables and Relationships
Automatic Primary Key Generation
Fixed Length CHAR Primary Keys
Managed Fields
BLOB Support
CLOB Support
Automatic Schema Generation for CMP
Supported Data Types for CMP
Generation Options for CMP
Schema Capture
Automatic Database Schema Capture
Using the capture-schema Utility
Configuring the CMP Resource
Performance-Related Features
Version Column Consistency Checking
To Use Version Consistency
Relationship Prefetching
Read-Only Beans
Default Fetch Group Flags
Configuring Queries for 1.1 Finders
About JDOQL Queries
Query Filter Expression
Query Parameters
Query Variables
JDOQL Examples
Example 1
Example 2
Example 3
CMP Restrictions and Optimizations
Disabling ORDER BY Validation
Setting the Heap Size on DB2
Eager Loading of Field State
Restrictions on Remote Interfaces
PostgreSQL Case Insensitivity
No Support for lock-when-loaded on Sybase
Sybase Finder Limitation
Date and Time Fields
Set RECURSIVE_TRIGGERS to false on MSSQL
MySQL Database Restrictions
Chapter 11 Developing Java Clients
Introducing the Application Client Container
ACC Security
ACC Naming
ACC Annotation
Java Web Start
Application Client JAR File
Developing Clients Using the ACC
To Access an EJB Component From an Application Client
To Access a JMS Resource From an Application Client
Using Java Web Start
Enabling and Disabling Java Web Start
Downloading and Launching an Application Client
The Application Client URL
Signing JAR Files Used in Java Web Start
Automatically Signing JAR Files
Using the jar-signing-alias Deployment Property
Manually Signing the Generated Application Client JAR File
Error Handling
Vendor Icon, Splash Screen, and Text
Using the Embeddable ACC
Running an Application Client Using the appclient Script
Using the package-appclient Script
The client.policy File
Using RMI/IIOP Over SSL
Connecting to a Remote EJB Module Through a Firewall
Using JavaFX Code
Specifying a Splash Screen
Setting Login Retries
Using Libraries with Application Clients
Chapter 12 Developing Connectors
Connector Support in the GlassFish Server
Connector Architecture for JMS and JDBC
Connector Configuration
Advanced Connector Configuration Options
Thread Associations
Security Maps
Work Security Maps
Overriding Configuration Properties
Testing a Connector Connection Pool
Flushing a Connector Connection Pool
Handling Invalid Connections
Setting the Shutdown Timeout
Specifying the Class Loading Policy
Using Last Agent Optimization of Transactions
Disabling Pooling for a Connection
Inbound Communication Support
Outbound Communication Support
Configuring a Message Driven Bean to Use a Resource Adapter
Chapter 13 Developing Lifecycle Listeners
Server Life Cycle Events
The LifecycleListener Interface
The LifecycleEvent Class
The Server Lifecycle Event Context
Deploying a Lifecycle Module
Considerations for Lifecycle Modules
Part III Using Services and APIs
Chapter 14 Using the JDBC API for Database Access
General Steps for Creating a JDBC Resource
Integrating the JDBC Driver
Supported Database Drivers
Making the JDBC Driver JAR Files Accessible
Automatic Detection of Installed Drivers
Creating a JDBC Connection Pool
Modifying a JDBC Connection Pool
Testing a JDBC Connection Pool
Flushing a JDBC Connection Pool
Creating a JDBC Resource
Creating Applications That Use the JDBC API
Statements
Using an Initialization Statement
Setting a Statement Timeout
Statement Caching
Statement Tracing
Connections
Disabling Pooling
Associating Connections with Threads
Custom Connection Validation
Sharing Connections
Marking Bad Connections
Handling Invalid Connections
Connection Wrapping
Wrapping Connections
Obtaining a Physical Connection From a Wrapped Connection
Using the Connection.unwrap() Method
Transactions
Using Non-Transactional Connections
Using JDBC Transaction Isolation Levels
Other Features
Allowing Non-Component Callers
Restrictions and Optimizations
Disabling Stored Procedure Creation on Sybase
Chapter 15 Using the Transaction Service
Transaction Resource Managers
Transaction Scope
Configuring the Transaction Service
The Transaction Manager, the Transaction Synchronization Registry, and UserTransaction
Transaction Logging
Storing Transaction Logs in a Database
Recovery Workarounds and Limitations
Oracle Thin Driver
Manual Transaction Recovery Limitation
Chapter 16 Using the Java Naming and Directory Interface
Accessing the Naming Context
Global JNDI Names
Accessing EJB Components Using the CosNaming Naming Context
Accessing EJB Components in a Remote GlassFish Server
Naming Environment for Lifecycle Modules
Configuring Resources
External JNDI Resources
Custom Resources
Built- in Factories for Custom Resources
JavaBeanFactory
PropertiesFactory
PrimitiviesAndStringFactory
URLFactory
Using a Custom jndi.properties File
Mapping References
Chapter 17 Using the Java Message Service
The JMS Provider
Message Queue Resource Adapter
Generic Resource Adapter
Administration of the JMS Service
Configuring the JMS Service
The Default JMS Host
Creating JMS Hosts
Checking Whether the JMS Provider Is Running
Creating Physical Destinations
Creating JMS Resources: Destinations and Connection Factories
Restarting the JMS Client After JMS Configuration
JMS Connection Features
Connection Pooling
Connection Failover
Transactions and Non-Persistent Messages
Using the ConfigurableTransactionSupport Interface
Authentication With ConnectionFactory
Message Queue varhome Directory
Delivering SOAP Messages Using the JMS API
To Send SOAP Messages Using the JMS API
To Receive SOAP Messages Using the JMS API
Chapter 18 Using the JavaMail API
Introducing JavaMail
Creating a JavaMail Session
JavaMail Session Properties
Looking Up a JavaMail Session
Sending and Reading Messages Using JavaMail
To Send a Message Using JavaMail
To Read a Message Using JavaMail
© 2010, Oracle Corporation and/or its affiliates