Friday, August 26, 2011

The J2EE 1.4 Tutorial






About This Tutorial

Eric Armstrong
Stephanie Bodoff
Debbie Carson
Ian Evans
Maydene Fisher
Dale Green
Kim Haase
Eric Jendrock
Monica Pawlan
Beth Stearns
May 30, 2003

Who Should Use This Tutorial

How to Read This Tutorial

About the Examples

How to Print This Tutorial

Typographical Conventions
Chapter 1: Overview

Web Services Support

Extensible Markup Language

HTTP-SOAP Transport Protocol

WSDL Standard Format

UDDI and ebXML Standard Formats

Distributed Multitiered Applications

J2EE Components

J2EE Clients

Web Components

Business Components

Enterprise Information System Tier

J2EE Containers

Container Services

Container Types

Packaging

Development Roles

J2EE Product Provider

Tool Provider

Application Component Provider

Application Assembler

Application Deployer and Administrator

J2EE APIs

Enterprise JavaBeans Technology

JDBC API

Java Servlet Technology

JavaServer Pages Technology

Java Message Service

Java Naming and Directory Interface

Java Transaction API

JavaMail API

JavaBeans Activation Framework

Java API for XML Processing

Java API for XML Registries

Java API for XML-Based RPC

SOAP with Attachments API for Java (SAAJ)

J2EE Connector Architecture

Java Authentication and Authorization Service

Simplified Systems Integration
Chapter 2: Understanding XML

Introduction to XML

What Is XML?

Why Is XML Imortant?

How Can You Use XML?

XML and Related Specs: Digesting the Alphabet Soup

Basic Standards

Schema Standards

Linking and Presentation Standards

Knowledge Standards

Standards That Build on XML

Summary

Generating XML Data

Writing a Simple XML File

Defining the Root Element

Writing Processing Instructions

Introducing an Eror

Substituting and Inserting Text

Creating a Document Type Definition (DTD)

Documents and Data

Defining Attributes and Entities in the DTD

Referencing Binary Entities

Defining Parameter Entities and Conditional Sections

Resolving A Naming Conflict

Using Namespaces

Designing an XML Data Structure

Saving Yourself Some Work

Attributes and Elements

Normalizing Data

Normalizing DTDs

Summary
Chapter 3: Getting Started with Web Applications

Web Application Life Cycle

J2EE 1.4 Application Server

Components

Setting Up To Build and Deploy Tutorial Examples

Starting and Stopping the J2EE Application Server

Starting the deploytool Utility

Web Modules

Creating a Web Module

Configuring Web Modules

Mapping URLs to Web Components

Declaring Welcome Files

Setting Initialization Parameters
Specifying Eror Mappings

Declaring References to Environment Entries, Resource Environment Entries, or Resources

Deploying Web Modules

Listing Deployed Web Modules

Running Web Applications

Updating Web Modules

Undeploying Web Modules

Duke's Bookstore Examples

Accessing Databases from Web Applications

Starting the PointBase Database Server

Populating the Example Database

Defining a Data Source in the J2EE Server

Configuring the Web Application to Reference a Data Source with JNDI

Mapping the Web Application JNDI Name to a Data Source

Further Information
Chapter 4: Java API for XML Processing

The JAXP APIs

An Overview of the Packages

The Simple API for XML (SAX) APIs

The SAX Packages

The Document Object Model (DOM) APIs

The DOM Packages

The XML Stylesheet Language for Transformation (XSLT) APIs

The XSLT Packages

Compiling and Running the Programs

Where Do You Go from Here?
Chapter 5: Simple API for XML

When to Use SAX

Echoing an XML File with the SAX Parser

Creating the Skeleton

Iporting Classes

Setting up for I/O

Implementing the ContentHandler Interface

Setting up the Parser

Writing the Output

Spacing the Output

Handling Content Events

Compiling and Running the Program

Checking the Output

Identifying the Events

Compressing the Output

Inspecting the Output

Documents and Data

Adding Additional Event Handlers

Identifying the Document's Location

Handling Processing Instructions

Summary

Handling Erors with the Nonvalidating Parser

Displaying Special Characters and CDATA

Handling Special Characters

Handling Text with XML-Style Syntax

Handling CDATA and Other Characters

Parsing with a DTD

DTD's Effect on the Nonvalidating Parser

Tracking Ignorable Whitespace

Cleanup

Empty Elements, Revisited

Echoing Entity References

Echoing the External Entity

Summarizing Entities

Choosing your Parser Implementation

Using the Validating Parser

Configuring the Factory

Validating with XML Schema

Experimenting with Validation Erors

Eror Handling in the Validating Parser

Parsing a Parameterized DTD

DTD Warnings

Handling Lexical Events

How the LexicalHandler Works

Working with a LexicalHandler

Using the DTDHandler and EntityResolver

The DTDHandler API

The EntityResolver API

Further Information
Chapter 6: Document Object Model

When to Use DOM

Documents vs. Data

Mixed Content Model

A Simpler Model

Increasing the Complexity

Choosing Your Model

Reading XML Data into a DOM

Creating the Program

Additional Information

Looking Ahead

Displaying a DOM Hierarchy

Echoing Tree Nodes

Convert DomEcho to a GUI App

Create Adapters to Display the DOM in a JTree

Finishing Up

Examining the Structure of a DOM

Displaying A Simple Tree

Displaying a More Complex Tree

Finishing Up

Constructing a User-Friendly JTree from a DOM

Compressing the Tree View

Acting on Tree Selections

Handling Modifications

Finishing Up

Creating and Manipulating a DOM

Obtaining a DOM from the Factory

Normalizing the DOM

Other Operations

Finishing Up

Validating with XML Schema

Overview of the Validation Process

Configuring the DocumentBuilder Factory

Validating with Multiple Namespaces

Further Information
Chapter 7: XML Stylesheet Language for Transformations

Introducing XSLT and XPath

The JAXP Transformation Packages

How XPath Works

XPATH Expressions

The XSLT/XPath Data Model

Templates and Contexts

Basic XPath Addressing

Basic XPath Expressions

Combining Index Addresses

Wildcards

Extended-Path Addressing

XPath Data Types and Operators

String-Value of an Element

XPath Functions

Summary

Writing Out a DOM as an XML File

Reading the XML

Creating a Transformer

Writing the XML

Writing Out a Subtree of the DOM

Summary

Generating XML from an Arbitrary Data Structure

Creating a Simple File

Creating a Simple Parser

Modifying the Parser to Generate SAX Events

Using the Parser as a SAXSource

Doing the Conversion

Transforming XML Data with XSLT

Defining a Simple
Document Type

Creating a Test Document

Writing an XSLT Transform

Processing the Basic Structure Elements

Writing the Basic Program

Trimming the Whitespace

Processing the Remaining Structure Elements

Process Inline (Content) Elements

Printing the HTML

What Else Can XSLT Do?

Transforming from the Command Line with Xalan

Concatenating Transformations with a Filter Chain

Writing the Program

Understanding How the Filter Chain Works

Testing the Program

Conclusion

Further Information
Chapter 8: Building Web Services With JAX-RPC

Types Supported By JAX-RPC

J2SE SDK Classes

Primitives

Arrays

Value Types

JavaBeans Components

Creating a Web Service with JAX-RPC

Building the Service

Packaging the Service

Specifying the Endpoint Address

Deploying the Service

Creating Web Service Clients with JAX-RPC

Static Stub Client Example

Dynamic Proxy Client Example

Dynamic Invocation Interface (DII) Client Example

J2EE Application Client Example

Other JAX-RPC Client Examples

Further Information
Chapter 9: SOAP with Attachments API for Java

Overview of SAAJ

Messages

Connections

Tutorial

Creating and Sending a Simple Message

Adding Content to the Header

Adding Content to the SOAP Body

Adding Content to the SOAPPart Object

Adding a Document to the SOAP Body

Manipulating Message Content Using SAAJ or DOM APIs

Adding Attachments

Adding Attributes

Using SOAP Faults

Code Examples

Request.java

MyUddiPing.java

HeaderExample.java

SOAPFaultTest.java

DOMExample.java

Conclusion

Further Information
Chapter 10: Java API for XML Registries

Overview of JAXR

What Is a Registry?

What Is JAXR?

JAXR Architecture

Implementing a JAXR Client

Establishing a Connection

Querying a Registry

Managing Registry Data

Using Taxonomies in JAXR Clients

Running the Client Examples

Before You Compile the Examples

Compiling the Examples

Running the Examples

Using JAXR Clients in J2EE Applications

Coding the Application Client: MyAppClient.java

Coding the PubQuery Session Bean

Compiling the Source Files

Starting the J2EE Application Server

Creating JAXR Resources

Creating and Packaging the Application

Deploying the Application

Saving the Client JAR and Running the Application

Undeploying and Removing the Application

Further Information
Chapter 11: Java Servlet Technology

What is a Servlet?

The Example Servlets

Troubleshooting

Servlet Life Cycle

Handling Servlet Life Cycle Events

Handling Erors

Sharing Information

Using Scope Objects

Controlling Concurrent Access to Shared Resources

Accessing Databases

Initializing a Servlet

Writing Service Methods

Getting Information from Requests

Constructing Responses

Filtering Requests and Responses

Programming Filters

Programming Customized Requests and Responses

Specifying Filter Mappings

Invoking Other Web Resources

Including Other Resources in the Response

Transfering Control to Another Web Component

Accessing the Web Context

Maintaining Client State

Accessing a Session

Associating Attributes with a Session

Session Management

Session Tracking

Finalizing a Servlet

Tracking Service Requests

Notifying Methods to Shut Down

Creating Polite Long-Running Methods

Further Information
Chapter 12: JavaServer Pages Technology

What Is a JSP Page?

Example

The Example JSP Pages

The Life Cycle of a JSP Page

Translation and Compilation

Execution

Creating Static Content

Response and Page Encoding

Creating Dynamic Content

Using Objects within JSP Pages

Expression Language

Deactivating Expression Evaluation

Using Expressions

Variables

Implicit Objects

Literals

Operators

Reserved Words

Examples

Functions

JavaBeans Components

JavaBeans Component Design Conventions

Creating and Using a JavaBeans Component

Setting JavaBeans Component Properties

Retrieving JavaBeans Component Properties

Using Custom Tags

Declaring Tag Libraries

Including the Tag Library Implementation

Reusing Content in JSP Pages

Transfering Control to Another Web Component

jsp:param Element

Including an Applet

Setting Properties for Groups of JSP Pages

Further Information
Chapter 13: JavaServer Pages Standard Tag Library

The Example JSP Pages

Using JSTL

Tag Collaboration

Core Tags

Variable Support Tags

Flow Control Tags

URL Tags

Miscellaneous Tags

XML Tags

Core Tags

Flow Control Tags

Transformation Tags

Internationalization Tags

Setting the Locale

Messaging Tags

Formatting Tags

SQL Tags

query Tag Result Interface

Functions

Further Information
Chapter 14: Custom Tags in JSP Pages

What Is a Custom Tag?

The Example JSP Pages

Types of Tags

Tags with Attributes

Tags with Bodies

Tags That Define Variables

Communication Between Tags

Encapsulating Reusable Content using Tag Files

Tag File Location

Tag File Directives

Evaluating Fragments Passed to Tag Files

Examples

Tag Library Descriptors

Declaring Tag Files

Declaring Tag Handlers

Declaring Tag Attributes for Tag Handlers

Declaring Tag Variables for Tag Handlers

Programming Simple Tag Handlers

Basic Tags

Tags with Attributes

Tags with Bodies

Tags That Define Variables

Cooperating Tags

Examples
Chapter 15: Scripting in JSP Pages

The Example JSP Pages

Using Scripting

Disabling Scripting

Declarations

Initializing and Finalizing a JSP Page

Scriptlets

Expressions

Programming Tags That Accept Scripting Elements

TLD Elements

Tag Handlers

Tags with Bodies

Cooperating Tags

Tags That Define Variables
Chapter 16: Internationalizing and Localizing Web Applications

Java Platform Localization Classes

Providing Localized Messages and Labels

Date and Number Formatting

Character Sets and Encodings

Character Sets

Character Encoding

Further Information
Chapter 17: New Features for EJB 2.1 Technology

Overview

Web Service Endpoints

Web Service Example: HelloServiceEJB

Source Code for HelloServiceEJB

Building HelloServiceEJB

Building the Web Service Client

Running the Web Service Client

Timer Service

Creating Timers

Cancelling and Saving Timers

Getting Timer Information

Transactions and Timers

The TimerSessionEJB Example

Building TimerSessionEJB
Chapter 18: Security

Overview

Users, Realms, and Groups

Security Roles

Declaring and Linking Role References

Mapping Roles to Users and Groups

Web-Tier Security

Protecting Web Resources

Authenticating Users of Web Resources

Using Programmatic Security in the Web Tier

Protecting Web Resources

Installing and Configuring SSL Support

Setting Up Digital Certificates

EJB-Tier Security

Declaring Method Permissions

Using Programmatic Security in the EJB Tier

Unauthenticated User Name

Application Client-Tier Security

EIS-Tier Security

Container-Managed Sign-On

Component-Managed Sign-On

Configuring Resource Adapter Security

Propagating Security Identity

Configuring a Component's Propagated Security Identity

Configuring Client Authentication

Using Java Authorization Contract for Containers
Chapter 19: J2EE Connector Architecture

About Resource Adapters

Resource Adapter Contracts

Connector 1.5 Resource Adapters

Common Client Interface
Chapter 20: The Java Message Service API

Overview

What Is Messaging?

What Is the JMS API?

When Can You Use the JMS API?

How Does the JMS API Work with the J2EE Platform?

Basic JMS API Concepts

JMS API Architecture

Messaging Domains

Message Consumption

The JMS API Programming Model

Administered Objects

Connections

Sessions

Message Producers

Message Consumers

Messages

Exception Handling

Writing Simple JMS Client Applications

Setting Your Environment for Running Applications

A Simple Example of Synchronous Message Receives

A Simple Example of Asynchronous Message Consumption

Running JMS Client Programs on Multiple Systems

Creating Robust JMS Applications

Using Basic Reliability Mechanisms

Using Advanced Reliability Mechanisms

Using the JMS API in a J2EE Application

Using Session and Entity Beans to Produce and to Synchronously Receive Messages

Using Message-Driven Beans

Managing Distributed Transactions

Using the JMS API with Application Clients and Web Components

Specifying Deployment Descriptors

Further Information
Chapter 21: J2EE Examples Using the JMS API

A Simple J2EE Application that Uses the JMS API

Writing the Application Components

Creating and Packaging the Application

Deploying the Application

Saving the Client JAR and Running the Application

Undeploying and Removing the Application

A J2EE Application that Uses the JMS API with a Session Bean

Writing the Application Components

Creating and Packaging the Application

Deploying the Application

Saving the Client JAR and Running the Application

Undeploying and Removing the Application

A J2EE Application that Uses the JMS API with an Entity Bean

Overview of the Human Resources Application

Writing the Application Components

Creating and Packaging the Application

Deploying the Application

Saving the Client JAR and Running the Application

Undeploying and Removing the Application

An Application Example that Consumes Messages from a Remote J2EE Server

Overview of the Applications

Writing the Application Components

Creating and Packaging the Applications

Deploying the Applications

Saving the Client JAR and Running the Application Client

Undeploying and Removing the Applications

An Application Example that Deploys a Message-Driven Bean on Two J2EE Servers

Overview of the Applications

Writing the Application Components

Creating and Packaging the Applications

Deploying the Applications

Saving the Client JAR and Running the Application Client

Undeploying and Removing the Applications
Appendix A: Java Encoding Schemes

Further Information
Appendix B: HTTP Overview

HTTP Requests

HTTP Responses
Glossary
About the Authors
Index

Another J2EE Books
Download

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!