O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Java EE 6 with GlassFish 3 Application Server

Book Description

A practical guide to install and configure the GlassFish 3 Application Server and develop Java EE 6 applications to be deployed to this server

  • Install and configure the GlassFish 3 Application Server and develop Java EE 6 applications to be deployed to this server

  • Specialize in all major Java EE 6 APIs, including new additions to the specification such as CDI and JAX-RS

  • Use GlassFish v3 application server and gain enterprise reliability and performance with less complexity

  • Clear, step-by-step instructions, practical examples, and straightforward explanations

In Detail

GlassFish is a free, open source, production ready application server. It is the environment's reference implementation and the first Enterprise Java server to implement Java EE6. Although GlassFish server delivers a flexible, lightweight and extensible Java EE 6 platform, it can be challenging to get beyond the basics and develop Java applications deployed to GlassFish 3 application server.

This book takes an in-depth look at all of the major new features in Glassfish 3 and how it differs from previous Glassfish versions. This book explains GlassFish installation and configuration, and then moves on to Java EE 6 application development, covering all major Java EE 6 APIs. It is a handy guide for the advanced Java programmers as well as Java EE 6 beginners.

This book begins with the installation of Glassfish 3 and deploying Java applications. It also explains how to develop, configure, package and deploy servlets. We will also learn the processing of HTML Forms. As we move on, we will develop Java Server Pages and get to know implicit JSP objects. We will get to know all the JSTL (JSP Standard Tag Library) tag libraries. This book gives us a better understanding on how to manage data from a database through Java Database Connectivity (JDBC) API and the Java Persistence API (JPA). We will also learn more about the newly introduced features of JPA 2.0 and develop JSF 2.0 applications learn how to customize them. We then set up Glassfish for Java Messaging (JMS) API and understand the working of message queues and message topics. Later, we use the Context and Dependency Injection (CDI) API to integrate application layers and study the SOAP based web service development using the JAX-WS specification. Finally, we learn more about the Restful web service development using the JAX-RS specification.

The book covers the various Java EE 6 conventions and annotations that can simplify enterprise Java application development. The latest versions of the Servlet, JSF, JPA, EJB and JAX-WS specifications are covered, as well as new additions to the specification such as JAX-RS and CDI.

This book is a Developer’s Guide, covering the ins and outs of developing Java EE 6 applications deployed to the standards-compliant, high performance GlassFish 3 application server

Table of Contents

  1. Java EE 6 with GlassFish 3 Application Server
    1. Table of Contents
    2. Java EE 6 with GlassFish 3 Application Server
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Errata
        2. Piracy
        3. Questions
    7. 1. Getting Started with GlassFish
      1. Overview of Java EE and GlassFish
        1. What's new in Java EE 6
          1. JavaServer Faces (JSF) 2.0
          2. Enterprise JavaBeans (EJB) 3.1
          3. Java Persistence API (JPA) 2.0
          4. Contexts and Dependency Injection for Java (Web Beans 1.0)
          5. Java Servlet API 3.0
          6. Java API for RESTful web services (JAX-RS) 1.1
          7. Java API for XML-based web services (JAX-WS) 2.2
          8. Java Architecture for XML Binding (JAXB) 2.2
        2. What's new in GlassFish v3
        3. GlassFish advantages
      2. Obtaining GlassFish
      3. Installing GlassFish
        1. GlassFish dependencies
        2. Performing the installation
      4. Verifying the installation
        1. Deploying our first Java EE application
          1. Deploying an application through the Web Console
          2. Undeploying an application through the Web Console
          3. Deploying an application through the command line
            1. The autodeploy directory
            2. The asadmin command line utility
      5. GlassFish domains
        1. Creating domains
        2. Deleting domains
        3. Stopping a domain
      6. Setting up database connectivity
        1. Setting up connection pools
        2. Setting up data sources
      7. Final notes
      8. Summary
    8. 2. Servlet Development and Deployment
      1. What is a servlet?
      2. Writing our first servlet
      3. Compiling the servlet
      4. Configuring the servlet
      5. Packaging the web application
      6. Deploying the web application
      7. Testing the web application
      8. Processing HTML forms
      9. Request forwarding and response redirection
        1. Request forwarding
        2. Response redirection
      10. Persisting application data across requests
      11. New features introduced in Servlet 3.0
        1. Optional web.xml deployment descriptor
          1. @WebServlet annotation
            1. Passing initialization parameters to a servlet via annotations
          2. @WebFilter annotation
          3. @WebListener annotation
          4. Pluggability
          5. Configuring web applications programmatically
          6. Asynchronous processing
      12. Summary
    9. 3. JavaServer Pages
      1. Introduction to JavaServer Pages
      2. Developing our first JSP
      3. JSP implicit objects
      4. JSPs and JavaBeans
      5. Reusing JSP content
      6. JSP custom tags
        1. Extending SimpleTagSupport
        2. Using tag files to create custom JSP tags
      7. Unified Expression Language
      8. JSP XML syntax
      9. Summary
    10. 4. JSP Standard Tag Library
      1. Core JSTL tag library
      2. Formatting JSTL tag library
      3. SQL JSTL tag library
      4. XML JSTL tag library
      5. JSTL functions
      6. Summary
    11. 5. Database Connectivity
      1. The CustomerDB database
      2. JDBC
        1. Retrieving data from a database
        2. Modifying database data
      3. The Java Persistence API
        1. Entity relationships
          1. One-to-one relationships
          2. One-to-many relationships
          3. Many-to-many relationships
        2. Composite primary keys
        3. Java Persistence Query Language
      4. New features introduced in JPA 2.0
        1. Criteria API
        2. Bean Validation support
      5. Summary
    12. 6. JavaServer Faces
      1. Introduction to JSF 2.0
        1. Facelets
        2. Optional faces-config.xml
        3. Standard resource locations
      2. Developing our first JSF 2.0 application
        1. Facelets
        2. Project stages
        3. Validation
        4. Grouping components
        5. Form submission
        6. Managed beans
          1. Managed bean scopes
        7. Navigation
      3. Custom data validation
        1. Creating custom validators
        2. Validator methods
      4. Customizing JSF's default messages
        1. Customizing message styles
        2. Customizing message text
      5. Integrating JSF and JPA
      6. Ajax enabling JSF 2.0 applications
      7. JSF standard components
        1. JSF core components
          1. The <f:actionListener> tag
          2. The <f:ajax> tag
          3. The <f:attribute> tag
          4. The <f:convertDateTime> tag
          5. The <f:convertNumber> tag
          6. The <f:converter> tag
          7. The <f:event> tag
          8. The <f:facet> tag
          9. The <f:loadBundle> tag
          10. The <f:metadata> tag
          11. The <f:param> tag
          12. The <f:phaseListener> tag
          13. The <f:selectItem> tag
          14. The <f:selectItems> tag
          15. The <f:setPropertyActionListener> tag
          16. The <f:subview> tag
          17. The <f:validateBean> tag
          18. The <f:validateDoubleRange> tag
          19. The <f:validateLength> tag
          20. The <f:validateLongRange> tag
          21. The <f:validateRegex> tag
          22. The <f:validateRequired> tag
          23. The <f:validator> tag
          24. The <f:valueChangeListener> tag
          25. The <f:verbatim> tag
          26. The <f:view> tag
          27. The <f:viewParam> tag
        2. JSF HTML components
          1. The <h:body> tag
          2. The <h:button> tag
          3. The <h:column> tag
          4. The <h:commandButton> tag
          5. The <h:commandLink> tag
          6. The <h:dataTable> tag
          7. The <h:form> tag
          8. The <h:graphicImage> tag
          9. The <h:head> tag
          10. The <h:inputHidden> tag
          11. The <h:inputSecret> tag
          12. The <h:inputText> tag
          13. The <h:inputTextarea> tag
          14. The <h:link> tag
          15. The <h:message> tag
          16. The <h:messages> tag
          17. The <h:outputFormat> tag
          18. The <h:outputLabel> tag
          19. The <h:outputLink> tag
          20. The <h:outputScript> tag
          21. The <h:outputStylesheet> tag
          22. The <h:outputText> tag
          23. The <h:panelGrid> tag
          24. The <h:panelGroup> tag
          25. The <h:selectBooleanCheckbox> tag
          26. The <h:selectManyCheckbox> tag
          27. The <h:selectManyListbox> tag
          28. The <h:selectManyMenu> tag
          29. The <h:selectOneListbox> tag
          30. The <h:selectOneMenu> tag
          31. The <h:selectOneRadio> tag
        3. Additional JSF component libraries
      8. Summary
    13. 7. Java Messaging Service
      1. Setting up GlassFish for JMS
        1. Setting up a JMS connection factory
        2. Setting up a JMS message queue
        3. Setting up a JMS message topic
      2. Message queues
        1. Sending messages to a message queue
        2. Retrieving messages from a message queue
        3. Asynchronously receiving messages from a message queue
        4. Browsing message queues
      3. Message topics
        1. Sending messages to a message topic
        2. Receiving messages from a message topic
        3. Creating durable subscribers
      4. Summary
    14. 8. Security
      1. Security realms
        1. Predefined security realms
          1. The admin-realm
          2. The file realm
            1. File realm basic authentication
          3. The certificate realm
            1. Creating self-signed certificates
            2. Configuring applications to use the certificate realm
        2. Defining additional realms
          1. Defining additional file realms
          2. Defining additional certificate realms
          3. Defining an LDAP realm
          4. Defining a Solaris realm
          5. Defining a JDBC realm
          6. Defining custom realms
      2. Summary
    15. 9. Enterprise JavaBeans
      1. Session beans
        1. Simple session bean
        2. A more realistic example
        3. Invoking session beans from web applications
      2. Singleton session beans
      3. Asynchronous method calls
      4. Message-driven beans
      5. Transactions in Enterprise JavaBeans
        1. Container-managed transactions
        2. Bean-managed transactions
      6. Enterprise JavaBeans life cycle
        1. Stateful session bean life cycle
        2. Stateless session bean life cycle
        3. Message-driven bean life cycle
      7. EJB timer service
        1. Calendar-based EJB timer expressions
      8. EJB security
        1. Client authentication
      9. Summary
    16. 10. Contexts and Dependency Injection
      1. Named beans
      2. Dependency injection
      3. Qualifiers
      4. Named bean scopes
      5. Summary
    17. 11. Web Services with JAX-WS
      1. Developing web services with JAX-WS
        1. Developing a web service client
        2. Sending attachments to web services
      2. Exposing EJBs as web services
        1. EJB web service clients
        2. Securing web services
        3. Securing EJB web services
      3. Summary
    18. 12. RESTful Web Services with Jersey and JAX-RS
      1. Introduction to RESTful web services and JAX-RS
      2. Developing a simple RESTful web service
        1. Configuring the REST resources path for our application
          1. Configuring via web.xml
          2. Configuring via the @ApplicationPath annotation
        2. Testing our web service
        3. Converting data between Java and XML with JAXB
      3. Developing a RESTful web service client
      4. Query and path parameters
        1. Query parameters
          1. Sending query parameters via the Jersey client API
        2. Path parameters
          1. Sending path parameters via the Jersey client API
      5. Summary
    19. A. Sending E-mails from Java EE Applications
      1. Configuring GlassFish
      2. Implementing e-mail delivery functionality
    20. B. IDE Integration
      1. NetBeans
      2. Eclipse
    21. Index