You are previewing Developing RESTful Web Services with Jersey 2.0.
O'Reilly logo
Developing RESTful Web Services with Jersey 2.0

Book Description

Create RESTful web services smoothly using the robust Jersey 2.0 and JAX-RS APIs

  • Understand and implement the Jersey and JAX-RS APIs with ease

  • Construct top-notch server and client side web services

  • Learn about Server sent events, for showing real-time data

In Detail

JAX-RS 2.0 is an enhanced framework based on RESTful architecture. It provides support for both the client and the server. Jersey 2.0 is the reference implementation of JAX-RS 2.0 (JSR 339 specification). This framework has undergone major revisions. The enhanced framework helps developers to use a low-level and simplified API.

This practical, hands-on guide will help you to create RESTful web services easily with individual aspects of the application requests. It will enable you to learn and implement RESTful web services using the new features included in JAX-RS 2.0. It’s a jump start for those who want to try their hand at the new API. It aims to provide practical knowledge of the API along with detailed understanding.

This book covers the new features of JAX-RS 2.0. It covers the complete lifecycle of a web service, that is, from server side to client side. The book focuses on the server API and the client API.

You will learn how to use the server API in order to create web services that will be deployed on the server. This has all different implementations of HTTP methods and media representations. You will also get acquainted with the client API which specifies how to consume the deployed application’s web services. This includes how to handle different HTTP methods and media representations in response to the web services.

You will also get to know Server Sent Events (SSE), which the server uses to push the data event directly to the client. The book will finally take you through the WADL specification. By the end of the book, you will be well equipped to implement Jersey 2.0 and JAX-RS.

Table of Contents

  1. Developing RESTful Web Services with Jersey 2.0
    1. Table of Contents
    2. Developing RESTful Web Services with Jersey 2.0
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. 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
    8. 1. Getting Started
      1. What is JAX-RS 2.0?
        1. Features of JAX-RS 2.0
      2. Ease of using and reusing JAX-RS artifacts
      3. Modules and dependencies
      4. Creating a new project
      5. Summary
    9. 2. Server API
      1. Root-resource classes
      2. @Path
        1. @Path with a regular expression
      3. HTTP methods
        1. @GET
        2. @PUT
        3. @POST
        4. @DELETE
        5. @Produces
        6. @Consumes
      4. Parameter annotations
        1. @PathParam
        2. @QueryParam
        3. @DefaultValue
        4. @MatrixParam
        5. @HeaderParam
        6. @CookieParam
        7. @FormParam
        8. @BeanParam
      5. Subresources
      6. Scope of the root-resource classes
      7. Rules of injection
      8. Deploying a RESTful web service
      9. Summary
    10. 3. Client API
      1. Consuming web services using a client
        1. The get method
        2. The post method
        3. The put method
        4. The delete method
        5. The path parameter
        6. The query parameter
        7. The cookie parameter
        8. The matrix parameter
        9. The bean parameter
        10. The @Produces annotation
        11. The @Consumes annotation
      2. Use of Invocation.Builder
        1. Adding support for new representations
        2. Client transport connectors
        3. Securing a client
      3. Summary
    11. 4. Common Media-Type Representations
      1. JSON
        1. MOXy
          1. Using ResourceConfig class
        2. Java API for JSON Processing (JSON-P)
        3. Jackson
        4. Jettison
      2. XML
        1. Low-level XML support
        2. JAXB support
        3. POJOs
      3. Multipart
      4. Summary
    12. 5. Server-Sent Events (SSE)
      1. Getting started
      2. Implementing Server-Sent Events (SSE)
        1. Consuming the SSE events
        2. The pull model (Using EventInput)
        3. The push model (using EventSource)
      3. Summary
    13. 6. WADL
      1. Getting started
      2. Configuration
      3. Summary
    14. Index