Book Image

Digital Java EE 7 Web Application Development

By : Peter Pilgrim
Book Image

Digital Java EE 7 Web Application Development

By: Peter Pilgrim

Overview of this book

Digital Java EE 7 presents you with an opportunity to master writing great enterprise web software using the Java EE 7 platform with the modern approach to digital service standards. You will first learn about the lifecycle and phases of JavaServer Faces, become completely proficient with different validation models and schemes, and then find out exactly how to apply AJAX validations and requests. Next, you will touch base with JSF in order to understand how relevant CDI scopes work. Later, you’ll discover how to add finesse and pizzazz to your digital work in order to improve the design of your e-commerce application. Finally, you will deep dive into AngularJS development in order to keep pace with other popular choices, such as Backbone and Ember JS. By the end of this thorough guide, you’ll have polished your skills on the Digital Java EE 7 platform and be able to creat exiting web application.
Table of Contents (21 chapters)
Digital Java EE 7 Web Application Development
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
Index

HTTP


HTTP is a fundamental stateless protocol designed to transport hypermedia between a server and client. HTTP 1.1 supports the fine-grained caching of resources and the ability to retain persistent connections and chunked transfer encoding. HTTP 1.1 was created in 1999 (refer to the superseded RFC https://tools.ietf.org/html/rfc2068). To cope with the modern demand and usage patterns, the HTTP now supports the WebSocket handshaking and upgrade requests (https://tools.ietf.org/html/rfc6455). The next HTTP 2.0 standard will provide the multiplexing of streams over a single client server channel. There are exciting possibilities for Java EE 8 (expected by May/June 2017) and the HTTP 2.0 support in the Java Servlet 4.0 specification. For more details, see RFC 7540 (http://www.rfc-editor.org/rfc/rfc7540.txt) and JSR 369 (https://www.jcp.org/en/jsr/detail?id=369).

An HTTP request

An HTTP request consists of a payload with a header and then body content. The header information contains the URI request, HTTP method, agent information, request parameters, and cookies. For the POST and PUT requests, it may also contain the form encoded properties with names and values.

The four basic HTTP methods that every digital engineer ought to understand are GET, POST, PUT, and DELETE. They are described in the following list:

  • GET: This request fetches the contents of the resources associated with a given URL

  • POST: This creates a brand new resource with a payload (body content) that specifies the data for the new resource

  • PUT: This updates an existing resource with a payload that specifies some or all of the data that is being replaced

  • DELETE: This is a request to delete the specified resource association with the URL

The following are the rare HTTP methods that are also used in special circumstances:

  • HEAD: This performs an acknowledgement of the resources associated with a given URL by just retrieving the headers. This request is similar to the GET request but without the body content.

  • OPTION: This retrieves the application server features or web container capabilities.

  • TRACE: This request allows the infrastructure to find out the network hops between the client and servers and therefore validates the latency, availability, and performance.

An HTTP response

The HTTP response consists of the header information and payload data (the body content). The header contains the HTTP status code, MIME type, data length, last modified date, character set encoding, cookie parameters, and cache information of the resource. The header may also contain the authentication data. The body content is the data returned that is the client's request.

The HTTP Status codes are defined by the W3C. These are integer codes with ranges. Generally, the status codes 100-199 are informational messages, 200-299 represent the successful outcomes, 300-399 represent the redirection requests, 400-499 are server side errors, and the 500-599 status codes represent the authentication failures. Hence, the HTTP OK 200 and 404 NOT FOUND status codes are well-known to developers outside the digital domain. You can find all of them listed in the RFC at http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.