public interface Body
Body
interface is used to represent the body of
a HTTP entity. It contains the information that is delivered with
the request. The body is represented by a stream of bytes. In
order to access the entity body this interface provides a stream
which can be used to read it. Also, should the message be encoded
as a multipart message the individual parts can be read using the
Attachment
instance for it.Modifier and Type | Method and Description |
---|---|
String |
getContent()
This will acquire the contents of the body in UTF-8.
|
String |
getContent(String charset)
This will acquire the contents of the body in the specified
charset.
|
InputStream |
getInputStream()
This is used to acquire the contents of the body as a stream.
|
Part |
getPart(String name)
This method is used to acquire a
Part from the
HTTP request using a known name for the part. |
List<Part> |
getParts()
This method is used to get all
Part objects that
are associated with the request. |
String getContent() throws IOException
IOException
String getContent(String charset) throws IOException
IOException
InputStream getInputStream() throws IOException
IOException
Part getPart(String name)
Part
from the
HTTP request using a known name for the part. This is typically
used when there is a file upload with a multipart POST request.
All parts that are not files can be acquired as string values
from the attachment object.name
- this is the name of the part object to acquireList<Part> getParts()
Part
objects that
are associated with the request. Each attachment contains the
body and headers associated with it. If the request is not a
multipart POST request then this will return an empty list.Copyright © 2015. All rights reserved.