Class GrizzlyResponseBodyPart
java.lang.Object
com.ning.http.client.HttpResponseBodyPart
com.ning.http.client.providers.grizzly.GrizzlyResponseBodyPart
HttpResponseBodyPart implementation using the Grizzly 2.0 HTTP client
codec.- Since:
- 1.7.0
- Author:
- The Grizzly Team
-
Constructor Summary
ConstructorsConstructorDescriptionGrizzlyResponseBodyPart(org.glassfish.grizzly.http.HttpContent content, org.glassfish.grizzly.Connection connection) Deprecated.GrizzlyResponseBodyPart(org.glassfish.grizzly.http.HttpContent content, org.glassfish.grizzly.filterchain.FilterChainContext context) -
Method Summary
Modifier and TypeMethodDescriptionReturn aByteBufferthat wraps the actual bytes read from the response's chunk.byte[]Return the response body's part bytes received.Retrieves aPauseHandlerto pause/resume event processing.booleanisLast()Return true if this is the last part.booleanReturn true of the underlying connection will be closed once the response has been fully processed.intlength()Return length of this part in bytes.voidClose the underlying connection once the processing has completed.intwriteTo(OutputStream outputStream) Write the available bytes to theOutputStream
-
Constructor Details
-
GrizzlyResponseBodyPart
public GrizzlyResponseBodyPart(org.glassfish.grizzly.http.HttpContent content, org.glassfish.grizzly.filterchain.FilterChainContext context) -
GrizzlyResponseBodyPart
@Deprecated public GrizzlyResponseBodyPart(org.glassfish.grizzly.http.HttpContent content, org.glassfish.grizzly.Connection connection) Deprecated.
-
-
Method Details
-
getBodyPartBytes
public byte[] getBodyPartBytes()Description copied from class:HttpResponseBodyPartReturn the response body's part bytes received.- Specified by:
getBodyPartBytesin classHttpResponseBodyPart- Returns:
- the response body's part bytes received.
-
writeTo
Description copied from class:HttpResponseBodyPartWrite the available bytes to theOutputStream- Specified by:
writeToin classHttpResponseBodyPart- Returns:
- The number of bytes written
- Throws:
IOException
-
getBodyByteBuffer
Description copied from class:HttpResponseBodyPartReturn aByteBufferthat wraps the actual bytes read from the response's chunk. TheByteBuffercapacity is equal to the number of bytes available.- Specified by:
getBodyByteBufferin classHttpResponseBodyPart- Returns:
ByteBuffer
-
isLast
public boolean isLast()Description copied from class:HttpResponseBodyPartReturn true if this is the last part.- Overrides:
isLastin classHttpResponseBodyPart- Returns:
- true if this is the last part.
-
markUnderlyingConnectionAsToBeClosed
public void markUnderlyingConnectionAsToBeClosed()Description copied from class:HttpResponseBodyPartClose the underlying connection once the processing has completed. Invoking that method means the underlying TCP connection will be closed as soon as the processing of the response is completed. That means the underlying connection will never get pooled.- Overrides:
markUnderlyingConnectionAsToBeClosedin classHttpResponseBodyPart
-
isUnderlyingConnectionToBeClosed
public boolean isUnderlyingConnectionToBeClosed()Description copied from class:HttpResponseBodyPartReturn true of the underlying connection will be closed once the response has been fully processed.- Overrides:
isUnderlyingConnectionToBeClosedin classHttpResponseBodyPart- Returns:
- true of the underlying connection will be closed once the response has been fully processed.
-
length
public int length()Description copied from class:HttpResponseBodyPartReturn length of this part in bytes.- Specified by:
lengthin classHttpResponseBodyPart
-
getPauseHandler
Description copied from class:HttpResponseBodyPartRetrieves aPauseHandlerto pause/resume event processing. Useful when anAsyncHandler's resources are saturated, and it can't handle the body part temporarily. If the handler uses thePauseHandler.requestPause()method, it's also responsible for callingPauseHandler.resume()when it could handle the part correctly.- Overrides:
getPauseHandlerin classHttpResponseBodyPart- Returns:
- a
PauseHandlerto pause the events processing in the current http transaction.
-