The Java EE 7 Tutorial
Free

The Java EE 7 Tutorial

By Oracle Corporation
Free
Book Description
Table of Contents
  • Contents
  • Preface
    • Audience
    • Documentation Accessibility
    • Before You Read This Book
    • Related Documentation
    • Conventions
    • Default Paths and File Names
  • Part I Introduction
  • 1 Overview
    • 1.1 Java EE 7 Platform Highlights
    • 1.2 Java EE Application Model
    • 1.3 Distributed Multitiered Applications
      • 1.3.1 Security
      • 1.3.2 Java EE Components
      • 1.3.3 Java EE Clients
        • 1.3.3.1 Web Clients
        • 1.3.3.2 Application Clients
        • 1.3.3.3 Applets
        • 1.3.3.4 The JavaBeans Component Architecture
        • 1.3.3.5 Java EE Server Communications
      • 1.3.4 Web Components
      • 1.3.5 Business Components
      • 1.3.6 Enterprise Information System Tier
    • 1.4 Java EE Containers
      • 1.4.1 Container Services
      • 1.4.2 Container Types
    • 1.5 Web Services Support
      • 1.5.1 XML
      • 1.5.2 SOAP Transport Protocol
      • 1.5.3 WSDL Standard Format
    • 1.6 Java EE Application Assembly and Deployment
    • 1.7 Java EE 7 APIs
      • 1.7.1 Enterprise JavaBeans Technology
      • 1.7.2 Java Servlet Technology
      • 1.7.3 JavaServer Faces Technology
      • 1.7.4 JavaServer Pages Technology
      • 1.7.5 JavaServer Pages Standard Tag Library
      • 1.7.6 Java Persistence API
      • 1.7.7 Java Transaction API
      • 1.7.8 Java API for RESTful Web Services
      • 1.7.9 Managed Beans
      • 1.7.10 Contexts and Dependency Injection for Java EE
      • 1.7.11 Dependency Injection for Java
      • 1.7.12 Bean Validation
      • 1.7.13 Java Message Service API
      • 1.7.14 Java EE Connector Architecture
      • 1.7.15 JavaMail API
      • 1.7.16 Java Authorization Contract for Containers
      • 1.7.17 Java Authentication Service Provider Interface for Containers
      • 1.7.18 Java API for WebSocket
      • 1.7.19 Java API for JSON Processing
      • 1.7.20 Concurrency Utilities for Java EE
      • 1.7.21 Batch Applications for the Java Platform
    • 1.8 Java EE 7 APIs in the Java Platform, Standard Edition 7
      • 1.8.1 Java Database Connectivity API
      • 1.8.2 Java Naming and Directory Interface API
      • 1.8.3 JavaBeans Activation Framework
      • 1.8.4 Java API for XML Processing
      • 1.8.5 Java Architecture for XML Binding
      • 1.8.6 Java API for XML Web Services
      • 1.8.7 SOAP with Attachments API for Java
      • 1.8.8 Java Authentication and Authorization Service
      • 1.8.9 Common Annotations for the Java Platform
    • 1.9 GlassFish Server Tools
  • 2 Using the Tutorial Examples
    • 2.1 Required Software
      • 2.1.1 Java Platform, Standard Edition
      • 2.1.2 Java EE 7 Software Development Kit
        • 2.1.2.1 SDK Installation Tips
      • 2.1.3 Java EE 7 Tutorial Component
      • 2.1.4 NetBeans IDE
        • 2.1.4.1 To Install NetBeans IDE without GlassFish Server
        • 2.1.4.2 To Add GlassFish Server as a Server Using NetBeans IDE
      • 2.1.5 Apache Maven
    • 2.2 Starting and Stopping GlassFish Server
      • 2.2.1 To Start GlassFish Server Using NetBeans IDE
      • 2.2.2 To Stop GlassFish Server Using NetBeans IDE
      • 2.2.3 To Start GlassFish Server Using the Command Line
      • 2.2.4 To Stop GlassFish Server Using the Command Line
    • 2.3 Starting the Administration Console
      • 2.3.1 To Start the Administration Console Using NetBeans IDE
    • 2.4 Starting and Stopping the Java DB Server
      • 2.4.1 To Start the Database Server Using NetBeans IDE
    • 2.5 Building the Examples
    • 2.6 Tutorial Example Directory Structure
    • 2.7 Java EE 7 Maven Archetypes in the Tutorial
      • 2.7.1 Installing the Tutorial Archetypes
        • 2.7.1.1 Installing the Tutorial Archetypes Using NetBeans IDE
        • 2.7.1.2 Installing the Tutorial Archetypes Using Maven
    • 2.8 Getting the Latest Updates to the Tutorial
      • 2.8.1 To Update the Tutorial Using NetBeans IDE
      • 2.8.2 To Update the Tutorial Using the Command Line
    • 2.9 Debugging Java EE Applications
      • 2.9.1 Using the Server Log
        • 2.9.1.1 To Use the Administration Console Log Viewer
      • 2.9.2 Using a Debugger
        • 2.9.2.1 To Debug an Application Using a Debugger
  • Part II Platform Basics
  • 3 Resource Creation
    • 3.1 Resources and JNDI Naming
    • 3.2 DataSource Objects and Connection Pools
    • 3.3 Creating Resources Administratively
  • 4 Injection
    • 4.1 Resource Injection
    • 4.2 Dependency Injection
    • 4.3 The Main Differences between Resource Injection and Dependency Injection
  • 5 Packaging
    • 5.1 Packaging Applications
    • 5.2 Packaging Enterprise Beans
      • 5.2.1 Packaging Enterprise Beans in EJB JAR Modules
      • 5.2.2 Packaging Enterprise Beans in WAR Modules
    • 5.3 Packaging Web Archives
    • 5.4 Packaging Resource Adapter Archives
  • Part III The Web Tier
  • 6 Getting Started with Web Applications
    • 6.1 Web Applications
    • 6.2 Web Application Lifecycle
    • 6.3 A Web Module That Uses JavaServer Faces Technology: The hello1 Example
      • 6.3.1 To View the hello1 Web Module Using NetBeans IDE
        • 6.3.1.1 Introduction to Scopes
      • 6.3.2 Packaging and Deploying the hello1 Web Module
        • 6.3.2.1 To Build and Package the hello1 Web Module Using NetBeans IDE
        • 6.3.2.2 To Build and Package the hello1 Web Module Using Maven
      • 6.3.3 Viewing Deployed Web Modules
        • 6.3.3.1 To View Deployed Web Modules Using the Administration Console
        • 6.3.3.2 To View Deployed Web Modules Using the asadmin Command
        • 6.3.3.3 To View Deployed Web Modules Using NetBeans IDE
      • 6.3.4 Running the Deployed hello1 Web Module
        • 6.3.4.1 Dynamic Reloading of Deployed Modules
      • 6.3.5 Undeploying the hello1 Web Module
        • 6.3.5.1 To Undeploy the hello1 Web Module Using NetBeans IDE
        • 6.3.5.2 To Undeploy the hello1 Web Module Using Maven
    • 6.4 A Web Module That Uses Java Servlet Technology: The hello2 Example
      • 6.4.1 Mapping URLs to Web Components
      • 6.4.2 Examining the hello2 Web Module
        • 6.4.2.1 To View the hello2 Web Module Using NetBeans IDE
      • 6.4.3 Running the hello2 Example
        • 6.4.3.1 To Run the hello2 Example Using NetBeans IDE
        • 6.4.3.2 To Run the hello2 Example Using Maven
    • 6.5 Configuring Web Applications
      • 6.5.1 Setting Context Parameters
        • 6.5.1.1 To Add a Context Parameter Using NetBeans IDE
        • 6.5.1.2 To Create a web.xml File Using NetBeans IDE
      • 6.5.2 Declaring Welcome Files
      • 6.5.3 Mapping Errors to Error Screens
        • 6.5.3.1 To Set Up Error Mapping Using NetBeans IDE
      • 6.5.4 Declaring Resource References
        • 6.5.4.1 Declaring a Reference to a Resource
        • 6.5.4.2 Declaring a Reference to a Web Service
    • 6.6 Further Information about Web Applications
  • 7 JavaServer Faces Technology
    • 7.1 What Is a JavaServer Faces Application?
    • 7.2 JavaServer Faces Technology Benefits
    • 7.3 A Simple JavaServer Faces Application
    • 7.4 User Interface Component Model
      • 7.4.1 User Interface Component Classes
      • 7.4.2 Component Rendering Model
      • 7.4.3 Conversion Model
      • 7.4.4 Event and Listener Model
      • 7.4.5 Validation Model
    • 7.5 Navigation Model
    • 7.6 The Lifecycle of a JavaServer Faces Application
      • 7.6.1 Overview of the JavaServer Faces Lifecycle
      • 7.6.2 Restore View Phase
      • 7.6.3 Apply Request Values Phase
      • 7.6.4 Process Validations Phase
      • 7.6.5 Update Model Values Phase
      • 7.6.6 Invoke Application Phase
      • 7.6.7 Render Response Phase
    • 7.7 Partial Processing and Partial Rendering
    • 7.8 Further Information about JavaServer Faces Technology
  • 8 Introduction to Facelets
    • 8.1 What Is Facelets?
    • 8.2 The Lifecycle of a Facelets Application
    • 8.3 Developing a Simple Facelets Application: The guessnumber-jsf Example Application
      • 8.3.1 Creating a Facelets Application
        • 8.3.1.1 Developing a Managed Bean
        • 8.3.1.2 Creating Facelets Views
      • 8.3.2 Configuring the Application
      • 8.3.3 Running the guessnumber-jsf Facelets Example
        • 8.3.3.1 To Build, Package, and Deploy the guessnumber-jsf Example Using NetBeans IDE
        • 8.3.3.2 To Build, Package, and Deploy the guessnumber-jsf Example Using Maven
        • 8.3.3.3 To Run the guessnumber-jsf Example
    • 8.4 Using Facelets Templates
    • 8.5 Composite Components
    • 8.6 Web Resources
    • 8.7 Relocatable Resources
    • 8.8 Resource Library Contracts
      • 8.8.1 The hello1-rlc Example Application
        • 8.8.1.1 Configuring the hello1-rlc Example
        • 8.8.1.2 The Facelets Pages for the hello1-rlc Example
        • 8.8.1.3 To Build, Package, and Deploy the hello1-rlc Example Using NetBeans IDE
        • 8.8.1.4 To Build, Package, and Deploy the hello1-rlc Example Using Maven
        • 8.8.1.5 To Run the hello1-rlc Example
    • 8.9 HTML5-Friendly Markup
      • 8.9.1 Using Pass-Through Elements
      • 8.9.2 Using Pass-Through Attributes
      • 8.9.3 The reservation Example Application
        • 8.9.3.1 The Facelets Pages for the reservation Application
        • 8.9.3.2 The Managed Bean for the reservation Application
        • 8.9.3.3 To Build, Package, and Deploy the reservation Example Using NetBeans IDE
        • 8.9.3.4 To Build, Package, and Deploy the reservation Example Using Maven
        • 8.9.3.5 To Run the reservation Example
  • 9 Expression Language
    • 9.1 Overview of the EL
    • 9.2 Immediate and Deferred Evaluation Syntax
      • 9.2.1 Immediate Evaluation
      • 9.2.2 Deferred Evaluation
    • 9.3 Value and Method Expressions
      • 9.3.1 Value Expressions
        • 9.3.1.1 Referencing Objects
        • 9.3.1.2 Referencing Object Properties or Collection Elements
        • 9.3.1.3 Referencing Literals
        • 9.3.1.4 Parameterized Method Calls
        • 9.3.1.5 Where Value Expressions Can Be Used
      • 9.3.2 Method Expressions
      • 9.3.3 Lambda Expressions
    • 9.4 Operations on Collection Objects
    • 9.5 Operators
    • 9.6 Reserved Words
    • 9.7 Examples of EL Expressions
    • 9.8 Further Information about the Expression Language
  • 10 Using JavaServer Faces Technology in Web Pages
    • 10.1 Setting Up a Page
    • 10.2 Adding Components to a Page Using HTML Tag Library Tags
      • 10.2.1 Common Component Tag Attributes
        • 10.2.1.1 The id Attribute
        • 10.2.1.2 The immediate Attribute
        • 10.2.1.3 The rendered Attribute
        • 10.2.1.4 The style and styleClass Attributes
        • 10.2.1.5 The value and binding Attributes
      • 10.2.2 Adding HTML Head and Body Tags
      • 10.2.3 Adding a Form Component
      • 10.2.4 Using Text Components
        • 10.2.4.1 Rendering a Field with the h:inputText Tag
        • 10.2.4.2 Rendering a Password Field with the h:inputSecret Tag
        • 10.2.4.3 Rendering a Label with the h:outputLabel Tag
        • 10.2.4.4 Rendering a Link with the h:outputLink Tag
        • 10.2.4.5 Displaying a Formatted Message with the h:outputFormat Tag
      • 10.2.5 Using Command Component Tags for Performing Actions and Navigation
        • 10.2.5.1 Rendering a Button with the h:commandButton Tag
        • 10.2.5.2 Rendering a Link with the h:commandLink Tag
      • 10.2.6 Adding Graphics and Images with the h:graphicImage Tag
      • 10.2.7 Laying Out Components with the h:panelGrid and h:panelGroup Tags
      • 10.2.8 Displaying Components for Selecting One Value
        • 10.2.8.1 Displaying a Check Box Using the h:selectBooleanCheckbox Tag
        • 10.2.8.2 Displaying a Menu Using the h:selectOneMenu Tag
      • 10.2.9 Displaying Components for Selecting Multiple Values
      • 10.2.10 Using the f:selectItem and f:selectItems Tags
        • 10.2.10.1 Using the f:selectItems Tag
        • 10.2.10.2 Using the f:selectItem Tag
      • 10.2.11 Displaying the Results from Selection Components
      • 10.2.12 Using Data-Bound Table Components
      • 10.2.13 Displaying Error Messages with the h:message and h:messages Tags
      • 10.2.14 Creating Bookmarkable URLs with the h:button and h:link Tags
      • 10.2.15 Using View Parameters to Configure Bookmarkable URLs
      • 10.2.16 The bookmarks Example Application
        • 10.2.16.1 To Build, Package, and Deploy the bookmarks Example Using NetBeans IDE
        • 10.2.16.2 To Build, Package, and Deploy the bookmarks Example Using Maven
        • 10.2.16.3 To Run the bookmarks Example
      • 10.2.17 Resource Relocation Using h:outputScript and h:outputStylesheet Tags
    • 10.3 Using Core Tags
  • 11 Using Converters, Listeners, and Validators
    • 11.1 Using the Standard Converters
      • 11.1.1 Converting a Component's Value
      • 11.1.2 Using DateTimeConverter
      • 11.1.3 Using NumberConverter
    • 11.2 Registering Listeners on Components
      • 11.2.1 Registering a Value-Change Listener on a Component
      • 11.2.2 Registering an Action Listener on a Component
    • 11.3 Using the Standard Validators
      • 11.3.1 Validating a Component's Value
      • 11.3.2 Using Validator Tags
    • 11.4 Referencing a Managed Bean Method
      • 11.4.1 Referencing a Method That Performs Navigation
      • 11.4.2 Referencing a Method That Handles an Action Event
      • 11.4.3 Referencing a Method That Performs Validation
      • 11.4.4 Referencing a Method That Handles a Value-Change Event
  • 12 Developing with JavaServer Faces Technology
    • 12.1 Managed Beans in JavaServer Faces Technology
      • 12.1.1 Creating a Managed Bean
      • 12.1.2 Using the EL to Reference Managed Beans
    • 12.2 Writing Bean Properties
      • 12.2.1 Writing Properties Bound to Component Values
        • 12.2.1.1 UIInput and UIOutput Properties
        • 12.2.1.2 UIData Properties
        • 12.2.1.3 UISelectBoolean Properties
        • 12.2.1.4 UISelectMany Properties
        • 12.2.1.5 UISelectOne Properties
        • 12.2.1.6 UISelectItem Properties
        • 12.2.1.7 UISelectItems Properties
      • 12.2.2 Writing Properties Bound to Component Instances
      • 12.2.3 Writing Properties Bound to Converters, Listeners, or Validators
    • 12.3 Writing Managed Bean Methods
      • 12.3.1 Writing a Method to Handle Navigation
      • 12.3.2 Writing a Method to Handle an Action Event
      • 12.3.3 Writing a Method to Perform Validation
      • 12.3.4 Writing a Method to Handle a Value-Change Event
  • 13 Using Ajax with JavaServer Faces Technology
    • 13.1 Overview of Ajax
    • 13.2 Using Ajax Functionality with JavaServer Faces Technology
    • 13.3 Using Ajax with Facelets
      • 13.3.1 Using the f:ajax Tag
    • 13.4 Sending an Ajax Request
      • 13.4.1 Using the event Attribute
      • 13.4.2 Using the execute Attribute
      • 13.4.3 Using the immediate Attribute
      • 13.4.4 Using the listener Attribute
    • 13.5 Monitoring Events on the Client
    • 13.6 Handling Errors
    • 13.7 Receiving an Ajax Response
    • 13.8 Ajax Request Lifecycle
    • 13.9 Grouping of Components
    • 13.10 Loading JavaScript as a Resource
      • 13.10.1 Using JavaScript API in a Facelets Application
      • 13.10.2 Using the @ResourceDependency Annotation in a Bean Class
    • 13.11 The ajaxguessnumber Example Application
      • 13.11.1 The ajaxguessnumber Source Files
        • 13.11.1.1 The ajaxgreeting.xhtml Facelets Page
        • 13.11.1.2 The UserNumberBean Backing Bean
        • 13.11.1.3 The DukesNumberBean CDI Managed Bean
      • 13.11.2 Running the ajaxguessnumber Example
        • 13.11.2.1 To Build, Package, and Deploy the ajaxguessnumber Example Using NetBeans IDE
        • 13.11.2.2 To Build, Package, and Deploy the ajaxguessnumber Example Using Maven
        • 13.11.2.3 To Run the ajaxguessnumber Example
    • 13.12 Further Information about Ajax in JavaServer Faces Technology
  • 14 Composite Components: Advanced Topics and an Example
    • 14.1 Attributes of a Composite Component
    • 14.2 Invoking a Managed Bean
    • 14.3 Validating Composite Component Values
    • 14.4 The compositecomponentexample Example Application
      • 14.4.1 The Composite Component File
      • 14.4.2 The Using Page
      • 14.4.3 The Managed Bean
      • 14.4.4 Running the compositecomponentexample Example
        • 14.4.4.1 To Build, Package, and Deploy the compositecomponentexample Example Using NetBeans IDE
        • 14.4.4.2 To Build, Package, and Deploy the compositecomponentexample Example Using Maven
        • 14.4.4.3 To Run the compositecomponentexample Example
  • 15 Creating Custom UI Components and Other Custom Objects
    • 15.1 Determining Whether You Need a Custom Component or Renderer
      • 15.1.1 When to Use a Custom Component
      • 15.1.2 When to Use a Custom Renderer
      • 15.1.3 Component, Renderer, and Tag Combinations
    • 15.2 Understanding the Image Map Example
      • 15.2.1 Why Use JavaServer Faces Technology to Implement an Image Map?
      • 15.2.2 Understanding the Rendered HTML
      • 15.2.3 Understanding the Facelets Page
      • 15.2.4 Configuring Model Data
      • 15.2.5 Summary of the Image Map Application Classes
    • 15.3 Steps for Creating a Custom Component
    • 15.4 Creating Custom Component Classes
      • 15.4.1 Specifying the Component Family
      • 15.4.2 Performing Encoding
      • 15.4.3 Performing Decoding
      • 15.4.4 Enabling Component Properties to Accept Expressions
      • 15.4.5 Saving and Restoring State
    • 15.5 Delegating Rendering to a Renderer
      • 15.5.1 Creating the Renderer Class
      • 15.5.2 Identifying the Renderer Type
    • 15.6 Implementing an Event Listener
      • 15.6.1 Implementing Value-Change Listeners
      • 15.6.2 Implementing Action Listeners
    • 15.7 Handling Events for Custom Components
    • 15.8 Defining the Custom Component Tag in a Tag Library Descriptor
    • 15.9 Using a Custom Component
    • 15.10 Creating and Using a Custom Converter
      • 15.10.1 Creating a Custom Converter
      • 15.10.2 Using a Custom Converter
    • 15.11 Creating and Using a Custom Validator
      • 15.11.1 Implementing the Validator Interface
      • 15.11.2 Specifying a Custom Tag
      • 15.11.3 Using a Custom Validator
    • 15.12 Binding Component Values and Instances to Managed Bean Properties
      • 15.12.1 Binding a Component Value to a Property
      • 15.12.2 Binding a Component Value to an Implicit Object
      • 15.12.3 Binding a Component Instance to a Bean Property
    • 15.13 Binding Converters, Listeners, and Validators to Managed Bean Properties
  • 16 Configuring JavaServer Faces Applications
    • 16.1 Using Annotations to Configure Managed Beans
      • 16.1.1 Using Managed Bean Scopes
    • 16.2 Application Configuration Resource File
      • 16.2.1 Configuring Eager Application-Scoped Managed Beans
      • 16.2.2 Ordering of Application Configuration Resource Files
    • 16.3 Using Faces Flows
      • 16.3.1 Packaging Flows in an Application
      • 16.3.2 The Simplest Possible Flow: The simple-flow Example Application
        • 16.3.2.1 To Build, Package, and Deploy the simple-flow Example Using NetBeans IDE
        • 16.3.2.2 To Build, Package, and Deploy the simple-flow Example Using Maven
        • 16.3.2.3 To Run the simple-flow Example
      • 16.3.3 The checkout-module Example Application
        • 16.3.3.1 The Facelets Pages for the checkout-module Example
        • 16.3.3.2 Using a Configuration File to Configure a Flow
        • 16.3.3.3 Using a Java Class to Configure a Flow
        • 16.3.3.4 The Flow-Scoped Managed Beans
        • 16.3.3.5 To Build, Package, and Deploy the checkout-module Example Using NetBeans IDE
        • 16.3.3.6 To Build, Package, and Deploy the checkout-module Example Using Maven
        • 16.3.3.7 To Run the checkout-module Example
    • 16.4 Configuring Managed Beans
      • 16.4.1 Using the managed-bean Element
      • 16.4.2 Initializing Properties Using the managed-property Element
        • 16.4.2.1 Referencing a Java Enum Type
        • 16.4.2.2 Referencing a Context Initialization Parameter
        • 16.4.2.3 Initializing Map Properties
        • 16.4.2.4 Initializing Array and List Properties
        • 16.4.2.5 Initializing Managed Bean Properties
      • 16.4.3 Initializing Maps and Lists
    • 16.5 Registering Application Messages
      • 16.5.1 Using FacesMessage to Create a Message
      • 16.5.2 Referencing Error Messages
    • 16.6 Using Default Validators
    • 16.7 Registering a Custom Validator
    • 16.8 Registering a Custom Converter
    • 16.9 Configuring Navigation Rules
    • 16.10 Registering a Custom Renderer with a Render Kit
    • 16.11 Registering a Custom Component
    • 16.12 Basic Requirements of a JavaServer Faces Application
      • 16.12.1 Configuring an Application with a Web Deployment Descriptor
        • 16.12.1.1 Identifying the Servlet for Lifecycle Processing
        • 16.12.1.2 To Specify a Path to an Application Configuration Resource File
        • 16.12.1.3 To Specify Where State Is Saved
      • 16.12.2 Configuring Project Stage
      • 16.12.3 Including the Classes, Pages, and Other Resources
  • 17 Java Servlet Technology
    • 17.1 What Is a Servlet?
    • 17.2 Servlet Lifecycle
      • 17.2.1 Handling Servlet Lifecycle Events
        • 17.2.1.1 Defining the Listener Class
      • 17.2.2 Handling Servlet Errors
    • 17.3 Sharing Information
      • 17.3.1 Using Scope Objects
      • 17.3.2 Controlling Concurrent Access to Shared Resources
    • 17.4 Creating and Initializing a Servlet
    • 17.5 Writing Service Methods
      • 17.5.1 Getting Information from Requests
      • 17.5.2 Constructing Responses
    • 17.6 Filtering Requests and Responses
      • 17.6.1 Programming Filters
      • 17.6.2 Programming Customized Requests and Responses
      • 17.6.3 Specifying Filter Mappings
        • 17.6.3.1 To Specify Filter Mappings Using NetBeans IDE
    • 17.7 Invoking Other Web Resources
      • 17.7.1 Including Other Resources in the Response
      • 17.7.2 Transferring Control to Another Web Component
    • 17.8 Accessing the Web Context
    • 17.9 Maintaining Client State
      • 17.9.1 Accessing a Session
      • 17.9.2 Associating Objects with a Session
      • 17.9.3 Session Management
        • 17.9.3.1 To Set the Timeout Period Using NetBeans IDE
      • 17.9.4 Session Tracking
    • 17.10 Finalizing a Servlet
      • 17.10.1 Tracking Service Requests
      • 17.10.2 Notifying Methods to Shut Down
      • 17.10.3 Creating Polite Long-Running Methods
    • 17.11 Uploading Files with Java Servlet Technology
      • 17.11.1 The @MultipartConfig Annotation
      • 17.11.2 The getParts and getPart Methods
    • 17.12 Asynchronous Processing
      • 17.12.1 Asynchronous Processing in Servlets
      • 17.12.2 Waiting for a Resource
    • 17.13 Nonblocking I/O
      • 17.13.1 Reading a Large HTTP POST Request Using Nonblocking I/O
    • 17.14 Protocol Upgrade Processing
    • 17.15 The mood Example Application
      • 17.15.1 Components of the mood Example Application
      • 17.15.2 Running the mood Example
        • 17.15.2.1 To Run the mood Example Using NetBeans IDE
        • 17.15.2.2 To Run the mood Example Using Maven
    • 17.16 The fileupload Example Application
      • 17.16.1 Architecture of the fileupload Example Application
      • 17.16.2 Running the fileupload Example
        • 17.16.2.1 To Build, Package, and Deploy the fileupload Example Using NetBeans IDE
        • 17.16.2.2 To Build, Package, and Deploy the fileupload Example Using Maven
        • 17.16.2.3 To Run the fileupload Example
    • 17.17 The dukeetf Example Application
      • 17.17.1 Architecture of the dukeetf Example Application
        • 17.17.1.1 The Servlet
        • 17.17.1.2 The Enterprise Bean
        • 17.17.1.3 The HTML Page
      • 17.17.2 Running the dukeetf Example Application
        • 17.17.2.1 To Run the dukeetf Example Application Using NetBeans IDE
        • 17.17.2.2 To Run the dukeetf Example Application Using Maven
    • 17.18 Further Information about Java Servlet Technology
  • 18 Java API for WebSocket
    • 18.1 Introduction to WebSocket
    • 18.2 Creating WebSocket Applications in the Java EE Platform
    • 18.3 Programmatic Endpoints
    • 18.4 Annotated Endpoints
    • 18.5 Sending and Receiving Messages
      • 18.5.1 Sending Messages
        • 18.5.1.1 Sending Messages to All Peers Connected to an Endpoint
      • 18.5.2 Receiving Messages
    • 18.6 Maintaining Client State
    • 18.7 Using Encoders and Decoders
      • 18.7.1 Implementing Encoders to Convert Java Objects into WebSocket Messages
      • 18.7.2 Implementing Decoders to Convert WebSocket Messages into Java Objects
    • 18.8 Path Parameters
    • 18.9 Handling Errors
    • 18.10 Specifying an Endpoint Configurator Class
    • 18.11 The dukeetf2 Example Application
      • 18.11.1 Architecture of the dukeetf2 Sample Application
        • 18.11.1.1 The Endpoint
        • 18.11.1.2 The Enterprise Bean
        • 18.11.1.3 The HTML Page
      • 18.11.2 Running the dukeetf2 Example Application
        • 18.11.2.1 To Run the dukeetf2 Example Application Using NetBeans IDE
        • 18.11.2.2 To Run the dukeetf2 Example Application Using Maven
    • 18.12 The websocketbot Example Application
      • 18.12.1 Architecture of the websocketbot Example Application
        • 18.12.1.1 The CDI Bean
        • 18.12.1.2 The WebSocket Endpoint
        • 18.12.1.3 The Application Messages
        • 18.12.1.4 The Encoder Classes
        • 18.12.1.5 The Message Decoder
        • 18.12.1.6 The HTML Page
      • 18.12.2 Running the websocketbot Example Application
        • 18.12.2.1 To Run the websocketbot Example Application Using NetBeans IDE
        • 18.12.2.2 To Run the websocketbot Example Application Using Maven
        • 18.12.2.3 To Test the websocketbot Example Application
    • 18.13 Further Information about WebSocket
  • 19 JSON Processing
    • 19.1 Introduction to JSON
      • 19.1.1 JSON Syntax
      • 19.1.2 Uses of JSON
      • 19.1.3 Generating and Parsing JSON Data
    • 19.2 JSON Processing in the Java EE Platform
    • 19.3 Using the Object Model API
      • 19.3.1 Creating an Object Model from JSON Data
      • 19.3.2 Creating an Object Model from Application Code
      • 19.3.3 Navigating an Object Model
      • 19.3.4 Writing an Object Model to a Stream
    • 19.4 Using the Streaming API
      • 19.4.1 Reading JSON Data Using a Parser
      • 19.4.2 Writing JSON Data Using a Generator
    • 19.5 JSON in Java EE RESTful Web Services
    • 19.6 The jsonpmodel Example Application
      • 19.6.1 Components of the jsonpmodel Example Application
      • 19.6.2 Running the jsonpmodel Example Application
        • 19.6.2.1 To Run the jsonpmodel Example Application Using NetBeans IDE
        • 19.6.2.2 To Run the jsonpmodel Example Application Using Maven
    • 19.7 The jsonpstreaming Example Application
      • 19.7.1 Components of the jsonpstreaming Example Application
      • 19.7.2 Running the jsonpstreaming Example Application
        • 19.7.2.1 To Run the jsonpstreaming Example Application Using NetBeans IDE
        • 19.7.2.2 To Run the jsonpstreaming Example Application Using Maven
    • 19.8 Further Information about the Java API for JSON Processing
  • 20 Internationalizing and Localizing Web Applications
    • 20.1 Java Platform Localization Classes
    • 20.2 Providing Localized Messages and Labels
      • 20.2.1 Establishing the Locale
      • 20.2.2 Setting the Resource Bundle
      • 20.2.3 Retrieving Localized Messages
    • 20.3 Date and Number Formatting
    • 20.4 Character Sets and Encodings
      • 20.4.1 Character Sets
      • 20.4.2 Character Encoding
  • Part IV Bean Validation
  • 21 Introduction to Bean Validation
    • 21.1 Using Bean Validation Constraints
    • 21.2 Validating Null and Empty Strings
    • 21.3 Validating Constructors and Methods
      • 21.3.1 Cross-Parameter Constraints
      • 21.3.2 Identifying Parameter Constraint Violations
      • 21.3.3 Adding Constraints to Method Return Values
    • 21.4 Further Information about Bean Validation
  • 22 Bean Validation: Advanced Topics
    • 22.1 Creating Custom Constraints
      • 22.1.1 Using the Built-In Constraints to Make a New Constraint
      • 22.1.2 Removing Ambiguity in Constraint Targets
    • 22.2 Customizing Validator Messages
      • 22.2.1 The ValidationMessages Resource Bundle
        • 22.2.1.1 Localizing Validation Messages
    • 22.3 Grouping Constraints
      • 22.3.1 Customizing Group Validation Order
    • 22.4 Using Method Constraints in Type Hierarchies
      • 22.4.1 Rules for Using Method Constraints in Type Hierarchies
  • Part V Contexts and Dependency Injection for Java EE
  • 23 Introduction to Contexts and Dependency Injection for Java EE
    • 23.1 Getting Started
    • 23.2 Overview of CDI
    • 23.3 About Beans
    • 23.4 About CDI Managed Beans
    • 23.5 Beans as Injectable Objects
    • 23.6 Using Qualifiers
    • 23.7 Injecting Beans
    • 23.8 Using Scopes
    • 23.9 Giving Beans EL Names
    • 23.10 Adding Setter and Getter Methods
    • 23.11 Using a Managed Bean in a Facelets Page
    • 23.12 Injecting Objects by Using Producer Methods
    • 23.13 Configuring a CDI Application
    • 23.14 Using the @PostConstruct and @PreDestroy Annotations with CDI Managed Bean Classes
      • 23.14.1 To Initialize a Managed Bean Using the @PostConstruct Annotation
      • 23.14.2 To Prepare for the Destruction of a Managed Bean Using the @PreDestroy Annotation
    • 23.15 Further Information about CDI
  • 24 Running the Basic Contexts and Dependency Injection Examples
    • 24.1 The simplegreeting CDI Example
      • 24.1.1 The simplegreeting Source Files
      • 24.1.2 The Facelets Template and Page
      • 24.1.3 Running the simplegreeting Example
        • 24.1.3.1 To Build, Package, and Run the simplegreeting Example Using NetBeans IDE
        • 24.1.3.2 To Build, Package, and Deploy the simplegreeting Example Using Maven
        • 24.1.3.3 To Run the simplegreeting Example
    • 24.2 The guessnumber-cdi CDI Example
      • 24.2.1 The guessnumber-cdi Source Files
        • 24.2.1.1 The @MaxNumber and @Random Qualifier Interfaces
        • 24.2.1.2 The Generator Managed Bean
        • 24.2.1.3 The UserNumberBean Managed Bean
      • 24.2.2 The Facelets Page
      • 24.2.3 Running the guessnumber-cdi Example
        • 24.2.3.1 To Build, Package, and Deploy the guessnumber-cdi Example Using NetBeans IDE
        • 24.2.3.2 To Build, Package, and Deploy the guessnumber-cdi Example Using Maven
        • 24.2.3.3 To Run the guessnumber Example
  • 25 Contexts and Dependency Injection for Java EE: Advanced Topics
    • 25.1 Packaging CDI Applications
    • 25.2 Using Alternatives in CDI Applications
      • 25.2.1 Using Specialization
    • 25.3 Using Producer Methods, Producer Fields, and Disposer Methods in CDI Applications
      • 25.3.1 Using Producer Methods
      • 25.3.2 Using Producer Fields to Generate Resources
      • 25.3.3 Using a Disposer Method
    • 25.4 Using Predefined Beans in CDI Applications
    • 25.5 Using Events in CDI Applications
      • 25.5.1 Defining Events
      • 25.5.2 Using Observer Methods to Handle Events
      • 25.5.3 Firing Events
    • 25.6 Using Interceptors in CDI Applications
    • 25.7 Using Decorators in CDI Applications
    • 25.8 Using Stereotypes in CDI Applications
  • 26 Running the Advanced Contexts and Dependency Injection Examples
    • 26.1 The encoder Example: Using Alternatives
      • 26.1.1 The Coder Interface and Implementations
      • 26.1.2 The encoder Facelets Page and Managed Bean
      • 26.1.3 Running the encoder Example
        • 26.1.3.1 To Build, Package, and Deploy the encoder Example Using NetBeans IDE
        • 26.1.3.2 To Run the encoder Example Using NetBeans IDE
        • 26.1.3.3 To Build, Package, and Deploy the encoder Example Using Maven
        • 26.1.3.4 To Run the encoder Example Using Maven
    • 26.2 The producermethods Example: Using a Producer Method to Choose a Bean Implementation
      • 26.2.1 Components of the producermethods Example
      • 26.2.2 Running the producermethods Example
        • 26.2.2.1 To Build, Package, and Deploy the producermethods Example Using NetBeans IDE
        • 26.2.2.2 To Build, Package, and Deploy the producermethods Example Using Maven
        • 26.2.2.3 To Run the producermethods Example
    • 26.3 The producerfields Example: Using Producer Fields to Generate Resources
      • 26.3.1 The Producer Field for the producerfields Example
      • 26.3.2 The producerfields Entity and Session Bean
      • 26.3.3 The producerfields Facelets Pages and Managed Bean
      • 26.3.4 Running the producerfields Example
        • 26.3.4.1 To Build, Package, and Deploy the producerfields Example Using NetBeans IDE
        • 26.3.4.2 To Build, Package, and Deploy the producerfields Example Using Maven
        • 26.3.4.3 To Run the producerfields Example
    • 26.4 The billpayment Example: Using Events and Interceptors
      • 26.4.1 The PaymentEvent Event Class
      • 26.4.2 The PaymentHandler Event Listener
      • 26.4.3 The billpayment Facelets Pages and Managed Bean
      • 26.4.4 The LoggedInterceptor Interceptor Class
      • 26.4.5 Running the billpayment Example
        • 26.4.5.1 To Build, Package, and Deploy the billpayment Example Using NetBeans IDE
        • 26.4.5.2 To Build, Package, and Deploy the billpayment Example Using Maven
        • 26.4.5.3 To Run the billpayment Example
    • 26.5 The decorators Example: Decorating a Bean
      • 26.5.1 Components of the decorators Example
      • 26.5.2 Running the decorators Example
        • 26.5.2.1 To Build, Package, and Deploy the decorators Example Using NetBeans IDE
        • 26.5.2.2 To Build, Package, and Deploy the decorators Example Using Maven
        • 26.5.2.3 To Run the decorators Example
  • Part VI Web Services
  • 27 Introduction to Web Services
    • 27.1 What Are Web Services?
    • 27.2 Types of Web Services
      • 27.2.1 "Big" Web Services
      • 27.2.2 RESTful Web Services
    • 27.3 Deciding Which Type of Web Service to Use
  • 28 Building Web Services with JAX-WS
    • 28.1 Creating a Simple Web Service and Clients with JAX-WS
      • 28.1.1 Requirements of a JAX-WS Endpoint
      • 28.1.2 Coding the Service Endpoint Implementation Class
      • 28.1.3 Building, Packaging, and Deploying the Service
        • 28.1.3.1 To Build, Package, and Deploy the Service Using NetBeans IDE
        • 28.1.3.2 To Build, Package, and Deploy the Service Using Maven
      • 28.1.4 Testing the Methods of a Web Service Endpoint
        • 28.1.4.1 To Test the Service without a Client
      • 28.1.5 A Simple JAX-WS Application Client
        • 28.1.5.1 Coding the Application Client
        • 28.1.5.2 Running the Application Client
      • 28.1.6 A Simple JAX-WS Web Client
        • 28.1.6.1 Coding the Servlet
        • 28.1.6.2 Running the Web Client
    • 28.2 Types Supported by JAX-WS
      • 28.2.1 Schema-to-Java Mapping
      • 28.2.2 Java-to-Schema Mapping
    • 28.3 Web Services Interoperability and JAX-WS
    • 28.4 Further Information about JAX-WS
  • 29 Building RESTful Web Services with JAX-RS
    • 29.1 What Are RESTful Web Services?
    • 29.2 Creating a RESTful Root Resource Class
      • 29.2.1 Developing RESTful Web Services with JAX-RS
      • 29.2.2 Overview of a JAX-RS Application
      • 29.2.3 The @Path Annotation and URI Path Templates
      • 29.2.4 Responding to HTTP Methods and Requests
        • 29.2.4.1 The Request Method Designator Annotations
        • 29.2.4.2 Using Entity Providers to Map HTTP Response and Request Entity Bodies
      • 29.2.5 Using @Consumes and @Produces to Customize Requests and Responses
        • 29.2.5.1 The @Produces Annotation
        • 29.2.5.2 The @Consumes Annotation
      • 29.2.6 Extracting Request Parameters
      • 29.2.7 Configuring JAX-RS Applications
        • 29.2.7.1 Configuring a JAX-RS Application Using a Subclass of Application
        • 29.2.7.2 Configuring the Base URI in web.xml
    • 29.3 Example Applications for JAX-RS
      • 29.3.1 Creating a Simple RESTful Web Service
        • 29.3.1.1 To Create a RESTful Web Service Using NetBeans IDE
      • 29.3.2 The rsvp Example Application
        • 29.3.2.1 Components of the rsvp Example Application
        • 29.3.2.2 Running the rsvp Example Application
      • 29.3.3 Real-World Examples
    • 29.4 Further Information about JAX-RS
  • 30 Accessing REST Resources with the JAX-RS Client API
    • 30.1 Overview of the Client API
      • 30.1.1 Creating a Basic Client Request Using the Client API
        • 30.1.1.1 Obtaining the Client Instance
        • 30.1.1.2 Setting the Client Target
        • 30.1.1.3 Setting Path Parameters in Targets
        • 30.1.1.4 Invoking the Request
    • 30.2 Using the Client API in the JAX-RS Example Applications
      • 30.2.1 The Client API in the rsvp Example Application
      • 30.2.2 The Client API in the customer Example Application
    • 30.3 Advanced Features of the Client API
      • 30.3.1 Configuring the Client Request
        • 30.3.1.1 Setting Message Headers in the Client Request
        • 30.3.1.2 Setting Cookies in the Client Request
        • 30.3.1.3 Adding Filters to the Client
      • 30.3.2 Asynchronous Invocations in the Client API
        • 30.3.2.1 Using Custom Callbacks in Asynchronous Invocations
  • 31 JAX-RS: Advanced Topics and an Example
    • 31.1 Annotations for Field and Bean Properties of Resource Classes
      • 31.1.1 Extracting Path Parameters
      • 31.1.2 Extracting Query Parameters
      • 31.1.3 Extracting Form Data
      • 31.1.4 Extracting the Java Type of a Request or Response
    • 31.2 Validating Resource Data with Bean Validation
      • 31.2.1 Using Constraint Annotations on Resource Methods
      • 31.2.2 Validating Entity Data
      • 31.2.3 Validation Exception Handling and Response Codes
    • 31.3 Subresources and Runtime Resource Resolution
      • 31.3.1 Subresource Methods
      • 31.3.2 Subresource Locators
    • 31.4 Integrating JAX-RS with EJB Technology and CDI
    • 31.5 Conditional HTTP Requests
    • 31.6 Runtime Content Negotiation
    • 31.7 Using JAX-RS with JAXB
      • 31.7.1 Using Java Objects to Model Your Data
      • 31.7.2 Starting from an Existing XML Schema Definition
      • 31.7.3 Using JSON with JAX-RS and JAXB
    • 31.8 The customer Example Application
      • 31.8.1 Overview of the customer Example Application
      • 31.8.2 The Customer and Address Entity Classes
      • 31.8.3 The CustomerService Class
      • 31.8.4 Using the JAX-RS Client in the CustomerBean Classes
      • 31.8.5 Running the customer Example
        • 31.8.5.1 To Build, Package, and Deploy the customer Example Using NetBeans IDE
        • 31.8.5.2 To Build, Package, and Deploy the customer Example Using Maven
  • Part VII Enterprise Beans
  • 32 Enterprise Beans
    • 32.1 What Is an Enterprise Bean?
      • 32.1.1 Benefits of Enterprise Beans
      • 32.1.2 When to Use Enterprise Beans
      • 32.1.3 Types of Enterprise Beans
    • 32.2 What Is a Session Bean?
      • 32.2.1 Types of Session Beans
        • 32.2.1.1 Stateful Session Beans
        • 32.2.1.2 Stateless Session Beans
        • 32.2.1.3 Singleton Session Beans
      • 32.2.2 When to Use Session Beans
    • 32.3 What Is a Message-Driven Bean?
      • 32.3.1 What Makes Message-Driven Beans Different from Session Beans?
      • 32.3.2 When to Use Message-Driven Beans
    • 32.4 Accessing Enterprise Beans
      • 32.4.1 Using Enterprise Beans in Clients
        • 32.4.1.1 Portable JNDI Syntax
      • 32.4.2 Deciding on Remote or Local Access
      • 32.4.3 Local Clients
        • 32.4.3.1 Accessing Local Enterprise Beans Using the No-Interface View
        • 32.4.3.2 Accessing Local Enterprise Beans That Implement Business Interfaces
      • 32.4.4 Remote Clients
      • 32.4.5 Web Service Clients
      • 32.4.6 Method Parameters and Access
        • 32.4.6.1 Isolation
        • 32.4.6.2 Granularity of Accessed Data
    • 32.5 The Contents of an Enterprise Bean
    • 32.6 Naming Conventions for Enterprise Beans
    • 32.7 The Lifecycles of Enterprise Beans
      • 32.7.1 The Lifecycle of a Stateful Session Bean
      • 32.7.2 The Lifecycle of a Stateless Session Bean
      • 32.7.3 The Lifecycle of a Singleton Session Bean
      • 32.7.4 The Lifecycle of a Message-Driven Bean
    • 32.8 Further Information about Enterprise Beans
  • 33 Getting Started with Enterprise Beans
    • 33.1 Creating the Enterprise Bean
      • 33.1.1 Coding the Enterprise Bean Class
      • 33.1.2 Creating the converter Web Client
      • 33.1.3 Running the converter Example
        • 33.1.3.1 To Run the converter Example Using NetBeans IDE
        • 33.1.3.2 To Run the converter Example Using Maven
    • 33.2 Modifying the Java EE Application
      • 33.2.1 To Modify a Class File
  • 34 Running the Enterprise Bean Examples
    • 34.1 The cart Example
      • 34.1.1 The Business Interface
      • 34.1.2 Session Bean Class
        • 34.1.2.1 Lifecycle Callback Methods
        • 34.1.2.2 Business Methods
      • 34.1.3 The @Remove Method
      • 34.1.4 Helper Classes
      • 34.1.5 Running the cart Example
        • 34.1.5.1 To Run the cart Example Using NetBeans IDE
        • 34.1.5.2 To Run the cart Example Using Maven
    • 34.2 A Singleton Session Bean Example: counter
      • 34.2.1 Creating a Singleton Session Bean
        • 34.2.1.1 Initializing Singleton Session Beans
        • 34.2.1.2 Managing Concurrent Access in a Singleton Session Bean
        • 34.2.1.3 Handling Errors in a Singleton Session Bean
      • 34.2.2 The Architecture of the counter Example
      • 34.2.3 Running the counter Example
        • 34.2.3.1 To Run the counter Example Using NetBeans IDE
        • 34.2.3.2 To Run the counter Example Using Maven
    • 34.3 A Web Service Example: helloservice
      • 34.3.1 The Web Service Endpoint Implementation Class
      • 34.3.2 Stateless Session Bean Implementation Class
      • 34.3.3 Running the helloservice Example
        • 34.3.3.1 To Build, Package, and Deploy the helloservice Example Using NetBeans IDE
        • 34.3.3.2 To Build, Package, and Deploy the helloservice Example Using Maven
        • 34.3.3.3 To Test the Service without a Client
    • 34.4 Using the Timer Service
      • 34.4.1 Creating Calendar-Based Timer Expressions
        • 34.4.1.1 Specifying Multiple Values in Calendar Expressions
      • 34.4.2 Programmatic Timers
        • 34.4.2.1 The @Timeout Method
        • 34.4.2.2 Creating Programmatic Timers
      • 34.4.3 Automatic Timers
      • 34.4.4 Canceling and Saving Timers
      • 34.4.5 Getting Timer Information
      • 34.4.6 Transactions and Timers
      • 34.4.7 The timersession Example
      • 34.4.8 Running the timersession Example
        • 34.4.8.1 To Run the timersession Example Using NetBeans IDE
        • 34.4.8.2 To Build, Package, and Deploy the timersession Example Using Maven
        • 34.4.8.3 To Run the Web Client
    • 34.5 Handling Exceptions
  • 35 Using the Embedded Enterprise Bean Container
    • 35.1 Overview of the Embedded Enterprise Bean Container
    • 35.2 Developing Embeddable Enterprise Bean Applications
      • 35.2.1 Running Embedded Applications
      • 35.2.2 Creating the Enterprise Bean Container
        • 35.2.2.1 Explicitly Specifying Enterprise Bean Modules to Be Initialized
      • 35.2.3 Looking Up Session Bean References
      • 35.2.4 Shutting Down the Enterprise Bean Container
    • 35.3 The standalone Example Application
      • 35.3.1 To Run the standalone Example Application Using NetBeans IDE
      • 35.3.2 To Run the standalone Example Application Using Maven
  • 36 Using Asynchronous Method Invocation in Session Beans
    • 36.1 Asynchronous Method Invocation
      • 36.1.1 Creating an Asynchronous Business Method
      • 36.1.2 Calling Asynchronous Methods from Enterprise Bean Clients
        • 36.1.2.1 Retrieving the Final Result from an Asynchronous Method Invocation
        • 36.1.2.2 Cancelling an Asynchronous Method Invocation
        • 36.1.2.3 Checking the Status of an Asynchronous Method Invocation
    • 36.2 The async Example Application
      • 36.2.1 Architecture of the async-war Module
      • 36.2.2 Running the async Example
        • 36.2.2.1 To Run the async Example Application Using NetBeans IDE
        • 36.2.2.2 To Run the async Example Application Using Maven
  • Part VIII Persistence
  • 37 Introduction to the Java Persistence API
    • 37.1 Entities
      • 37.1.1 Requirements for Entity Classes
      • 37.1.2 Persistent Fields and Properties in Entity Classes
        • 37.1.2.1 Persistent Fields
        • 37.1.2.2 Persistent Properties
        • 37.1.2.3 Using Collections in Entity Fields and Properties
        • 37.1.2.4 Validating Persistent Fields and Properties
      • 37.1.3 Primary Keys in Entities
      • 37.1.4 Multiplicity in Entity Relationships
      • 37.1.5 Direction in Entity Relationships
        • 37.1.5.1 Bidirectional Relationships
        • 37.1.5.2 Unidirectional Relationships
        • 37.1.5.3 Queries and Relationship Direction
        • 37.1.5.4 Cascade Operations and Relationships
        • 37.1.5.5 Orphan Removal in Relationships
      • 37.1.6 Embeddable Classes in Entities
    • 37.2 Entity Inheritance
      • 37.2.1 Abstract Entities
      • 37.2.2 Mapped Superclasses
      • 37.2.3 Non-Entity Superclasses
      • 37.2.4 Entity Inheritance Mapping Strategies
        • 37.2.4.1 The Single Table per Class Hierarchy Strategy
        • 37.2.4.2 The Table per Concrete Class Strategy
        • 37.2.4.3 The Joined Subclass Strategy
    • 37.3 Managing Entities
      • 37.3.1 The EntityManager Interface
        • 37.3.1.1 Container-Managed Entity Managers
        • 37.3.1.2 Application-Managed Entity Managers
        • 37.3.1.3 Finding Entities Using the EntityManager
        • 37.3.1.4 Managing an Entity Instance's Lifecycle
        • 37.3.1.5 Persisting Entity Instances
        • 37.3.1.6 Removing Entity Instances
        • 37.3.1.7 Synchronizing Entity Data to the Database
      • 37.3.2 Persistence Units
    • 37.4 Querying Entities
    • 37.5 Database Schema Creation
      • 37.5.1 Configuring an Application to Create or Drop Database Tables
      • 37.5.2 Loading Data Using SQL Scripts
    • 37.6 Further Information about Persistence
  • 38 Running the Persistence Examples
    • 38.1 The order Application
      • 38.1.1 Entity Relationships in the order Application
        • 38.1.1.1 Self-Referential Relationships
        • 38.1.1.2 One-to-One Relationships
        • 38.1.1.3 One-to-Many Relationship Mapped to Overlapping Primary and Foreign Keys
        • 38.1.1.4 Unidirectional Relationships
      • 38.1.2 Primary Keys in the order Application
        • 38.1.2.1 Generated Primary Keys
        • 38.1.2.2 Compound Primary Keys
      • 38.1.3 Entity Mapped to More Than One Database Table
      • 38.1.4 Cascade Operations in the order Application
      • 38.1.5 BLOB and CLOB Database Types in the order Application
      • 38.1.6 Temporal Types in the order Application
      • 38.1.7 Managing the order Application's Entities
        • 38.1.7.1 Creating Entities
        • 38.1.7.2 Finding Entities
        • 38.1.7.3 Setting Entity Relationships
        • 38.1.7.4 Using Queries
        • 38.1.7.5 Removing Entities
      • 38.1.8 Running the order Example
        • 38.1.8.1 To Run the order Example Using NetBeans IDE
        • 38.1.8.2 To Run the order Example Using Maven
    • 38.2 The roster Application
      • 38.2.1 Relationships in the roster Application
        • 38.2.1.1 The Many-To-Many Relationship in roster
      • 38.2.2 Entity Inheritance in the roster Application
      • 38.2.3 Criteria Queries in the roster Application
        • 38.2.3.1 Metamodel Classes in the roster Application
        • 38.2.3.2 Obtaining a CriteriaBuilder Instance in RequestBean
        • 38.2.3.3 Creating Criteria Queries in RequestBean's Business Methods
      • 38.2.4 Automatic Table Generation in the roster Application
      • 38.2.5 Running the roster Example
        • 38.2.5.1 To Run the roster Example Using NetBeans IDE
        • 38.2.5.2 To Run the roster Example Using Maven
    • 38.3 The address-book Application
      • 38.3.1 Bean Validation Constraints in address-book
      • 38.3.2 Specifying Error Messages for Constraints in address-book
      • 38.3.3 Validating Contact Input from a JavaServer Faces Application
      • 38.3.4 Running the address-book Example
        • 38.3.4.1 To Run the address-book Example Using NetBeans IDE
        • 38.3.4.2 To Run the address-book Example Using Maven
  • 39 The Java Persistence Query Language
    • 39.1 Query Language Terminology
    • 39.2 Creating Queries Using the Java Persistence Query Language
      • 39.2.1 Named Parameters in Queries
      • 39.2.2 Positional Parameters in Queries
    • 39.3 Simplified Query Language Syntax
      • 39.3.1 Select Statements
      • 39.3.2 Update and Delete Statements
    • 39.4 Example Queries
      • 39.4.1 Simple Queries
        • 39.4.1.1 A Basic Select Query
        • 39.4.1.2 Eliminating Duplicate Values
        • 39.4.1.3 Using Named Parameters
      • 39.4.2 Queries That Navigate to Related Entities
        • 39.4.2.1 A Simple Query with Relationships
        • 39.4.2.2 Navigating to Single-Valued Relationship Fields
        • 39.4.2.3 Traversing Relationships with an Input Parameter
        • 39.4.2.4 Traversing Multiple Relationships
        • 39.4.2.5 Navigating According to Related Fields
      • 39.4.3 Queries with Other Conditional Expressions
        • 39.4.3.1 The LIKE Expression
        • 39.4.3.2 The IS NULL Expression
        • 39.4.3.3 The IS EMPTY Expression
        • 39.4.3.4 The BETWEEN Expression
        • 39.4.3.5 Comparison Operators
      • 39.4.4 Bulk Updates and Deletes
        • 39.4.4.1 Update Queries
        • 39.4.4.2 Delete Queries
    • 39.5 Full Query Language Syntax
      • 39.5.1 BNF Symbols
      • 39.5.2 BNF Grammar of the Java Persistence Query Language
      • 39.5.3 FROM Clause
        • 39.5.3.1 Identifiers
        • 39.5.3.2 Identification Variables
        • 39.5.3.3 Range Variable Declarations
        • 39.5.3.4 Collection Member Declarations
        • 39.5.3.5 Joins
      • 39.5.4 Path Expressions
        • 39.5.4.1 Examples of Path Expressions
        • 39.5.4.2 Expression Types
        • 39.5.4.3 Navigation
      • 39.5.5 WHERE Clause
        • 39.5.5.1 Literals
        • 39.5.5.2 Input Parameters
        • 39.5.5.3 Conditional Expressions
        • 39.5.5.4 Operators and Their Precedence
        • 39.5.5.5 BETWEEN Expressions
        • 39.5.5.6 IN Expressions
        • 39.5.5.7 LIKE Expressions
        • 39.5.5.8 NULL Comparison Expressions
        • 39.5.5.9 Empty Collection Comparison Expressions
        • 39.5.5.10 Collection Member Expressions
        • 39.5.5.11 Subqueries
        • 39.5.5.12 Functional Expressions
        • 39.5.5.13 Case Expressions
        • 39.5.5.14 NULL Values
        • 39.5.5.15 Equality Semantics
      • 39.5.6 SELECT Clause
        • 39.5.6.1 Return Types
        • 39.5.6.2 The DISTINCT Keyword
        • 39.5.6.3 Constructor Expressions
      • 39.5.7 ORDER BY Clause
      • 39.5.8 GROUP BY and HAVING Clauses
  • 40 Using the Criteria API to Create Queries
    • 40.1 Overview of the Criteria and Metamodel APIs
    • 40.2 Using the Metamodel API to Model Entity Classes
      • 40.2.1 Using Metamodel Classes
    • 40.3 Using the Criteria API and Metamodel API to Create Basic Typesafe Queries
      • 40.3.1 Creating a Criteria Query
      • 40.3.2 Query Roots
      • 40.3.3 Querying Relationships Using Joins
      • 40.3.4 Path Navigation in Criteria Queries
      • 40.3.5 Restricting Criteria Query Results
        • 40.3.5.1 The Expression Interface Methods
        • 40.3.5.2 Expression Methods in the CriteriaBuilder Interface
      • 40.3.6 Managing Criteria Query Results
        • 40.3.6.1 Ordering Results
        • 40.3.6.2 Grouping Results
      • 40.3.7 Executing Queries
        • 40.3.7.1 Single-Valued Query Results
        • 40.3.7.2 Collection-Valued Query Results
  • 41 Creating and Using String-Based Criteria Queries
    • 41.1 Overview of String-Based Criteria API Queries
    • 41.2 Creating String-Based Queries
    • 41.3 Executing String-Based Queries
  • 42 Controlling Concurrent Access to Entity Data with Locking
    • 42.1 Overview of Entity Locking and Concurrency
      • 42.1.1 Using Optimistic Locking
    • 42.2 Lock Modes
      • 42.2.1 Setting the Lock Mode
      • 42.2.2 Using Pessimistic Locking
        • 42.2.2.1 Pessimistic Locking Timeouts
  • 43 Creating Fetch Plans with Entity Graphs
    • 43.1 Entity Graph Basics
      • 43.1.1 The Default Entity Graph
      • 43.1.2 Using Entity Graphs in Persistence Operations
        • 43.1.2.1 Fetch Graphs
        • 43.1.2.2 Load Graphs
    • 43.2 Using Named Entity Graphs
      • 43.2.1 Applying Named Entity Graph Annotations to Entity Classes
      • 43.2.2 Obtaining EntityGraph Instances from Named Entity Graphs
    • 43.3 Using Entity Graphs in Query Operations
  • 44 Using a Second-Level Cache with Java Persistence API Applications
    • 44.1 Overview of the Second-Level Cache
      • 44.1.1 Controlling whether Entities May Be Cached
    • 44.2 Specifying the Cache Mode Settings to Improve Performance
      • 44.2.1 Setting the Cache Retrieval and Store Modes
        • 44.2.1.1 Cache Retrieval Mode
        • 44.2.1.2 Cache Store Mode
        • 44.2.1.3 Setting the Cache Retrieval or Store Mode
      • 44.2.2 Controlling the Second-Level Cache Programmatically
        • 44.2.2.1 Checking whether an Entity's Data Is Cached
        • 44.2.2.2 Removing an Entity from the Cache
        • 44.2.2.3 Removing All Data from the Cache
  • Part IX Messaging
  • 45 Java Message Service Concepts
    • 45.1 Overview of the JMS API
      • 45.1.1 What Is Messaging?
      • 45.1.2 What Is the JMS API?
      • 45.1.3 When Can You Use the JMS API?
      • 45.1.4 How Does the JMS API Work with the Java EE Platform?
    • 45.2 Basic JMS API Concepts
      • 45.2.1 JMS API Architecture
      • 45.2.2 Messaging Styles
        • 45.2.2.1 Point-to-Point Messaging Style
        • 45.2.2.2 Publish/Subscribe Messaging Style
      • 45.2.3 Message Consumption
    • 45.3 The JMS API Programming Model
      • 45.3.1 JMS Administered Objects
        • 45.3.1.1 JMS Connection Factories
        • 45.3.1.2 JMS Destinations
      • 45.3.2 Connections
      • 45.3.3 Sessions
      • 45.3.4 JMSContext Objects
      • 45.3.5 JMS Message Producers
      • 45.3.6 JMS Message Consumers
        • 45.3.6.1 JMS Message Listeners
        • 45.3.6.2 JMS Message Selectors
        • 45.3.6.3 Consuming Messages from Topics
        • 45.3.6.4 Creating Durable Subscriptions
        • 45.3.6.5 Creating Shared Subscriptions
      • 45.3.7 JMS Messages
        • 45.3.7.1 Message Headers
        • 45.3.7.2 Message Properties
        • 45.3.7.3 Message Bodies
      • 45.3.8 JMS Queue Browsers
      • 45.3.9 JMS Exception Handling
    • 45.4 Using Advanced JMS Features
      • 45.4.1 Controlling Message Acknowledgment
      • 45.4.2 Specifying Options for Sending Messages
        • 45.4.2.1 Specifying Message Persistence
        • 45.4.2.2 Setting Message Priority Levels
        • 45.4.2.3 Allowing Messages to Expire
        • 45.4.2.4 Specifying a Delivery Delay
        • 45.4.2.5 Using JMSProducer Method Chaining
      • 45.4.3 Creating Temporary Destinations
      • 45.4.4 Using JMS Local Transactions
      • 45.4.5 Sending Messages Asynchronously
    • 45.5 Using the JMS API in Java EE Applications
      • 45.5.1 Creating Resources for Java EE Applications
      • 45.5.2 Using Resource Injection in Enterprise Bean or Web Components
        • 45.5.2.1 Injecting a ConnectionFactory, Queue, or Topic
        • 45.5.2.2 Injecting a JMSContext Object
      • 45.5.3 Using Java EE Components to Produce and to Synchronously Receive Messages
        • 45.5.3.1 Managing JMS Resources in Web and EJB Components
        • 45.5.3.2 Managing Transactions in Session Beans
      • 45.5.4 Using Message-Driven Beans to Receive Messages Asynchronously
      • 45.5.5 Managing JTA Transactions
    • 45.6 Further Information about JMS
  • 46 Java Message Service Examples
    • 46.1 Overview of the JMS Examples
    • 46.2 Writing Simple JMS Applications
      • 46.2.1 Starting the JMS Provider
      • 46.2.2 Creating JMS Administered Objects
        • 46.2.2.1 To Create Resources for the Simple Examples
      • 46.2.3 Building All the Simple Examples
        • 46.2.3.1 To Build All the Simple Examples Using NetBeans IDE
        • 46.2.3.2 To Build All the Simple Examples Using Maven
      • 46.2.4 Sending Messages
        • 46.2.4.1 The Producer.java Client
        • 46.2.4.2 To Run the Producer Client
      • 46.2.5 Receiving Messages Synchronously
        • 46.2.5.1 The SynchConsumer.java Client
        • 46.2.5.2 To Run the SynchConsumer and Producer Clients
      • 46.2.6 Using a Message Listener for Asynchronous Message Delivery
        • 46.2.6.1 Writing the AsynchConsumer.java and TextListener.java Clients
        • 46.2.6.2 To Run the AsynchConsumer and Producer Clients
      • 46.2.7 Browsing Messages on a Queue
        • 46.2.7.1 The MessageBrowser.java Client
        • 46.2.7.2 To Run the QueueBrowser Client
      • 46.2.8 Running Multiple Consumers on the Same Destination
      • 46.2.9 Acknowledging Messages
        • 46.2.9.1 To Run the ClientAckConsumer Client
    • 46.3 Writing More Advanced JMS Applications
      • 46.3.1 Using Durable Subscriptions
        • 46.3.1.1 To Create Resources for the Durable Subscription Example
        • 46.3.1.2 To Run the Durable Subscription Example
        • 46.3.1.3 To Run the unsubscriber Example
      • 46.3.2 Using Local Transactions
        • 46.3.2.1 To Create Resources for the transactedexample Example
        • 46.3.2.2 To Run the transactedexample Clients
    • 46.4 Writing High Performance and Scalable JMS Applications
      • 46.4.1 Using Shared Nondurable Subscriptions
        • 46.4.1.1 Writing the Clients for the Shared Consumer Example
        • 46.4.1.2 To Run the SharedConsumer and Producer Clients
      • 46.4.2 Using Shared Durable Subscriptions
        • 46.4.2.1 To Run the SharedDurableConsumer and Producer Clients
    • 46.5 Sending and Receiving Messages Using a Simple Web Application
      • 46.5.1 The websimplemessage Facelets Pages
      • 46.5.2 The websimplemessage Managed Beans
      • 46.5.3 Running the websimplemessage Example
        • 46.5.3.1 Creating Resources for the websimplemessage Example
        • 46.5.3.2 To Package and Deploy websimplemessage Using NetBeans IDE
        • 46.5.3.3 To Package and Deploy websimplemessage Using Maven
        • 46.5.3.4 To Run the websimplemessage Example
    • 46.6 Receiving Messages Asynchronously Using a Message-Driven Bean
      • 46.6.1 Overview of the simplemessage Example
      • 46.6.2 The simplemessage Application Client
      • 46.6.3 The simplemessage Message-Driven Bean Class
        • 46.6.3.1 The onMessage Method
      • 46.6.4 Running the simplemessage Example
        • 46.6.4.1 Creating Resources for the simplemessage Example
        • 46.6.4.2 To Run the simplemessage Example Using NetBeans IDE
        • 46.6.4.3 To Run the simplemessage Example Using Maven
    • 46.7 Sending Messages from a Session Bean to an MDB
      • 46.7.1 Writing the Application Components for the clientsessionmdb Example
        • 46.7.1.1 Coding the Application Client: MyAppClient.java
        • 46.7.1.2 Coding the Publisher Session Bean
        • 46.7.1.3 Coding the Message-Driven Bean: MessageBean.java
      • 46.7.2 Running the clientsessionmdb Example
        • 46.7.2.1 To Run clientsessionmdb Using NetBeans IDE
        • 46.7.2.2 To Run clientsessionmdb Using Maven
    • 46.8 Using an Entity to Join Messages from Two MDBs
      • 46.8.1 Overview of the clientmdbentity Example Application
      • 46.8.2 Writing the Application Components for the clientmdbentity Example
        • 46.8.2.1 Coding the Application Client: HumanResourceClient.java
        • 46.8.2.2 Coding the Message-Driven Beans for the clientmdbentity Example
        • 46.8.2.3 Coding the Entity Class for the clientmdbentity Example
      • 46.8.3 Running the clientmdbentity Example
        • 46.8.3.1 To Run clientmdbentity Using NetBeans IDE
        • 46.8.3.2 To Run clientmdbentity Using Maven
        • 46.8.3.3 Viewing the Application Output
    • 46.9 Using NetBeans IDE to Create JMS Resources
      • 46.9.1 To Create JMS Resources Using NetBeans IDE
      • 46.9.2 To Delete JMS Resources Using NetBeans IDE
  • Part X Security
  • 47 Introduction to Security in the Java EE Platform
    • 47.1 Overview of Java EE Security
      • 47.1.1 A Simple Application Security Walkthrough
        • 47.1.1.1 Step 1: Initial Request
        • 47.1.1.2 Step 2: Initial Authentication
        • 47.1.1.3 Step 3: URL Authorization
        • 47.1.1.4 Step 4: Fulfilling the Original Request
        • 47.1.1.5 Step 5: Invoking Enterprise Bean Business Methods
      • 47.1.2 Features of a Security Mechanism
      • 47.1.3 Characteristics of Application Security
    • 47.2 Security Mechanisms
      • 47.2.1 Java SE Security Mechanisms
      • 47.2.2 Java EE Security Mechanisms
        • 47.2.2.1 Application-Layer Security
        • 47.2.2.2 Transport-Layer Security
        • 47.2.2.3 Message-Layer Security
    • 47.3 Securing Containers
      • 47.3.1 Using Annotations to Specify Security Information
      • 47.3.2 Using Deployment Descriptors for Declarative Security
      • 47.3.3 Using Programmatic Security
    • 47.4 Securing GlassFish Server
    • 47.5 Working with Realms, Users, Groups, and Roles
      • 47.5.1 What Are Realms, Users, Groups, and Roles?
        • 47.5.1.1 What Is a Realm?
        • 47.5.1.2 What Is a User?
        • 47.5.1.3 What Is a Group?
        • 47.5.1.4 What Is a Role?
        • 47.5.1.5 Some Other Terminology
      • 47.5.2 Managing Users and Groups in GlassFish Server
        • 47.5.2.1 To Add Users to GlassFish Server
      • 47.5.3 Setting Up Security Roles
      • 47.5.4 Mapping Roles to Users and Groups
    • 47.6 Establishing a Secure Connection Using SSL
      • 47.6.1 Verifying and Configuring SSL Support
    • 47.7 Further Information about Security
  • 48 Getting Started Securing Web Applications
    • 48.1 Overview of Web Application Security
    • 48.2 Securing Web Applications
      • 48.2.1 Specifying Security Constraints
        • 48.2.1.1 Specifying a Web Resource Collection
        • 48.2.1.2 Specifying an Authorization Constraint
        • 48.2.1.3 Specifying a Secure Connection
        • 48.2.1.4 Specifying Security Constraints for Resources
      • 48.2.2 Specifying Authentication Mechanisms
        • 48.2.2.1 HTTP Basic Authentication
        • 48.2.2.2 Form-Based Authentication
        • 48.2.2.3 Digest Authentication
      • 48.2.3 Specifying an Authentication Mechanism in the Deployment Descriptor
      • 48.2.4 Declaring Security Roles
    • 48.3 Using Programmatic Security with Web Applications
      • 48.3.1 Authenticating Users Programmatically
      • 48.3.2 Checking Caller Identity Programmatically
      • 48.3.3 Example Code for Programmatic Security
      • 48.3.4 Declaring and Linking Role References
    • 48.4 Examples: Securing Web Applications
      • 48.4.1 To Set Up Your System for Running the Security Examples
      • 48.4.2 The hello2-basicauth Example: Basic Authentication with a Servlet
        • 48.4.2.1 Specifying Security for Basic Authentication Using Annotations
        • 48.4.2.2 To Build, Package, and Deploy the hello2-basicauth Example Using NetBeans IDE
        • 48.4.2.3 To Build, Package, and Deploy the hello2-basicauth Example Using Maven
        • 48.4.2.4 To Run the hello2-basicauth Example
      • 48.4.3 The hello1-formauth Example: Form-Based Authentication with a JavaServer Faces Application
        • 48.4.3.1 Creating the Login Form and the Error Page
        • 48.4.3.2 Specifying Security for the Form-Based Authentication Example
        • 48.4.3.3 To Build, Package, and Deploy the hello1-formauth Example Using NetBeans IDE
        • 48.4.3.4 To Build, Package, and Deploy the hello1-formauth Example Using Maven and the asadmin Command
        • 48.4.3.5 To Run the hello1-formauth Example
  • 49 Getting Started Securing Enterprise Applications
    • 49.1 Basic Security Tasks for Enterprise Applications
    • 49.2 Securing Enterprise Beans
      • 49.2.1 Securing an Enterprise Bean Using Declarative Security
        • 49.2.1.1 Specifying Authorized Users by Declaring Security Roles
        • 49.2.1.2 Specifying an Authentication Mechanism and Secure Connection
      • 49.2.2 Securing an Enterprise Bean Programmatically
        • 49.2.2.1 Accessing an Enterprise Bean Caller's Security Context
      • 49.2.3 Propagating a Security Identity (Run-As)
        • 49.2.3.1 Configuring a Component's Propagated Security Identity
        • 49.2.3.2 Trust between Containers
      • 49.2.4 Deploying Secure Enterprise Beans
    • 49.3 Examples: Securing Enterprise Beans
      • 49.3.1 The cart-secure Example: Securing an Enterprise Bean with Declarative Security
        • 49.3.1.1 Annotating the Bean
        • 49.3.1.2 To Run the cart-secure Example Using NetBeans IDE
        • 49.3.1.3 To Run the cart-secure Example Using Maven
      • 49.3.2 The converter-secure Example: Securing an Enterprise Bean with Programmatic Security
        • 49.3.2.1 Modifying ConverterBean
        • 49.3.2.2 Modifying ConverterServlet
        • 49.3.2.3 To Run the converter-secure Example Using NetBeans IDE
        • 49.3.2.4 To Run the converter-secure Example Using Maven
        • 49.3.2.5 To Run the converter-secure Example
  • 50 Java EE Security: Advanced Topics
    • 50.1 Working with Digital Certificates
      • 50.1.1 Creating a Server Certificate
        • 50.1.1.1 To Use keytool to Create a Server Certificate
      • 50.1.2 Adding Users to the Certificate Realm
      • 50.1.3 Using a Different Server Certificate with GlassFish Server
        • 50.1.3.1 To Specify a Different Server Certificate
    • 50.2 Authentication Mechanisms
      • 50.2.1 Client Authentication
      • 50.2.2 Mutual Authentication
        • 50.2.2.1 Enabling Mutual Authentication over SSL
        • 50.2.2.2 Creating a Client Certificate for Mutual Authentication
    • 50.3 Using the JDBC Realm for User Authentication
      • 50.3.1 To Configure a JDBC Authentication Realm
    • 50.4 Securing HTTP Resources
    • 50.5 Securing Application Clients
      • 50.5.1 Using Login Modules
      • 50.5.2 Using Programmatic Login
    • 50.6 Securing Enterprise Information Systems Applications
      • 50.6.1 Container-Managed Sign-On
      • 50.6.2 Component-Managed Sign-On
      • 50.6.3 Configuring Resource Adapter Security
      • 50.6.4 Mapping an Application Principal to EIS Principals
    • 50.7 Configuring Security Using Deployment Descriptors
      • 50.7.1 Specifying Security for Basic Authentication in the Deployment Descriptor
      • 50.7.2 Specifying Non-Default Principal-to-Role Mapping in the Deployment Descriptor
    • 50.8 Further Information about Advanced Security Topics
  • Part XI Java EE Supporting Technologies
  • 51 Transactions
    • 51.1 Transactions in Java EE Applications
    • 51.2 What Is a Transaction?
    • 51.3 Container-Managed Transactions
      • 51.3.1 Transaction Attributes
        • 51.3.1.1 Required Attribute
        • 51.3.1.2 RequiresNew Attribute
        • 51.3.1.3 Mandatory Attribute
        • 51.3.1.4 NotSupported Attribute
        • 51.3.1.5 Supports Attribute
        • 51.3.1.6 Never Attribute
        • 51.3.1.7 Summary of Transaction Attributes
        • 51.3.1.8 Setting Transaction Attributes
      • 51.3.2 Rolling Back a Container-Managed Transaction
      • 51.3.3 Synchronizing a Session Bean's Instance Variables
      • 51.3.4 Methods Not Allowed in Container-Managed Transactions
    • 51.4 Bean-Managed Transactions
      • 51.4.1 JTA Transactions
      • 51.4.2 Returning without Committing
      • 51.4.3 Methods Not Allowed in Bean-Managed Transactions
    • 51.5 Transaction Timeouts
      • 51.5.1 To Set a Transaction Timeout
    • 51.6 Updating Multiple Databases
    • 51.7 Transactions in Web Components
    • 51.8 Further Information about Transactions
  • 52 Resource Adapters and Contracts
    • 52.1 What Is a Resource Adapter?
      • 52.1.1 Management Contracts
        • 52.1.1.1 Lifecycle Management
        • 52.1.1.2 Work Management Contract
      • 52.1.2 Generic Work Context Contract
      • 52.1.3 Outbound and Inbound Contracts
    • 52.2 Metadata Annotations
    • 52.3 Common Client Interface
    • 52.4 Using Resource Adapters with Contexts and Dependency Injection for Java EE (CDI)
    • 52.5 Further Information about Resource Adapters
  • 53 The Resource Adapter Examples
    • 53.1 The trading Example
      • 53.1.1 Using the Outbound Resource Adapter
      • 53.1.2 Implementing the Outbound Resource Adapter
      • 53.1.3 Running the trading Example
        • 53.1.3.1 To Run the trading Example Using NetBeans IDE
        • 53.1.3.2 To Run the trading Example Using Maven
    • 53.2 The traffic Example
      • 53.2.1 Using the Inbound Resource Adapter
      • 53.2.2 Implementing the Inbound Resource Adapter
      • 53.2.3 Running the traffic Example
        • 53.2.3.1 To Run the traffic Example Using NetBeans IDE
        • 53.2.3.2 To Run the traffic Example Using Maven
  • 54 Using Java EE Interceptors
    • 54.1 Overview of Interceptors
      • 54.1.1 Interceptor Classes
      • 54.1.2 Interceptor Lifecycle
      • 54.1.3 Interceptors and CDI
    • 54.2 Using Interceptors
      • 54.2.1 Intercepting Method Invocations
        • 54.2.1.1 Using Multiple Method Interceptors
        • 54.2.1.2 Accessing Target Method Parameters from an Interceptor Class
      • 54.2.2 Intercepting Lifecycle Callback Events
        • 54.2.2.1 Using AroundConstruct Interceptor Methods
        • 54.2.2.2 Using Multiple Lifecycle Callback Interceptors
      • 54.2.3 Intercepting Timeout Events
        • 54.2.3.1 Using Multiple Timeout Interceptors
      • 54.2.4 Binding Interceptors to Components
        • 54.2.4.1 Declaring the Interceptor Bindings on an Interceptor Class
        • 54.2.4.2 Binding a Component to an Interceptor
      • 54.2.5 Ordering Interceptors
    • 54.3 The interceptor Example Application
      • 54.3.1 Running the interceptor Example
        • 54.3.1.1 To Run the interceptor Example Using NetBeans IDE
        • 54.3.1.2 To Run the interceptor Example Using Maven
  • 55 Batch Processing
    • 55.1 Introduction to Batch Processing
      • 55.1.1 Steps in Batch Jobs
      • 55.1.2 Parallel Processing
      • 55.1.3 Status and Decision Elements
      • 55.1.4 Batch Framework Functionality
    • 55.2 Batch Processing in Java EE
      • 55.2.1 The Batch Processing Framework
      • 55.2.2 Creating Batch Applications
      • 55.2.3 Elements of a Batch Job
      • 55.2.4 Properties and Parameters
      • 55.2.5 Job Instances and Job Executions
      • 55.2.6 Batch and Exit Status
    • 55.3 Simple Use Case
      • 55.3.1 Chunk Step
      • 55.3.2 Task Step
    • 55.4 Using the Job Specification Language
      • 55.4.1 The job Element
      • 55.4.2 The step Element
        • 55.4.2.1 The chunk Element
        • 55.4.2.2 The batchlet Element
        • 55.4.2.3 The partition Element
      • 55.4.3 The flow Element
      • 55.4.4 The split Element
      • 55.4.5 The decision Element
    • 55.5 Creating Batch Artifacts
      • 55.5.1 Batch Artifact Interfaces
      • 55.5.2 Dependency Injection in Batch Artifacts
      • 55.5.3 Using the Context Objects from the Batch Runtime
    • 55.6 Submitting Jobs to the Batch Runtime
      • 55.6.1 Starting a Job
      • 55.6.2 Checking the Status of a Job
      • 55.6.3 Invoking the Batch Runtime in Your Application
    • 55.7 Packaging Batch Applications
    • 55.8 The webserverlog Example Application
      • 55.8.1 Architecture of the webserverlog Example Application
        • 55.8.1.1 The Job Definition File
        • 55.8.1.2 The LogLine and LogFilteredLine Items
        • 55.8.1.3 The Chunk Step Batch Artifacts
        • 55.8.1.4 The Listener Batch Artifacts
        • 55.8.1.5 The Task Step Batch Artifact
        • 55.8.1.6 The JavaServer Faces Pages
        • 55.8.1.7 The Managed Bean
      • 55.8.2 Running the webserverlog Example Application
        • 55.8.2.1 To Run the webserverlog Example Application Using NetBeans IDE
        • 55.8.2.2 To Run the webserverlog Example Application Using Maven
    • 55.9 The phonebilling Example Application
      • 55.9.1 Architecture of the phonebilling Example Application
        • 55.9.1.1 The Job Definition File
        • 55.9.1.2 The CallRecord and PhoneBill Entities
        • 55.9.1.3 The Call Records Chunk Step
        • 55.9.1.4 The Phone Billing Chunk Step
        • 55.9.1.5 The JavaServer Faces Pages
        • 55.9.1.6 The Managed Bean
      • 55.9.2 Running the phonebilling Example Application
        • 55.9.2.1 To Run the phonebilling Example Application Using NetBeans IDE
        • 55.9.2.2 To Run the phonebilling Example Application Using Maven
    • 55.10 Further Information about Batch Processing
  • 56 Concurrency Utilities for Java EE
    • 56.1 Concurrency Basics
      • 56.1.1 Threads and Processes
    • 56.2 Main Components of the Concurrency Utilities
    • 56.3 Concurrency and Transactions
    • 56.4 Concurrency and Security
    • 56.5 The jobs Concurrency Example
      • 56.5.1 Running the jobs Example
        • 56.5.1.1 To Configure GlassFish Server for the Basic Concurrency Example
        • 56.5.1.2 To Build, Package, and Deploy the jobs Example Using NetBeans IDE
        • 56.5.1.3 To Build, Package, and Deploy the jobs Example Using Maven
        • 56.5.1.4 To Run the jobs Example and Submit Jobs with Low Priority
        • 56.5.1.5 To Run the jobs Example and Submit Jobs with High Priority
    • 56.6 The taskcreator Concurrency Example
      • 56.6.1 Running the taskcreator Example
        • 56.6.1.1 To Build, Package, and Deploy the taskcreator Example Using NetBeans IDE
        • 56.6.1.2 To Build, Package, and Deploy the taskcreator Example Using Maven
        • 56.6.1.3 To Run the taskcreator Example
    • 56.7 Further Information about the Concurrency Utilities
  • Part XII Case Studies
  • 57 Duke's Bookstore Case Study Example
    • 57.1 Design and Architecture of Duke's Bookstore
    • 57.2 The Duke's Bookstore Interface
      • 57.2.1 The Book Java Persistence API Entity
      • 57.2.2 Enterprise Beans Used in Duke's Bookstore
      • 57.2.3 Facelets Pages and Managed Beans Used in Duke's Bookstore
      • 57.2.4 Custom Components and Other Custom Objects Used in Duke's Bookstore
      • 57.2.5 Properties Files Used in Duke's Bookstore
      • 57.2.6 Deployment Descriptors Used in Duke's Bookstore
    • 57.3 Running the Duke's Bookstore Case Study Application
      • 57.3.1 To Build and Deploy Duke's Bookstore Using NetBeans IDE
      • 57.3.2 To Build and Deploy Duke's Bookstore Using Maven
      • 57.3.3 To Run Duke's Bookstore
  • 58 Duke's Tutoring Case Study Example
    • 58.1 Design and Architecture of Duke's Tutoring
    • 58.2 Main Interface
      • 58.2.1 Java Persistence API Entities Used in the Main Interface
      • 58.2.2 Enterprise Beans Used in the Main Interface
      • 58.2.3 WebSocket Endpoint Used in the Main Interface
      • 58.2.4 Facelets Files Used in the Main Interface
      • 58.2.5 Helper Classes Used in the Main Interface
      • 58.2.6 Properties Files
      • 58.2.7 Deployment Descriptors Used in Duke's Tutoring
    • 58.3 Administration Interface
      • 58.3.1 Enterprise Beans Used in the Administration Interface
      • 58.3.2 Facelets Files Used in the Administration Interface
      • 58.3.3 CDI Managed Beans Used in the Administration Interface
      • 58.3.4 Helper Classes Used in the Administration Interface
    • 58.4 Running the Duke's Tutoring Case Study Application
      • 58.4.1 Running Duke's Tutoring
        • 58.4.1.1 To Build and Deploy Duke's Tutoring Using NetBeans IDE
        • 58.4.1.2 To Build and Deploy Duke's Tutoring Using Maven
        • 58.4.1.3 Using Duke's Tutoring
  • 59 Duke's Forest Case Study Example
    • 59.1 Design and Architecture of Duke's Forest
      • 59.1.1 The events Project
      • 59.1.2 The entities Project
      • 59.1.3 The dukes-payment Project
      • 59.1.4 The dukes-resources Project
      • 59.1.5 The Duke's Store Project
        • 59.1.5.1 Enterprise Beans Used in Duke's Store
        • 59.1.5.2 Facelets Files Used in the Main Interface of Duke's Store
        • 59.1.5.3 Facelets Files Used in the Administration Interface of Duke's Store
        • 59.1.5.4 Managed Beans Used in Duke's Store
        • 59.1.5.5 Helper Classes Used in Duke's Store
        • 59.1.5.6 Qualifiers Used in Duke's Store
        • 59.1.5.7 Event Handlers Used in Duke's Store
        • 59.1.5.8 Deployment Descriptors Used in Duke's Store
      • 59.1.6 The Duke's Shipment Project
        • 59.1.6.1 Enterprise Beans Used in Duke's Shipment
        • 59.1.6.2 Facelets Files Used in Duke's Shipment
        • 59.1.6.3 Managed Beans Used in Duke's Shipment
        • 59.1.6.4 Helper Class Used in Duke's Shipment
        • 59.1.6.5 Qualifier Used in Duke's Shipment
        • 59.1.6.6 Deployment Descriptors Used in Duke's Shipment
    • 59.2 Building and Deploying the Duke's Forest Case Study Application
      • 59.2.1 To Build and Deploy the Duke's Forest Application Using NetBeans IDE
      • 59.2.2 To Build and Deploy the Duke's Forest Application Using Maven
    • 59.3 Running the Duke's Forest Application
      • 59.3.1 To Register as a Duke's Store Customer
      • 59.3.2 To Purchase Products
      • 59.3.3 To Approve Shipment of a Product
      • 59.3.4 To Create a New Product
  • Index
    • 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
The book hasn't received reviews yet.
You May Also Like
Also Available On
Categories
Curated Lists