Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Mario-Leander Reimer [Mario-Leander Reimer]

Rating 3.5 AI initial rating

Learn the fundamentals of Java EE 8 APIs to build effective web services Key Features Design modern and stylish web services with Java EE APIs Secure your web services with JSON Web Tokens Explore the advanced concepts of RESTful web services and the JAX-RS API Book Description 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. What you will learn Dive into the latest Java EE 8 APIs relevant for developing web services Use the new JSON-B APIs for easy data binding Understand how JSON-P API can be used for flexible processing Implement synchronous and asynchronous JAX-RS clients Use server-sent events to implement server-side code Secure Java EE 8 web services with JSON Web Tokens Who this book is for If you're a Java developer who wa

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on, example-driven tour of Java EE 8's web-service APIs that takes you from a first annotated endpoint to asynchronous, event-pushing, JWT-secured services; best for Java developers who want practical JAX-RS fluency rather than theory. 【Book Arc】 - **Opening (~0%–10%)**: Frames Java EE 8 as a lightweight, standards-based platform for microservices, surveys the API landscape (JAX-RS, JSON-P, JSON-B, CDI, JPA), and sets up the toolchain—Maven, Payara Server, Docker, an IDE, and a REST client. - **Early (~10%–30%)**: Builds and packages a first working "hello" microservice, then containerizes it with Docker using both Payara full and Payara micro base images—establishing the deploy-and-test loop reused throughout. - **Middle (~30%–55%)**: Deep dive into synchronous JAX-RS: CRUD resources with `@Path`/`@GET`/`@POST`/`@PUT`/`@DELETE`, CDI injection, sub-resource locators, HTTP status codes and exception mappers, plus a standalone JAX-RS client and testing via Jersey Test Framework and Testcontainers. - **Late (~55%–80%)**: Content marshaling with JSON-B 1.0 (annotation-customizable binding) and JSON-P 1.1 (JSON Pointer/Patch, lambdas and streams), then asynchronous server and client APIs with the reactive client, and Server-Sent Events for push notifications. - **Ending (~80%–100%)**: Advanced topics—design-by-contract validation, JSON Web Token security, and diagnosability of web services—closing with a working library microservice as the cumulative example. 【Key Takeaways】 - **Java EE 8 is pitched as a lightweight microservice platform** (Early): the argument rests on standards, annotation-driven convention-over-configuration, a single `provided`-scope API dependency, thin WARs, and Docker-friendly runtimes like Payara and WildFly Swarm. - **JAX-RS annotations map cleanly onto CRUD semantics** (Middle): `@Path` plus HTTP verbs and `@PathParam` model a books API, with CDI `@Inject` supplying business logic—so REST design becomes a matter of disciplined annotation use. - **Error handling is a first-class design concern** (Middle): proper HTTP status codes combined with exception mappers, and sub-resource locators for nested APIs, keep responses predictable. - **Clients and tests belong in the same workflow** (Middle): a standalone JAX-RS client plus Jersey Test Framework and Testcontainers let you verify the service against a real container rather than mocks. - **JSON-B and JSON-P serve different needs** (Late): JSON-B is the standard, annotation-customizable object-to-JSON binding layer (pluggable runtimes such as Jackson), while JSON-P 1.1 offers flexible tree/model processing with JSON Pointer and Patch. - **Asynchrony spans both sides of the wire** (Late): server-side async resources and the reactive client API address long-running work, while SSE provides one-way server push for notifications. - **Security and operability cap the stack** (Ending): JWT-based authentication and diagnosability turn a demo service into something closer to production-ready. 【Reading Tips】 - Treat Chapters 1–2 as the spine: type the code, run it in Docker, and hit endpoints with Postman—later chapters assume this loop. - Skim the Java EE version history and API overview; deep-read the JAX-RS CRUD, exception-mapping, and client/testing sections where the practical value concentrates. - Hard spots are likely async/reactive client semantics and SSE lifecycle handling—slow down there and compare server and client code side by side. - Keep the GitHub code bundle open; the excerpts show heavy code-block reliance, so reading without running will lose much of the value. - If you already know an older Java EE version, jump straight to JSON-B, async, SSE, and JWT—the early material will be review. 【Coverage Limits】 The excerpts cover the preface, Chapter 1, and the start of Chapter 2 in detail but only summarize later chapters; specifics of the async, SSE, JWT, and validation chapters are not shown, so this guide reflects the book's stated structure rather than verified chapter content.
Excerpt 1
derstand how JSON-P API can be used for flexible processing Implement synchronous and asynchronous JAX-RS clients Use server-sent events to implement server-...
View in text
Excerpt 2
and you will need a REST client, such as Postman or SoapUI Unknown Download the example code files You can download the example code files for this book from...
View in text
Excerpt 3
e most lightweight enterprise framework currently available. In the next section, we're going to have a look what's new in Java EE 8. Unknown What's new in J...
View in text
Excerpt 4
es MediaType.APPLICATION_JSON and returns a JAX-RS response. You can see that we construct a response of ok , which is HTTP 200; as the body, we use bookshel...
View in text
Excerpt 5
Isbn())) { return Response.status(Response.Status.CONFLICT).build(); } The same goes for update ; we should check that the updated ISBN matches the ISBN of t...
View in text
Excerpt 6
Test Framework Let's start with the Jersey Test Framework . We will switch to our IDE and in order to use the Jersey Test Framework, you need to add one simp...
View in text
Excerpt 7
.singletonMap("version", "v2"); return Response.ok(version).build(); } Now, this here will not work correctly because we have two methods producing the same...
View in text
Excerpt 8
  jsonb.toJson(pojo) and we get the string JSON-B from JSON. Pass it the string data and a class you want and the pojo  will be returned: @Test public void t...
View in text
Tags
AI categories
JavaWeb TechnologyBackend
Publisher: Packt Publishing
Publish Year: 2018
Language: English
File Format: EPUB
File Size: 3.5 MB