Book Image

Building RESTful Web Services with Java EE 8

By : Mario-Leander Reimer
Book Image

Building RESTful Web Services with Java EE 8

By: Mario-Leander Reimer

Overview of this book

Java Enterprise Edition is one of the leading application programming platforms for enterprise Java development. With Java EE 8 finally released and the first application servers now available, it is time to take a closer look at how to develop modern and lightweight web services with the latest API additions and improvements. Building RESTful Web Services with Java EE 8 is a comprehensive guide that will show you how to develop state-of-the-art RESTful web services with the latest Java EE 8 APIs. You will begin with an overview of Java EE 8 and the latest API additions and improvements. You will then delve into the details of implementing synchronous RESTful web services and clients with JAX-RS. Next up, you will learn about the specifics of data binding and content marshalling using the JSON-B 1.0 and JSON-P 1.1 APIs. This book also guides you in leveraging the power of asynchronous APIs on the server and client side, and you will learn to use server-sent events (SSEs) for push communication. The final section covers advanced web service topics such as validation, JWT security, and diagnosability. By the end of this book, you will have implemented several working web services and have a thorough understanding of the Java EE 8 APIs required for lightweight web service development.
Table of Contents (8 chapters)

To get the most out of this book

You need the following to get the most out of this book:

  • You need to have basic programming skills and some Java knowledge is required
  • You need a computer with a modern operating system, such as Windows 10, macOS, or Linux
  • You need a working Java 8 language installation; we'll be using Maven 3.5.x as our build tool
  • We'll be using Payara Server 5.x as our Java 8 application server
  • You need Docker for Windows, macOS, or Linux
  • You need an IDE with Java EE 8 support, such as IntelliJ IDEA 2017.3, and you will need a REST client, such as Postman or SoapUI

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Building-RESTful-Web-Services-with-Java-EE-8. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "In the preceding Dockerfile, we mentioned that we're using payara/server-full."

A block of code is set as follows:

        <dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

    @PUT
@Path("/{isbn}")
public Response update(@PathParam("isbn") String isbn, Book book) {
if (!Objects.equals(isbn, book.getIsbn())) {

Any command-line input or output is written as follows:

>docker build -t hello-javaee8:1.0 .

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Let's check our browser, you should see the "Hello World." message."

Warnings or important notes appear like this.
Tips and tricks appear like this.