Package com.predic8.membrane.core.http
Class Body
java.lang.Object
com.predic8.membrane.core.http.AbstractBody
com.predic8.membrane.core.http.Body
A message body (streaming, if possible). Use a subclass of
ChunkedBody instead, if
"Transfer-Encoding: chunked" is set on the input.
The "Transfer-Encoding" of the output is not determined by this class hierarchy, but by
AbstractBodyTransferrer and its subclasses.
The caller is responsible to adjust the header accordingly, e.g. the fields Transfer-Encoding and Content-Length.
-
Field Summary
Fields inherited from class com.predic8.membrane.core.http.AbstractBody
chunks, observers -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddiscard()intWarning: Calling this method will trigger reading the body from the client, disabling "streaming".protected byte[]protected voidprotected voidprotected voidprotected voidIs called when there are no observers that need to read the body.Methods inherited from class com.predic8.membrane.core.http.AbstractBody
getContent, getContentAsStream, getObservers, getRaw, getTrailer, hasRelevantObservers, hasTrailer, isRead, markAsRead, read, setTrailer, toString, wasStreamed, write
-
Constructor Details
-
Body
- Throws:
IOException
-
Body
- Throws:
IOException
-
Body
public Body(byte[] content)
-
-
Method Details
-
readLocal
- Specified by:
readLocalin classAbstractBody- Throws:
IOException
-
discard
- Overrides:
discardin classAbstractBody- Throws:
IOException
-
writeAlreadyRead
- Specified by:
writeAlreadyReadin classAbstractBody- Throws:
IOException
-
writeNotRead
- Specified by:
writeNotReadin classAbstractBody- Throws:
IOException
-
writeStreamed
Description copied from class:AbstractBodyIs called when there are no observers that need to read the body. Streams the body without reading it- Specified by:
writeStreamedin classAbstractBody- Throws:
IOException
-
getLength
Description copied from class:AbstractBodyWarning: Calling this method will trigger reading the body from the client, disabling "streaming". UseAbstractBody.isRead()to determine wether the body already has been read, if necessary.- Overrides:
getLengthin classAbstractBody- Returns:
- the length of the return value of
AbstractBody.getContent() - Throws:
IOException
-
getRawLocal
- Specified by:
getRawLocalin classAbstractBody- Throws:
IOException
-