Book Image

Mastering Java EE Development with WildFly

By : Luca Stancapiano
Book Image

Mastering Java EE Development with WildFly

By: Luca Stancapiano

Overview of this book

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.
Table of Contents (20 chapters)
5
Working with Distributed Transactions
16
WildFly in Cloud

What this book covers

Chapter 1, Introducing Java EE and Configuring the Development Environment, gives an introduction to Java EE, focusing on the novelties introduced in version 7. The book provides several examples, and this chapter will explain how to install and use them when reading the various chapters.

Chapter 2, Working with Dependency Injection, states that dependency injection has brought innovation to the way of programming. The instantiation of automatically rendered objects at the configuration level has made it simpler and more performative in the development of applications, avoiding the problems of lack of memory and memory leaks. Thanks to annotations almost completely replacing XML configurations, development has become even simpler and more portable. In this chapter, we'll see how to use the CDI inside WildFly 10.

Chapter 3, Persistence, explores the significant novelties annotations have brought to the development of entities. It has now become very easy to create objects and make them persistent in a relational database. The JPA deals with this. We will look at the JPA 2.1 features on WildFly 10 in detail, with related examples.

Chapter 4, Implementing Business Logic, says that EJBs are the historical components provided by Java EE to implement the business logic. This chapter will show the novelties and all types of EJBs so that the reader can choose the most suitable component for their needs.

Chapter 5, Working with Distributed Transactions, teaches that distributed transactions are the key element of Java EE. Java Transaction Architecture (JTA) does not need much work to handle transactional operations; it is very easy to handle transactions not only between different applications, but also between different databases and application servers. In this chapter, we will show Narajana, the open source product that implements JTA within WildFly 10 and the possible transaction scenarios.

Chapter 6, Creating REST Services, explains that the latest specifications have conveyed the use of REST as the key to building services. REST is very easy to use, fast, and fits very well with the latest requirements of HTML 5. In this chapter, we will focus on the use of JAX-RS 2.0 implemented by RESTEasy and featured on WildFly since its inception.

Chapter 7, Implementing Web Sockets, states that the main innovation introduced by Java EE 7 is the web sockets that revolutionized the web world as it did in its AJAX times. With web sockets, we finally have a direct channel between the browser and web applications, so asynchronous mechanisms, such as notifications and messaging, make it simpler, safer, and faster.

Chapter 8, Working with Messaging, says that JMS is a historical framework for Java EE. JMS provides good support for writing clients who receive messages from queues or topics. Version 7 introduces improvements in development by leveraging annotations to write a lot less code. In this chapter, we will analyze the development and configuration of the messaging server implemented by ActiveMQ Artemis.

Chapter 9, Implementing a Mail Client, teaches you to send emails with JavaMail. WildFly provides a dedicated session for mails to be included in enterprise applications. We will see several examples and how to test them with the open source SubEtha Mail product.

Chapter 10, Asynchronous REST, finishes the work on REST by dwelling on the asynchronous mechanisms introduced in the last two Java EE specifications, such as timeouts and callbacks. We will write examples of clients using REST asynchronous.

Chapter 11, Asynchronous EJB, continues the discussion of EJBs by focusing on new asynchronous mechanisms, such as timers, schedulers, and timeouts, described in Java EE 6 and 7. We will also provide examples of listener and message-driven beans and explain how to support transactions.

Chapter 12, Batches and Workflows, discusses the scheduler's speech by analyzing new batch specifications introduced in Java EE 7. With WildFly 10, you can write rather complex batches and workflows by competing with highly consolidated BPM specifications.

Chapter 13, Working with Servlets and JSP, is entirely dedicated to the web and its Java components. We'll see how undertow, the new engine that implements web connectors, implements servlets 3.1 and JSP 2.3 through several examples of web pages.

Chapter 14, Writing a JSF Application, outlines how to develop Java Server Faces 2.2 applications with the help of the Mojarra engine present in WildFly 10. We will show examples of configurations, navigation, and major JSF components.

Chapter 15, Sharing the Web Sessions, covers how to set up a cluster with WildFly using standalone and domain mode. This chapter will also teach us how the data is propagated with the help of Infinispan, the product that implements the second-level cache, and which allows us to replicate the data in the WildFly cluster.

Chapter 16, WildFly in Cloud, showcases how to install and use WildFly in a cloud machine provided by OpenShift; the chapter will provide details on this product used to manage cloud machines in an open context.

Chapter 17, Share your Data, analyzes Infinispan components and displays network configurations in order to have special configurations depending on the network used.

Chapter 18, Deployment, looks at deployment as a key part of the application server. We will see examples of deploying different applications and custom configurations in this chapter.

Chapter 19, Working with OSGI, takes you through the modular structure of WildFly provided by JBoss modules, a framework that allows a strong personalization of the components that make up WildFly. In addition, we will see an extension of JBoss modules, JBoss OSGI, which allows us to deploy applications through OSGI.