public interface Body
InputStreamBodyImpl
instance. Another example is a policy runtime that wishes to set the body of an outbound service request to a given string, in which case an instance of StringBodyImpl
may be used. The goal of this abstraction is to keep the body in its original state (e.g. a stream) without buffering, materialization or parsing the payload unless it is required.Modifier and Type | Method and Description |
---|---|
JSONArray |
asJSONArray()
Return payload as JSON array
|
JSONObject |
asJSONObject()
Returns payload as JSON object
|
org.w3c.dom.Node |
asNode()
Returns payload as DOM object.
|
java.io.InputStream |
asStream()
Returns the payload as a stream
|
java.lang.String |
asString()
Returns the payload as a String
|
ContentType |
getContentType()
Returns the payload content type, if available
|
java.io.InputStream asStream() throws java.io.IOException
java.io.IOException
- if an error occurs during the payload retrieval or conversionjava.lang.String asString() throws java.io.IOException
java.io.IOException
- if an error occurs during the payload retrieval or conversionJSONObject asJSONObject() throws java.io.IOException
java.io.IOException
- if an error occurs during the payload retrieval or conversionJSONArray asJSONArray() throws java.io.IOException
java.io.IOException
- if an error occurs during the payload retrieval or conversionorg.w3c.dom.Node asNode() throws java.io.IOException
java.io.IOException
- if an error occurs during the payload retrieval or conversionContentType getContentType()