From the course: Java EE: RESTful Service with JAX-RS 2.0

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The HTTP response

The HTTP response

From the course: Java EE: RESTful Service with JAX-RS 2.0

Start my 1-month free trial

The HTTP response

- [Voiceover] Providing a response is an essential part of the Restful API's role. The response must be properly formed, and contain the required information in the appropriate format. Let's look at how to construct a response and how to set the appropriate HTTP Response Code. HTTP Response Codes are sent to the client from the server in order to communicate something about what has happened on the server side. These codes are three digits long, and are split into five broad categories of responses. Those starting with the number one, indicate that the response includes information such as the server has agreed to switch protocol. Those starting two, indicate that the request has been performed successfully, and without error. Those starting three, are also success codes, but indicate that the client must perform an action, such as to redirect to another URL. Those starting with the number four, indicate that a client error has occurred. This means that the client is at fault, and has…

Contents