Developing RESTful Services with JAX-RS 2.0, WebSockets, and JSON


Developing RESTful Services with JAX-RS 2.0, WebSockets, and JSON
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
$20.39
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
$39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Learning about different client/server communication models including but not limited to client polling, Server-Sent Events and WebSockets.
  • Efficiently use WebSockets, Server-Sent Events, and JSON in Java EE applications
  • Learn about JAX-RS 2.0 new features and enhancements
  • Improve scalability with asynchronous processing

 

Book Details

Language : English
Paperback : 128 pages [ 235mm x 191mm ]
Release Date : October 2013
ISBN : 1782178120
ISBN 13 : 9781782178125
Author(s) : Bhakti Mehta, Masoud Kalali
Topics and Technologies : All Books, Enterprise, Java, Web Services

Table of Contents

Preface
Chapter 1: Building RESTful Web Services Using JAX-RS
Chapter 2: WebSockets and Server-sent Events
Chapter 3: Understanding WebSockets and Server-sent Events in Detail
Chapter 4: JSON and Asynchronous Processing
Chapter 5: RESTful Web Services by Example
Index
  • Chapter 1: Building RESTful Web Services Using JAX-RS
    • Understanding REST
    • RESTful Web Services
    • Verbs in REST
      • Safety and idempotence
    • Introduction to JAX-RS
      • Converting POJOs to RESTful resources
        • Defining a root resource as identified by a URI
        • Defining the methods for the resource
        • Defining the MIME types
        • Defining the Application subclass
        • Defining the subresources
      • More on JAX-RS annotations
      • The Client API for JAX-RS
      • Entities in JAX-RS
      • Custom entity providers in JAX-RS
        • MessageBodyReader
        • MessageBodyWriter
      • Using the Bean Validation API with JAX-RS
        • Enabling validation in the application
        • Reading validation errors from the response
    • Summary
    • Chapter 2: WebSockets and Server-sent Events
      • The programming models
        • Polling
        • Long polling
          • Chunked transfer encoding
      • Emerging standards
        • Server-sent Events
          • The SSE anatomy
        • Associating an ID with an event
          • Connection loss and reconnecting retries
          • Associating event names with events
          • Server-sent Events and JavaScript
        • WebSockets
          • WebSocket handshake
          • Browser and JavaScript support for WebSockets
      • Java EE and the emerging standards
        • Java EE and Server-sent Events
        • Java EE and WebSockets
      • Comparison and use cases of different programming models and standards
      • Summary
      • Chapter 3: Understanding WebSockets and Server-sent Events in Detail
        • Encoders and decoders in Java API for WebSockets
        • The Java WebSocket Client API
        • Sending different kinds of message data: blob/binary
        • Security and WebSockets
        • Best practices for WebSockets-based applications
          • Throttling the rate of sending data
          • Controlling the maximum size of the message
          • Working with proxy servers and WebSockets
        • Server-sent Events
          • Developing a Server-sent Event client using Jersey API
        • Best practices for applications based on Server-sent Events
          • Checking if the event source's origin is as expected
          • Working with proxy servers and Server-sent Events
          • Handling fault tolerance for Server-sent Events
        • Summary
        • Chapter 4: JSON and Asynchronous Processing
          • Producing and parsing JSON documents
            • An overview of JSON API
            • Manipulating JSON documents using the event-based API
            • Producing JSON documents
            • Parsing JSON documents
            • Manipulating JSON documents using the JSON object model
              • Generating JSON documents
              • Parsing JSON documents
            • When to use the streaming versus the object API
          • Introducing Servlet 3.1
            • NIO API and Servlet 3.1
            • Introducing ReadListener and WriteListener
            • Changes in the Servlet API interfaces
              • More changes in Servlet 3.1
          • New features in JAX-RS 2.0
            • Asynchronous request and response processing
            • Filters and interceptors
          • Asynchronous processing in EJB 3.1 and 3.2
            • Developing an asynchronous session bean
            • Developing a client servlet for the async session bean
          • Summary
          • Chapter 5: RESTful Web Services by Example
            • Event notification application
              • The project's layout
              • The event notification GUI
              • A detailed look at the event notification application
                • The web.xml
                • The implementation of the Application class
                • The JAX-RS resource used by the application
                • The Asynchronous Servlet client used by the application
                • The EJB that interacts with the Twitter Search API
            • The library application
              • How the application is deployed
              • The project's layout
              • The library application GUI
              • Application interaction monitoring
              • A detailed look at the library application
                • The web.xml
                • The Application subclass
                • JAX-RS Entity Provider: BookCollectionWriter
                • The HTML page
                • Browsing the collection of books
                • Searching for a book
                • Checking out a book
                • Returning a book
                • Placing a hold on a book
                • The Singleton EJB BookService
            • Summary

            Bhakti Mehta

            Bhakti Mehta is a Senior Technology Professional with over 12 years of experience in architecting, designing, and implementing Software Solutions on top of Java EE and other related technologies. On the platform level, she is well experienced in different areas of GlassFish Application Server and Java EE specifications. Bhakti is experienced in developing open source software and working with open source communities and customers. She is a member of the GlassFish team at Oracle. Bhakti's primary areas of interest are server-side technologies, XML, Web Services, Java EE, and Cloud. She has a bachelors degree in Computer Engineering and a masters degree in Computer Science. Bhakti is a regular speaker in various conferences along with having articles and enterprise tech tips at different portals. Her tweets can be followed at @bhakti_mehta.

            Masoud Kalali

            Masoud Kalali has been working on software development projects since 1998, which gives him a broad perspective on software development in general and changes in the software development landscape in the past 1.5 decades. Masoud has experience with a variety of technologies (.NET, J2EE, CORBA, and COM+) on diverse platforms (Solaris, Linux, and Windows). He has a masters degree in Information Systems with a bachelor degree in Software Engineering. Masoud has authored a fair number of articles and other types of material, including several articles at Java.net and Dzone. He is the author of multiple refcardz, published by Dzone, including but not limited to Using XML in Java (http://refcardz.dzone.com/refcardz/using-xml-java) and Security and GlassFish v3 (http://refcardz.dzone.com/refcardz/getting-startedglassfish) refcardz. Masoud is one of the founding members of NetBeans Dream Team (http://wiki.netbeans.org/NetBeansDreamTeam) and a GlassFish community spotlighted developer (https://glassfish.java.net/public/developers.html). Masoud is the author of GlassFish Security (http://www.packtpub.com/glassfish-security/book) that was published in 2010, covering GlassFish v3 security and Java EE 6 security. Masoud's main area of research and interest includes service-oriented architecture and large-scale systems development and deployment. In his spare time he enjoys photography, mountaineering, and climbing. Masoud's Twitter handle is @MasoudKalali if you want to know what he is up to.
            Sorry, we don't have any reviews for this title yet.

            Code Downloads

            Download the code and support files for this book.


            Submit Errata

            Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

            Sample chapters

            You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

            Frequently bought together

            Developing RESTful Services with JAX-RS 2.0, WebSockets, and JSON +    Ruby on Rails Web Mashup Projects =
            50% Off
            the second eBook
            Price for both: $28.20

            Buy both these recommended eBooks together and get 50% off the cheapest eBook.

            What you will learn from this book

            • Develop RESTful Web Services using the JAX-RS 2.0 API
            • Build applications with the JavaScript and Java Client API for WebSockets and Server-Sent Events
            • Understand security and fault tolerance with WebSockets and Server-Sent Events
            • Produce, parse, and manipulate JSON data with the help of standard JSON API
            • Cover best practices in building applications with WebSockets, Server-Sent Events, and JAX-RS 2.0
            • Learn the aspects of asynchronous programming to improve scalability

            In Detail

            As the technology landscape moves focus towards smaller devices, the need for building scalable, flexible, lightweight, and real-time communications-based applications grows. HTML 5 and Java EE 7 provide a new synthesis of technologies that demonstrate tremendous scope and potential in areas of device independence, asynchronous communication, interoperability, and portability.

            Developing RESTful Services with JAX-RS 2.0, WebSockets, and JSON is a practical, hands-on guide that provides you with clear and pragmatic information to take advantage of the real power behind HTML5 and Java EE technologies. This book also gives you a good foundation for using them in your applications.

            Developing RESTful Services with JAX-RS 2.0, WebSockets, and JSON looks at the different HTML5-based Java EE 7 API, and takes a deep dive into the individual areas of technologies to cover basic to advanced concepts, and also provides best practices for each API. You will also learn how to build a REST-based Event Notification Application using the Twitter API, tying all the different technologies together that we will cover. You will also take a look at integrating different Java EE APIs to build a Library Application. If you want to take advantage of using the new HTML5 technologies and Java EE 7 platform, then this is the book for you. You will learn everything you need to know to build portable RESTful Web Services with JAX-RS 2.0, Web Sockets, JSON, and Server-Sent Events.

            Approach

            Written as an easy and practical guide, this book is a crash course on using JAX-RS 2.0, WebSockets and JSON to develop RESTful services.

            Who this book is for

            Developing RESTful Services with JAX-RS 2.0, WebSockets, and JSON is a perfect reading source for application developers who are familiar with Java EE and are keen to understand the new HTML5-related functionality introduced in Java EE 7 to improve productivity. To take full advantage of this book, you need to be familiar with Java EE and have some basic understanding of using the GlassFish application server.

            Code Download and Errata
            Packt Anytime, Anywhere
            Register Books
            Print Upgrades
            eBook Downloads
            Video Support
            Contact Us
            Awards Voting Nominations Previous Winners
            Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
            Resources
            Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software