Book Image

Developing Middleware in Java EE 8

Book Image

Developing Middleware in Java EE 8

Overview of this book

Middleware is the infrastructure in software based applications that enables businesses to solve problems, operate more efficiently, and make money. As the use of middleware extends beyond a single application, the importance of having it written by experts increases substantially. This book will help you become an expert in developing middleware for a variety of applications. The book starts off by exploring the latest Java EE 8 APIs with newer features and managing dependencies with CDI 2.0. You will learn to implement object-to-relational mapping using JPA 2.1 and validate data using bean validation. You will also work with different types of EJB to develop business logic, and with design RESTful APIs by utilizing different HTTP methods and activating JAX-RS features in enterprise applications. You will learn to secure your middleware with Java Security 1.0 and implement various authentication techniques, such as OAuth authentication. In the concluding chapters, you will use various test technologies, such as JUnit and Mockito, to test applications, and Docker to deploy your enterprise applications. By the end of the book, you will be proficient in developing robust, effective, and distributed middleware for your business.
Table of Contents (18 chapters)
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
Index

Seat-booking application


In the following sections, we will create a more advanced application to put together everything we have learned in this chapter.

In a cinema booking application, you typically get prompted with a diagram of available seats, where you can choose one or more seats to book. One of the primary features of such an application is to keep the user updated with any new bookings that have been made while he is still choosing his favorite seats. We will implement a scenario where the user can choose one or more seats, without choosing some other seats being booked in the same moment.

Our application should look as follows:

As you can see, the page shows a simple seat matrix to the user as HTML buttons arranged in a grid. The text color for buttons is as follows:

  • Black: Available seats
  • Red: Seats booked by other users
  • Green: Seats booked by the current user

For the user to book an available seat, all he has to do is click on the seat's button. It should go green (as it has been booked...