Java Reference
In-Depth Information
Table 8-2. MediaType Fields
Field
String
APPLICATION_ATOM_XML
"application/atom+xml"
APPLICATION_ATOM_XML_TYPE
APPLICATION_FORM_URLENCODED
"application/x-www-form-urlencoded"
APPLICATION_FORM_URLENCODED_TYPE
APPLICATION_JSON
"application/json"
APPLICATION_JSON_TYPE
APPLICATION_OCTET_STREAM
"application/octet-stream"
APPLICATION_OCTET_STREAM_TYPE
APPILCATION_SVG_XML
"application/svg+xml"
APPLICATION_SVG_XML_TYPE
APPLICATION_XHTML_XML
"application/xhtml+xml"
APPLICATION_XHTML_XML_TYPE
APPLICATION_XML
"application/xml"
APPLICATION_XML_TYPE
MEDIA_TYPE_WILDCARD
"*"
MULTIPART_FORM_DATA
"multipart/form-data"
MULTIPART_FORM_DATA_TYPE
TEXT_HTML
"text/html"
TEXT_HTML_TYPE
TEXT_PLAIN
"text/plain"
TEXT_PLAIN_TYPE
TEXT_XML
"text/xml"
TEXT_XML_TYPE
WILDCARD
"*/*"
WILDCARD_TYPE
To obtain a requested resource, call the WebTarget.request().get() method, which will return a
javax.ws.rs.core.Response object. The returned Response can be used to process the results accordingly,
depending upon the results you are trying to achieve within the client. In the example, the Response object's
readEntity method is called, which simply returns the results in the requested format. In the example, a
String.class is passed to the readEntity method, implying that a response should be returned in String format.
To see a complete list of methods that can be called against a Response object, please refer to the online
documentation ( http://docs.oracle.com/javaee/7/api/javax/ws/rs/core/Response.html ) because the list is
quite lengthy.
It is possible to filter a response by chaining methods, as needed, to specify headers, cookies, and so on, off
of the request method. Each of these chained method calls returns a Builder object, which can be further built
 
 
Search WWH ::




Custom Search