Mastering Java EE Development with WildFly

Book description

Your one stop solution to create highly scalable enterprise grade Java applications with WildFly.

About This Book

  • Master Java EE development with the latest WildFly 10 application server.

  • Integrate with JSF and JMS and use efficient load balancing techniques to create real-time apps

  • Integrate your backend JavaScript code seamlessly into Java applications

  • Who This Book Is For

    If you are a Java developer with at least basic knowledge of Java EE, then this book is for you. No previous knowledge of WildFly is required.

    What You Will Learn

  • Configure the development environment along with native and cloud installation of WildFly

  • Write a DB schema and the relative entities and how to use the relationships between the entities

  • Analyze with examples all the java annotations to manage the EJB and the configuration to get better performances

  • Write different REST services through the EJB

  • Implement Web sockets 1.0 and know why and when use the web sockets

  • Work with Active MQ and write JMS clients to manage the authentication and authorization in the clients

  • Configure the mail server through the wildfly console

  • Learn how and when to use a new feature JAX-RS 2.0, which is the asynchronous call through REST

  • Use the new JSF features of Wildfly 10 such as Mojarra 2.2, JSF 2.2, Richfaces 4.5

  • In Detail

    Packed with rich assets and APIs, Wildfly 10 allows you to create state-of-the-art Java applications. This book will help you take your understanding of Java EE to the next level by creating distributed Java applications using Wildfly.

    The book begins by showing how to get started with a native installation of WildFly and it ends with a cloud installation. After setting up the development environment, you will implement and work with different WildFly features, such as implementing JavaServer Pages. You will also learn how you can use clustering so that your apps can handle a high volume of data traffic. You will also work with enterprise JavaBeans, solve issues related to failover, and implement Java Message Service integration. Moving ahead, you will be working with Java Naming and Directory Interface, Java Transaction API, and use ActiveMQ for message relay and message querying. This book will also show you how you can use your existing backend JavaScript code in your application.

    By the end of the book, you’ll have gained the knowledge to implement the latest Wildfly features in your Java applications.

    Style and approach

    Each part of this book shows you how to use different features of WildFly 10 to create enterprise grade Java applications as easily as possible.

    Table of contents

    1. 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. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    2. Introducing Java EE and Configuring the Development Environment
      1. JSON and HTML5
      2. WebSockets
      3. Simplified JMS 2.0 API
      4. Groundwork for Cloud environments
      5. Batch applications
      6. Updated web profiles
      7. Concurrency utilities
      8. Context dependency injection
      9. Java API for RESTful web services (JAX-RS) 2.0
      10. Servlet 3.1
      11. JNDI
      12. Asynchronous invocation
      13. Timers
      14. EJB Lite
      15. Development in WildFly
        1. Operating system
        2. Java
        3. Application server
        4. Build system
        5. Structure of the exercises
        6. Tests
        7. IDE
          1. Netbeans IDE
          2. IntelliJ IDEA
          3. Eclipse IDE
          4. Importing exercises
          5. Debug exercises
      16. Summary
    3. Working with Dependency Injection
      1. Dependency injection 1.0 for Java
        1. Qualifiers
        2. EL name resolution
        3. Resources
      2. Context and dependency injection 1.1 for Java
        1. Injection and contexts
          1. Managed beans
          2. Producer methods and fields
          3. Bean types
          4. The BeanManager object
            1. CDI
            2. Unmanaged
          5. Enabled and disabled beans
          6. The injection target
          7. Scopes
          8. Session beans
          9. Service Provider Interfaces
          10. Events
            1. Event qualifiers
            2. Observer methods
          11. Container lifecycle events
          12. Utilities
          13. Decorators
            1. Enabled decorators
            2. And more...
            3. Model
            4. TransientReference
      3. Interceptors 1.2
        1. Interceptor classes
        2. Associating an interceptor class with the target class
        3. Default interceptors
        4. Interceptors for lifecycle callbacks
        5. Interceptor bindings
      4. Common annotations for the Java platform 1.2
        1. Common annotation
        2. SQL utilities
      5. Web console for monitoring beans
      6. Summary
    4. Persistence
      1. Common JPA annotations
        1. Named queries
        2. Relationships
          1. Cascade on one-to-one and one-to-many
            1. Cascading the one-to-one persist operation
            2. Cascading the one-to-one merge operation
            3. Cascading the one-to-one delete operation
            4. The one-to-one delete orphan cascading operation
          2. Cascade on Many To Many
            1. Cascade of the persist many to many operation
            2. Dissociation of one side in the many to many association
            3. Tricks for many to many CascadeType.REMOVE
          3. Conclusion
        3. News from Java EE 7
          1. Result set
          2. Stored procedures
          3. Converters
          4. Named entity graphs
          5. JPQL improvements
          6. API Criteria bulk operations
          7. Unsynchronized persistence context
        4. Indexes
        5. Packages and entities
      2. DataSources and connectors
        1. Deployment of the DataSource
          1. DS file
            1. XA and non XA
            2. Activating the deployer
          2. XML configuration
          3. Web console
      3. Summary
    5. Implementing Business Logic
      1. Scopes in EJB
        1. Singleton
        2. Local and remote interfaces
        3. Remote clients
          1. EJB client library
          2. Remote naming project
          3. Combining the remote naming project and EJB client library
        4. Local and remote homes
        5. The session context
      2. Transactions
        1. Exceptions
        2. Transaction management annotation
        3. Transaction attributes
      3. Security
      4. EJB container configuration
        1. Session beans
          1. Stateless
          2. Stateful
          3. Singleton
        2. Entity beans
        3. Remote
        4. Thread pools
        5. IIOP
        6. In VM remote interface invocations
      5. Summary
    6. Working with Distributed Transactions
      1. Transaction overview
        1. BMT and CMT
          1. Descriptor configuration
          2. Remote transaction
        2. Transactions and resource managers
        3. ACID properties
        4. Enterprise concurrent API
          1. Managed executor service
          2. Set of threads
          3. Transactional tasks
        5. Levels and transaction isolation problems
          1. Isolation violations
            1. Dirty read
            2. Non-repeatable read
            3. Phantom read
          2. Isolation levels
            1. Read committed
            2. Read uncommitted
            3. Repeatable read
            4. Serializable
        6. Transaction models
          1. Flat transactions
          2. Savepoints
          3. Nested transactions
          4. Saga
          5. Chained transactions
        7. Distributed transactions and the JTA
        8. Distributed transaction scenarios
          1. Multiple databases
          2. Message queue and database
          3. Multiple application servers
          4. Transaction started by the client
        9. Two-phase commit
          1. Emulating two-phase commit
      2. Summary
    7. Creating REST Services
      1. Services
      2. REST and HTTP
        1. GET methods
        2. POST methods
        3. PUT methods
        4. HEAD methods
        5. OPTIONS method
        6. DELETE method
          1. Using RESTEasy directly
      3. REST application and components
        1. Container components
          1. Container request filter
          2. Container Response Filter
          3. Name binding
        2. Providers
        3. Client components
          1. Client Request Filter
          2. Client Response Filter
        4. Interceptors
          1. Reader interceptors
          2. Writer interceptors
        5. Features
          1. Contracts
          2. Dynamic features
      4. Forms and beans
        1. Selenium and Drone
      5. Summary
    8. Implementing WebSockets
      1. History of the web
      2. Implementation engine
        1. A first basic example
        2. WebSocket container
      3. WebSocket session
        1. Security
          1. HTTPS
          2. Security realm
          3. Custom HTTPS configuration
          4. WebSocket HTTPS connection
          5. Negotiated subprotocols
            1. Configurators for requests and responses
        2. Request informations and parameters
          1. Path parameters
          2. Request parameters
          3. Other features
        3. Container configuration
        4. Runtime configuration
        5. Client WebSockets
          1. Basic client
          2. Async client
        6. Message handlers
          1. Whole
          2. Partial
          3. Custom message handler registration
      4. Ajax versus WebSockets
      5. Summary
    9. Working with Messaging
      1. Queues and topics
        1. Queues
          1. Creating the queue from the web console
          2. Creating the queue using CLI and Maven WildFly plugin
          3. Creating the queue through an Arquillian test case
          4. Create the Java client for the queue
        2. Topics
          1. Creating the topic from the web console
          2. Creating the topic with the Maven WildFly plugin
          3. Creating the topic through an Arquillian test case
          4. Creating the Java client for the topic
      2. Remote clients
      3. Message listeners
      4. The JMS context
      5. Summary
    10. Implementing a Mail Client
      1. Mail client API
        1. Java example
        2. Creating a client with Java SE
      2. Configuration of the mail server
        1. SMTP local mail server
      3. Summary
    11. Asynchronous REST
      1. Asynchronous resources
      2. REST timeouts
      3. REST server callbacks
        1. Connection callbacks
      4. Asynchronous clients
        1. Asynchronous client callbacks
      5. Summary
    12. Asynchronous EJB
      1. The asynchronous annotation
      2. Timers and schedulers
        1. Timer service
          1. File configuration
        2. Timer configuration
        3. Access timeout
        4. Old specs compliant
        5. Stateful timeout
        6. Schedulers
        7. Transactions and timers
      3. Message driven beans
        1. Message driven bean context
        2. Acknowledge mode
      4. Summary
    13. Batches and Workflows
      1. Workflows and BPM
      2. Batch models
        1. Chunks
          1. Chunk and ETL
          2. Chunk Reader
          3. Chunk processor
          4. Chunk writer
          5. Client
        2. Batchlets
          1. Decision
          2. Mail example
          3. Client
      3. Job context and step context
      4. Metrics and step execution
      5. Listeners
        1. Job listener
        2. Step listener
        3. Chunk listener
          1. Batch property
          2. Checkpoint Algorithm
            1. Checkpoint timeout
      6. Exceptions
      7. Monitoring of the batches
      8. Deploying the workflows
      9. Summary
    14. Working with Servlets and JSP
      1. Undertow
      2. Servlets and web components
        1. Ports and security
        2. Request and response
      3. Cookies
        1. JSP pages
        2. EL Expressions
        3. Cookies operations
        4. Web session and other scopes
        5. Creation of a cookie
        6. Cookies and JavaScript
        7. Tests with Selenium
      4. Error mappings
        1. File configuration
      5. File upload
      6. Filters
        1. HTTP servlet response wrapper
      7. Event listeners
        1. Session listener
        2. Session ID listener
        3. Servlet request listener
        4. Servlet request attribute listener
        5. Session attribute listener
        6. Session binding listener
        7. Session activation listener
        8. Servlet context listener
        9. Servlet context attribute listener
      8. Asynchronous servlet
        1. Non blocking I/O
      9. Protocol handler
      10. Dynamic context registration
      11. External resources and themes
      12. Web fragments
      13. Security
        1. File descriptor security
        2. Programmatic security
        3. Form login
        4. Create a custom JAAS module
      14. Summary
    15. Writing a JSF Application
      1. MVC
        1. Components
        2. Use
        3. Structure
      2. Configuring and developing your application
        1. Internationalization
        2. Navigation
          1. Navigation inside the page
        3. Phases and listeners
      3. Working with Facelets
        1. Web templates
        2. Custom functions
        3. Custom tags
      4. Security
        1. ACL permissions and PicketBox
      5. Summary
    16. Sharing the Web Sessions
      1. Clustering
      2. Infinispan
        1. Distributable applications
      3. Cluster domains
        1. Customize the domains
      4. Summary
    17. WildFly in Cloud
      1. OpenShift
        1. WildFly installation
        2. Command-line tools
        3. Exposed services
      2. Summary
    18. Share your Data
      1. Infinispan and the cluster
        1. LRU and LIRS
      2. JGroups configuration
      3. Singleton HA Services
        1. Writing the Service
        2. Writing the Activator
        3. Client for the Service
      4. Summary
    19. Deployment
      1. Deployment types
        1. Enterprise packages
          1. Web archive
          2. Java archive
            1. EJB
            2. Client application
            3. Simple Java library
          3. Resource adapters
        2. Extension packages
          1. Datasources
          2. Service archives
      2. Deployment tools
        1. Administrator tools
          1. HA deploy
        2. Development tools
      3. Summary
    20. Working with OSGi
      1. Modules
      2. OSGi in WildFly
        1. Installation
        2. Deployment of bundles
        3. Maven bundle plugin
      3. Summary

    Product information

    • Title: Mastering Java EE Development with WildFly
    • Author(s): Luca Stancapiano
    • Release date: June 2017
    • Publisher(s): Packt Publishing
    • ISBN: 9781787287174