Java EE 7 with GlassFish 4 Application Server

Java EE 7 with GlassFish 4 Application Server
eBook: $32.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $87.98    Print cover: $54.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Install and configure GlassFish 4
  • Covers all major Java EE 7 APIs and includes new additions such as JSON Processing
  • Packed with clear, step-by-step instructions, practical examples, and straightforward explanations.

Book Details

Language : English
Paperback : 348 pages [ 235mm x 191mm ]
Release Date : March 2014
ISBN : 1782176888
ISBN 13 : 9781782176886
Author(s) : David R. Heffelfinger
Topics and Technologies : All Books, Application Development, Open Source

Table of Contents

Chapter 1: Getting Started with GlassFish
Chapter 2: JavaServer Faces
Chapter 3: Object Relational Mapping with JPA
Chapter 4: Enterprise JavaBeans
Chapter 5: Contexts and Dependency Injection
Chapter 6: JSON Processing with JSON-P
Chapter 7: WebSockets
Chapter 8: The Java Message Service
Chapter 9: Securing Java EE Applications
Chapter 10: Web Services with JAX-WS
Chapter 11: Developing RESTful Web Services with JAX-RS
  • Chapter 1: Getting Started with GlassFish
    • An Overview of Java EE and GlassFish
      • What's new in Java EE 7?
        • JavaServer Faces (JSF) 2.2
        • Java Persistence API (JPA) 2.1
        • Java API for RESTful Web Services (JAX-RS) 2.0
        • Java Message Service (JMS) 2.0
        • Java API for JSON Processing (JSON-P) 1.0
        • Java API for WebSocket 1.0
      • GlassFish advantages
    • Obtaining GlassFish
    • Installing GlassFish
      • GlassFish dependencies
      • Performing the installation
    • Starting GlassFish
      • Deploying our first Java EE application
        • Deploying an application through the Web Console
        • Undeploying an application through the GlassFish Admin Console
        • Deploying an application through the command line
    • GlassFish domains
      • Creating Domains
      • Deleting domains
      • Stopping a domain
    • Setting up Database Connectivity
      • Setting up connection pools
      • Setting up the data sources
    • Summary
  • Chapter 2: JavaServer Faces
    • Introduction to JSF
      • Facelets
      • Optional faces-config.xml
        • Standard resource locations
    • Developing our first JSF application
      • Facelets
      • Project stages
      • Validation
      • Grouping components
      • Form submission
      • Named beans
      • Navigation
    • Custom data validation
      • Creating custom validators
      • Validator methods
    • Customizing JSF's default messages
      • Customizing message styles
      • Customizing message text
    • Ajax-enabling JSF applications
    • JSF 2.2 HTML5 support
      • The HTML5-friendly markup
      • Pass-through elements
    • JSF 2.2 Faces Flows
    • Additional JSF component libraries
    • Summary
  • Chapter 3: Object Relational Mapping with JPA
    • The CustomerDB database
    • Introducing the Java Persistence API
      • Entity relationships
        • One-to-one relationships
        • One-to-many relationships
        • Many-to-many relationships
      • Composite primary keys
      • Introducing the Java Persistence Query Language
      • Introducing the Criteria API
        • Updating data with the Criteria API
        • Deleting data with the Criteria API
      • Bean Validation support
    • Final notes
    • Summary
  • Chapter 4: Enterprise JavaBeans
    • Introduction to session beans
      • Developing a simple session bean
      • A more realistic example
      • Invoking session beans from web applications
      • Introduction to singleton session beans
      • Asynchronous method calls
    • Message-driven beans
    • Transactions in Enterprise JavaBeans
      • Container-managed transactions
      • Bean-managed transactions
    • Enterprise JavaBean life cycles
      • The stateful session bean life cycle
      • The stateless session bean life cycle
      • Message-driven bean life cycle
    • Introduction to the EJB Timer Service
      • Calendar-based EJB timer expressions
    • EJB Security
      • Client authentication
    • Summary
  • Chapter 6: JSON Processing with JSON-P
    • The JSON-P Model API
      • Generating JSON data with the Model API
      • Parsing JSON data with the Model API
    • The JSON-P Streaming API
      • Generating JSON data with the Streaming API
      • Parsing JSON data with the Streaming API
    • Summary
  • Chapter 7: WebSockets
    • Developing a WebSocket server endpoint
      • Developing an annotated WebSocket server endpoint
    • Developing WebSocket clients
      • Developing JavaScript client-side WebSocket code
      • Developing WebSocket clients in Java
    • Additional information about the Java API for WebSocket
    • Summary
  • Chapter 8: The Java Message Service
    • Setting up GlassFish for JMS
      • Setting up a JMS connection factory
      • Setting up a JMS queue
      • Setting up a JMS topic
    • Working with message queues
      • Sending messages to a message queue
      • Retrieving messages from a message queue
      • Asynchronously receiving messages from a message queue
      • Browsing message queues
    • Working with message topics
      • Sending messages to a message topic
      • Receiving messages from a message topic
      • Creating durable subscribers
    • Summary
  • Chapter 9: Securing Java EE Applications
    • Security realms
      • Predefined security realms
        • The admin-realm
        • The file realm
        • The certificate realm
      • Defining additional realms
        • Defining additional file realms
        • Defining additional certificate realms
        • Defining an LDAP realm
        • Defining a Solaris realm
        • Defining a JDBC realm
        • Defining custom realms
    • Summary
  • Chapter 10: Web Services with JAX-WS
    • Developing web services with the JAX-WS API
      • Developing a web service client
      • Sending attachments to web services
    • Exposing EJBs as web services
      • EJB web service clients
    • Securing web services
    • Securing EJB web services
    • Summary
  • Chapter 11: Developing RESTful Web Services with JAX-RS
    • Introducing RESTful web services and JAX-RS
    • Developing a simple RESTful web service
      • Configuring the REST resources path for our application
        • Configuring via the @ApplicationPath annotation
      • Testing our web service
      • Converting data between Java and XML with JAXB
    • Developing a RESTful web service client
    • Working with query and path parameters
      • Query parameters
        • Sending query parameters via the JAX-RS client API
      • Path parameters
        • Sending path parameters via the JAX-RS Client API
    • Summary

David R. Heffelfinger

David Heffelfinger is the Chief Technology Officer of Ensode Technology, LLC, a software consulting firm based in the greater Washington DC area. He has been architecting, designing and developing software professionally since 1995 and has been using Java as his primary programming language since 1996. He has worked on many large scale projects for several clients including the US Department of Homeland Security, Freddie Mac, Fannie Mae, and the US Department of Defense. He has a Masters degree in Software Engineering from Southern Methodist University. David is editor in chief of (, a website about Java, Linux, and other technology topics.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 1 submitted: last submission 13 Jun 2014

Errata type: Technical | Page number: 30


"...then click on the JDBC Connection Pools tab."

It should state:

"...then click on the JDBC Resources node." 

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Java EE 7 with GlassFish 4 Application Server +    Microsoft Dynamics GP 2010 Implementation =
50% Off
the second eBook
Price for both: £30.05

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Develop web-based applications using JavaServer Faces (JSF) 2.2
  • Interact with databases via the Java Persistence API (JPA) 2.1
  • Create SOAP and RESTful web services via JAX_WS and JAX-RS APIs
  • Develop Enterprise JavaBeans (EJBs), including session and message-driven beans
  • Integrate enterprise application layers via Contexts and Dependency Injection (CDI) API
  • Generate and parse JavaScript Object Notation (JSON) data via the JSON-P API
  • Make WebSocket applications via the standard Java EE 7 WebSocket API

In Detail

GlassFish is a free, open source application server which supports all the major Java features such as Enterprise JavaBeans, JPA, JavaServer Faces, JMS, RMI, JavaServer Pages, and servlets. It is the first Java EE 7 compliant application server. All major Java EE technologies and API's are covered in this version of Java. GlassFish server allows the user to work with the extensile, adaptable, and lightweight Java EE 7 platform.

This book explores the installation and configuration of GlassFish, and then moves on to Java EE 7 application development, covering all major Java EE 7 APIs. It focuses on going beyond the basics to develop Java applications deployed to the GlassFish 4 application server. The book covers all major Java EE 7 APIs including JSF 2.2, EJB 3.2, CDI 1.1, the Java API for WebSocket, JAX-WS, JAX-RS and more.

The book also introduces JSON-P, the Java API for JSON (Javascript Object Notation) Processing. This advanced topic deals with how the two APIs are used to process JSON function, namely the Model API and the Streaming API. Apart from revisiting Java Server Faces (JSF), it explains why Facelets, the new features introduced in modern versions of JSF, are the preferred view technology over Java Server Pages (JSP)

The later chapters explore competing implementations of the WebSocket standard in Java, describing the updates in JMS; which aims to provide a simpler API and reduction in boilerplate code among a host of other features. Readers will also learn how to secure Java EE applications by taking advantage of GlassFish's built-in security features. Finally, we learn more about the RESTful web service development using the JAX-RS specification.


This book is a practical guide and follows a very user-friendly approach. The book aims to get the reader up to speed in Java EE 7 development. All major Java EE 7 APIs and the details of the GlassFish 4 server are covered followed by examples of their use.

Who this book is for

If you are a Java developers who wants to become proficient with Java EE 7, this book is ideal for you. Readers are expected to have some experience with Java and to have developed and deployed applications in the past, but don’t need any previous knowledge of Java EE or J2EE.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software