Class ProxyResponseImpl
- java.lang.Object
-
- com.microsoft.azure.proton.transport.proxy.impl.ProxyResponseImpl
-
- All Implemented Interfaces:
ProxyResponse
public final class ProxyResponseImpl extends java.lang.Object implements ProxyResponse
Represents an HTTP response from a proxy.- See Also:
- RFC2616
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddContent(java.nio.ByteBuffer content)Adds additional content to the HTTP response's body.static ProxyResponsecreate(java.nio.ByteBuffer buffer)Create a proxy response from a givenbuffer.java.nio.ByteBuffergetContents()Gets the HTTP response body.java.lang.StringgetError()Gets the HTTP response body as an error.java.util.Map<java.lang.String,java.util.List<java.lang.String>>getHeaders()Gets the headers for the HTTP response.HttpStatusLinegetStatus()Gets the HTTP status line.booleanisMissingContent()Gets whether or not the HTTP response is complete.
-
-
-
Method Detail
-
create
public static ProxyResponse create(java.nio.ByteBuffer buffer)
Create a proxy response from a givenbuffer. Assumes that thebufferhas been flipped.- Parameters:
buffer- Buffer which could parse to a proxy response.- Returns:
- A new instance of
ProxyResponseImplrepresenting the given buffer. - Throws:
java.lang.IllegalArgumentException- ifbufferhave no content to read.
-
getStatus
public HttpStatusLine getStatus()
Gets the HTTP status line.- Specified by:
getStatusin interfaceProxyResponse- Returns:
- The HTTP status line.
-
getHeaders
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
Gets the headers for the HTTP response.- Specified by:
getHeadersin interfaceProxyResponse- Returns:
- The headers for the HTTP response.
-
getContents
public java.nio.ByteBuffer getContents()
Gets the HTTP response body.- Specified by:
getContentsin interfaceProxyResponse- Returns:
- The HTTP response body.
-
getError
public java.lang.String getError()
Gets the HTTP response body as an error.- Specified by:
getErrorin interfaceProxyResponse- Returns:
- If there is no HTTP response body, an empty string is returned.
-
isMissingContent
public boolean isMissingContent()
Gets whether or not the HTTP response is complete. An HTTP response is complete when the HTTP header and body are received.- Specified by:
isMissingContentin interfaceProxyResponse- Returns:
trueif the HTTP response is complete, andfalseotherwise.
-
addContent
public void addContent(java.nio.ByteBuffer content)
Adds additional content to the HTTP response's body. Assumes that thecontenthas been flipped.- Specified by:
addContentin interfaceProxyResponse- Parameters:
content- Content to add to the body of the HTTP response.- Throws:
java.lang.NullPointerException- ifcontentisnull.java.lang.IllegalArgumentException- ifcontenthave no content to read.
-
-