Contents

Foreword

About the Author

About the Technical Reviewer

Acknowledgments

Introduction

images Chapter 1: Java EE 7 at a Glance

Understanding Java EE

Architecture

Components

Containers

Services

Network Protocols

Packaging

Annotations and Deployment Descriptors

Standards

Portable

Programming Model

Java Standard Edition 7

String Case

Diamond

Try-with-Resources

Multicatch Exception

NIO.2

Java EE Specifications Overview

A Brief History of Java EE

Pruning

Java EE 7 Specifications

Web Profile 7 Specifications

The CD-BookStore Application

Summary

images Chapter 2: Context and Dependency Injection

Understanding Beans

Dependency Injection

Life-Cycle Management

Scopes and Context

Interception

Loose Coupling and Strong Typing

Deployment Descriptor

CDI Specifications Overview

A Brief History of CDI Specifications

What’s New in CDI 1.1?

Reference Implementation

Writing a CDI Bean

Anatomy of a CDI Bean

Dependency Injection

Alternatives

Producers

Disposers

Scopes

Beans in Expression Language

Interceptors

Target Class Interceptors

Class Interceptors

Life-Cycle Interceptor

Chaining and Excluding Interceptors

Interceptor Binding

Prioritizing Interceptors Binding

Decorators

Events

Putting It All Together

Writing the Book and BookService Classes

Writing the NumberGenerator Classes

Writing the Qualifiers

Writing the Logger

Writing the Main Class

Trigger CDI with beans.xml

Compiling and Executing with Maven

Running the Main Class

Writing the BookServiceIT Class

Enabling Alternatives and Interceptors in beans.xml for Integration Testing

Running the Integration Test

Summary

images Chapter 3: Bean Validation

Understanding Constraints and Validation

Application

Database

Client

Interoperability

Bean Validation Specification Overview

A Brief History of Bean Validation

What’s New in Bean Validation 1.1?

Reference Implementation

Writing Constraints

Anatomy of a Constraint

Built-In Constraints

Defining Your Own Constraints

Messages

ConstraintValidator Context

Groups

Deployment Descriptors

Validating Constraints

Validation APIs

Validating Beans

Validating Properties

Validating Values

Validating Methods

Validating Groups

Putting It All Together

Writing the Customer Bean

Writing the Address Bean

Writing the @Email Constraint

Writing the @ZipCode Constraint

Writing the CustomerIT and AddressIT Integration Tests

Compiling and Testing with Maven

Summary

images Chapter 4: Java Persistence API

Understanding Entities

Anatomy of an Entity

Object-Relational Mapping

Querying Entities

Persistence Unit

Entity Life Cycle and Callbacks

Integration with Bean Validation

JPA Specification Overview

A Brief History of JPA

What’s New in JPA 2.1?

Reference Implementation

Putting It all Together

Writing the Book Entity

Writing the Main Class

Writing the BookIT Integration Test

Writing the Persistence Unit

Writing an SQL Script to Load Data

Compiling and Testing with Maven

Running the Main Class with Derby

Checking the Generated Schema

Summary

images Chapter 5: Object-Relational Mapping

Elementary Mapping

Tables

Primary Keys

Attributes

Access Type

Collection of Basic Types

Map of Basic Types

Mapping with XML

Embeddables

Access Type of an Embeddable Class

Relationship Mapping

Relationships in Relational Databases

Entity Relationships

Fetching Relationships

Ordering Relationships

Inheritance Mapping

Inheritance Strategies

Type of Classes in the Inheritance Hierarchy

Summary

images Chapter 6: Managing Persistent Objects

Entity Manager

Obtaining an Entity Manager

Persistence Context

Manipulating Entities

JPQL

Select

From

Where

Order By

Group By and Having

Bulk Delete

Bulk Update

Queries

Dynamic Queries

Named Queries

Criteria API (or Object-Oriented Queries)

Native Queries

Stored Procedure Queries

Cache API

Concurrency

Versioning

Optimistic Locking

Pessimistic Locking

Entity Life Cycle

Callbacks

Listeners

Summary

images Chapter 7: Enterprise JavaBeans

Understanding Enterprise JavaBeans

Types of EJBs

Process and Embedded Container

Services Given by the Container

EJB Lite

EJB Specification Overview

A Brief History of the EJB Specification

What’s New in EJB 3.2?

Reference Implementation

Writing Enterprise Java Beans

Anatomy of an EJB

Stateless Beans

Stateful Beans

Singletons

Dependency Injection

Session Context

Asynchronous Calls

Deployment Descriptor

Environment Naming Context

Packaging

Deploying an EJB

Invoking Enterprise Java Beans

Invoking with Injection

Invoking with CDI

Invoking with JNDI

Summary

images Chapter 8: Callbacks, Timer Service, and Authorization

Session Beans Life Cycle

Stateless and Singleton

Stateful

Callbacks

Timer Service

Calendar-Based Expression

Declarative Timer Creation

Programmatic Timer Creation

Authorization

Declarative Authorization

Programmatic Authorization

Putting It All Together

Writing the Book Entity

Writing the BookEJB Stateless Session Bean

Writing the CDI DatabaseProducer

Persistence Unit for the BookEJB

Writing the DatabasePopulator and Defining the Data Source

Writing the BookEJBIT Integration Test

Compiling, Testing, and Packaging with Maven

Deploying on GlassFish

Writing the Main Class

Summary

images Chapter 9: Transactions

Understanding Transactions

ACID

Read Conditions

Transaction Isolation Levels

JTA Local Transactions

Distributed Transactions and XA

Transaction Specifications Overview

A Brief History of JTA

What’s New in JTA 1.2?

Reference Implementation

Transaction Support in EJBs

Container-Managed Transactions

Bean-Managed Transactions

Transaction Support in Managed Beans

Exceptions and Transactions

Summary

images Chapter 10: JavaServer Faces

Understanding Web Pages

HTML

XHTML

CSS

DOM

JavaScript

Understanding JSF

FacesServlet

Pages and Components

Facelets

Renderers

Converters and Validators

Backing Beans and Navigation

Expression Language

Ajax Support

JSF Specification Overview

A Brief History of Web Interfaces

A Brief History of JSF

What’s New in JSF 2.2?

Reference Implementation

Writing JSF Pages and Components

Anatomy of a JSF Page

Anatomy of JSF Components

Composite Components

Summary

images Chapter 11: Processing and Navigation

The MVC Pattern

FacesServlet

FacesContext

Faces Config

Writing Backing Beans

Anatomy of a Backing Bean

Handling Exceptions and Messages

Bringing JSF and EJBs Together

Navigation

Conversion and Validation

Converters

Custom Converters

Validators

Custom Validators

Integration with Bean Validation

Ajax

General Concepts

Support in JSF

Putting It All Together

Writing the Book Entity

Writing the BookEJB

Writing the BookController Backing Bean

Writing the layout.xhtml Template

Writing the newBook.xhtml Page

Writing the viewBook.xhtml Page

Compiling and Packaging with Maven

Deploying on GlassFish

Running the Example

Summary

images Chapter 12: XML and JSon Processing

Understanding XML

XML Document

Validating with XML Schema

Parsing with SAX and DOM

Querying with XPath

Transforming with XSLT

XML Specifications Overview

A Brief History of XML Specifications

XML Specifications in Java

Reference Implementations

Java Architecture for XML Processing

Configuring JAXP

JAXP with SAX

JAXP with DOM

JAXP with XSLT

Java Architecture for XML Binding

Binding

Annotations

Understanding JSON

JSON Document

JSON Specifications Overview

JSON-P

Reference Implementation

JSON Processing

Building JSON

Parsing JSON

Generating JSON

Putting It All Together

Writing the CreditCard Class

Writing the CreditCardXMLTest Unit Test

Writing the CreditCardJSonTest Unit Test

Summary

images Chapter 13: Messaging

Understanding Messaging

Point-to-Point

Publish-Subscribe

Administered Objects

Message-Driven Beans

Messaging Specifications Overview

A Brief History of Messaging

What’s New in JMS 2.0?

What’s New in EJB 3.2?

Reference Implementation

Java Messaging Service API

Classic API

Simplified API

Writing Message Producers

Producing a Message outside a Container

Producing a Message inside a Container

Producing a Message inside a Container with CDI

Writing Message Consumers

Synchronous Delivery

Asynchronous Delivery

Reliability Mechanisms

Filtering messages

Setting Message Time-to-Live

Specifying Message Persistence

Controlling Acknowledgment

Creating Durable Consumers

Setting Priorities

Writing Message-Driven Beans

Anatomy of an MDB

MDB as a Consumer

MDB as a Producer

Transactions

Handling Exceptions

Putting It All Together

Writing the OrderDTO

Writing the OrderProducer

Writing the OrderConsumer

Writing the ExpensiveOrderMDB

Compiling and Packaging with Maven

Creating the Administered Objects

Deploying the MDB on GlassFish

Running the Example

Summary

images Chapter 14: SOAP Web Services

Understanding SOAP Web Services

XML

WSDL

SOAP

UDDI

Transport Protocol

SOAP Web Services Specifications Overview

A Brief History of SOAP Web Services Specifications

SOAP Web Services Related Specifications

What’s New in SOAP Web Services Specifications?

Reference Implementation

Writing SOAP Web Services

Anatomy of a SOAP Web Service

SOAP Web Service Endpoints

WSDL Mapping

Handling Exceptions

Life Cycle and Callback

WebServiceContext

Deployment Descriptor

Packaging

Publishing a SOAP Web Service

Invoking SOAP Web Services

Anatomy of a SOAP Consumer

Invoking Programmatically

Invoking with Injection

Invoking with CDI

Putting It All Together

Writing the CreditCard Class

Writing the CardValidator SOAP Web Service

Writing the CardValidatorTest Unit Test

Writing the CardValidatorIT Integration Test

Compiling, Testing and Packaging with Maven

Deploying on GlassFish

Writing the WebServiceConsumer Class

Generating Consumer’s Artifacts and Packaging with Maven

Running the WebServiceConsumer Class

Summary

images Chapter 15: RESTful Web Services

Understanding RESTful Web Services

A Web-Browsing Experience

Resources and URIs

Representations

Addressability

Connectedness

Uniform Interface

Statelessness

HTTP

From the Web to Web Services

WADL

RESTful Web Services Specifications Overview

A Brief History of REST

Java API for RESTful Web Services

What’s New in JAX-RS 2.0?

Reference Implementation

Writing RESTful Web Services

Anatomy of a RESTful Web Service

CRUD Operations on a RESTful Web Service

URI Definition and Binding URIs

Extracting Parameters

Consuming and Producing Content Types

Returned Types

HTTP Method Matching

Contextual Information

Entity Provider

Handling Exceptions

Life Cycle and Callback

Packaging

Invoking RESTful Web Services

The Client API

Anatomy of a REST Consumer

Putting It All Together

Writing the Book Entity

Writing the Books JAXB Bean

Writing the BookRestService

Configuring JAX-RS

Compiling and Packaging with Maven

Deploying on GlassFish

WADL

Writing the BookRestServiceIT Integration Test

Summary

images Appendix A: Setting Up the Development Environment

JDK 1.7

Maven 3

A Brief History of Maven

Project Descriptor

Managing Artifacts

Project Modularity

Plug-ins and Life Cycle

Installation

Usage

JUnit 4

A Brief History of JUnit

How Does It Work?

Test Methods

Assert Methods

Fixtures

Launching JUnit

JUnit Integration

Derby 10.8

Installation

Usage

GlassFish v4

A Brief History of GlassFish

GlassFish v4 Architecture

Update Center

GlassFish Subprojects

Administration

Installing GlassFish

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.244.217