public interface Body
Body is a stateful object. In particular, the following methods will only execute successfully when the
body is already available in memory:
- getContent()
- newInputStream()
- getLength()
isInMemory() will return true when these methods will complete successfully.| Modifier and Type | Method and Description |
|---|---|
byte[] |
getContent()
Gets the body content as a byte array, if the body content is available in memory--
isInMemory()
returns true when this is the case. |
int |
getLength()
Gets the length of the body content, if the body content is available in memory--
isInMemory()
returns true when this is the case. |
boolean |
isInMemory()
Returns true if the body content is in memory.
|
boolean |
isRead()
Returns true if the body content has been read.
|
InputStream |
newInputStream()
Gets the body content as an
InputStream, if the body content is available in
memory--isInMemory() returns true when this is the case. |
Map<String,String[]> |
parseFormParams()
Parses form parameters from the body content, assuming the content is encoded following the encoding defined by
the application/x-www-form-urlencoded content type and a default character encoding of UTF-8.
|
void |
read()
Read the body content into memory.
|
String |
toString()
A debugging function to provide a String representation of the body content.
|
void read() throws AccessException, IOException
isRead() returns true, this method will return immediately and not perform any I/O.AccessException - the body content length is determined to be greater than the configured maximumIOException - on I/O error while reading the body contentboolean isRead()
boolean isInMemory()
byte[] getContent()
isInMemory()
returns true when this is the case.
This method returns a copy of the byte array. To avoid the copy, use newInputStream().IllegalStateException - if the body content is not available in memory. isInMemory() will
return true when this method will execute successfully.InputStream newInputStream()
InputStream, if the body content is available in
memory--isInMemory() returns true when this is the case.InputStream.IllegalStateException - if the body content is not available in memory. isInMemory() will
return true when this method will execute successfully.int getLength()
isInMemory()
returns true when this is the case.IllegalStateException - if the body content is not available in memory. isInMemory() will
return true when this method will execute successfully.Map<String,String[]> parseFormParams()
isInMemory() returns true when
this is the case.IllegalStateException - if the body content is not available in memory. isInMemory() will
return true when this method will execute successfully.IllegalArgumentException - if the body content is not valid application/x-www-form-urlencoded contentString toString()
toString in class ObjectgetContent() assuming an encoding
of UTF-8. If the body has not been read into memory yet, the empty string is returned.Copyright 2023 Ping Identity Corp. All rights reserved.