Skip to Main Content
Developing Middleware in Java EE 8
book

Developing Middleware in Java EE 8

by Abdalla Mahmoud
June 2018
Intermediate to advanced content levelIntermediate to advanced
252 pages
6h 45m
English
Packt Publishing
Content preview from Developing Middleware in Java EE 8

Custom responses

As discussed earlier, any response from a RESTful service may include:

  • Status code
  • Response entity
  • Content type

By default, any RESTful service that runs and returns normally without any problems will contain the status code 200 (OK). The response entity will be these value you return from the RESTful method. The content type will be these one specified by the @Produces annotation, as mentioned earlier.

Sometimes, you may need to customize the details of the response yourself at runtime, in one of the following scenarios:

  •  The response entity data type/MIME content type is not known until runtime
  •  A custom status code should be returned to the client according to some business logic inside the RESTful service code

In ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Java EE Development with WildFly

Mastering Java EE Development with WildFly

Luca Stancapiano

Publisher Resources

ISBN: 9781788391078Supplemental Content