Book Image

RESTful Java Web Services, Second Edition

Book Image

RESTful Java Web Services, Second Edition

Overview of this book

Table of Contents (17 chapters)
RESTful Java Web Services Second Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Supporting custom request-response message formats


The JAX-RS framework uses entity provider components for the marshalling and unmarshalling of the message body content (entity) present in the response and request objects, respectively. It is the entity provider component that maps an entity with the associated Java types.

The following table lists the default entity mappings provided by the JAX-RS runtime via a set of built-in entity providers. When you use one of the Internet media types present in the following table for representing the request or response entity body, the framework takes care of the conversion and reconversion of the entity body to the associated Java type:

Data types

Internet media type

byte[]

*/*

java.lang.String

*/*

java.io.Reader

*/*

java.io.File

*/*

javax.activation.DataSource

*/*

javax.ws.rs.core.StreamingOutput

*/*

All primitive types

text/plain

java.lang.Boolean

text/plain

java.lang.Character

text/plain

...