public final class HttpClientResponseImpl<T> extends HttpClientResponse<T>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
KEEP_ALIVE_HEADER_NAME |
static java.lang.String |
KEEP_ALIVE_TIMEOUT_HEADER_ATTR |
| Modifier and Type | Method and Description |
|---|---|
HttpClientResponse<T> |
addCookie(io.netty.handler.codec.http.cookie.Cookie cookie)
Adds the passed
cookie to this response. |
HttpClientResponse<T> |
addDateHeader(java.lang.CharSequence name,
java.util.Date value)
Adds the passed header as a date value to this response.
|
HttpClientResponse<T> |
addDateHeader(java.lang.CharSequence name,
java.lang.Iterable<java.util.Date> values)
Adds multiple date values for the passed header name to this response.
|
HttpClientResponse<T> |
addHeader(java.lang.CharSequence name,
java.lang.Iterable<java.lang.Object> values)
Adds an HTTP header with the passed
name and values to this response. |
HttpClientResponse<T> |
addHeader(java.lang.CharSequence name,
java.lang.Object value)
Adds an HTTP header with the passed
name and value to this response. |
boolean |
containsHeader(java.lang.CharSequence name)
Checks if there is a header with the passed name in this response.
|
boolean |
containsHeader(java.lang.CharSequence name,
java.lang.CharSequence value,
boolean ignoreCaseValue)
Checks if there is a header with the passed name and value in this response.
|
rx.Observable<java.lang.Void> |
discardContent()
Marks the content to be discarded.
|
java.util.List<java.lang.String> |
getAllHeaderValues(java.lang.CharSequence name)
Returns the values of headers with the specified name
|
io.reactivex.netty.channel.ContentSource<T> |
getContent()
Returns the content as a stream.
|
io.reactivex.netty.channel.ContentSource<ServerSentEvent> |
getContentAsServerSentEvents()
Returns the content as a stream of Server sent events.
|
long |
getContentLength()
Returns the length of the content.
|
long |
getContentLength(long defaultValue)
Returns the length of the content.
|
java.util.Map<java.lang.String,java.util.Set<io.netty.handler.codec.http.cookie.Cookie>> |
getCookies()
Returns an immutable map of cookie names and cookies contained in this response.
|
long |
getDateHeader(java.lang.CharSequence name)
Returns the date header value with the specified header name.
|
long |
getDateHeader(java.lang.CharSequence name,
long defaultValue)
Returns the date header value with the specified header name.
|
java.lang.String |
getHeader(java.lang.CharSequence name)
Returns the value of a header with the specified name.
|
java.lang.String |
getHeader(java.lang.CharSequence name,
java.lang.String defaultValue)
Returns the value of a header with the specified name.
|
java.util.Set<java.lang.String> |
getHeaderNames()
Returns a new
Set that contains the names of all headers in this response. |
java.lang.String |
getHost(java.lang.String defaultValue)
Returns the value of the
"Host" header. |
java.lang.String |
getHostHeader()
Returns the value of the
"Host" header. |
io.netty.handler.codec.http.HttpVersion |
getHttpVersion()
Returns the HTTP version for this response.
|
int |
getIntHeader(java.lang.CharSequence name)
Returns the integer header value with the specified header name.
|
int |
getIntHeader(java.lang.CharSequence name,
int defaultValue)
Returns the integer header value with the specified header name.
|
java.lang.Long |
getKeepAliveTimeoutSeconds()
Parses the timeout value from the HTTP keep alive header (with name
KEEP_ALIVE_HEADER_NAME) as described in
this spec |
io.netty.handler.codec.http.HttpResponseStatus |
getStatus()
Returns the HTTP status for this response.
|
java.util.Iterator<java.util.Map.Entry<java.lang.CharSequence,java.lang.CharSequence>> |
headerIterator()
Returns an iterator over the header entries.
|
boolean |
isContentLengthSet()
Returns
true if and only if this response has the content-length header set. |
boolean |
isKeepAlive()
Returns
true if and only if the connection can remain open and thus 'kept alive'. |
boolean |
isTransferEncodingChunked()
Checks to see if the transfer encoding of this response is chunked
|
static <C> HttpClientResponse<C> |
newInstance(HttpClientResponse<C> unsafeInstance,
io.reactivex.netty.channel.Connection<?,?> connection) |
static <C> HttpClientResponse<C> |
newInstance(io.netty.handler.codec.http.HttpResponse nettyResponse,
io.reactivex.netty.channel.Connection<?,?> connection) |
HttpClientResponse<T> |
removeHeader(java.lang.CharSequence name)
Removes the passed header from this response.
|
HttpClientResponse<T> |
setDateHeader(java.lang.CharSequence name,
java.util.Date value)
Overwrites the current value, if any, of the passed header to the passed date value for this response.
|
HttpClientResponse<T> |
setDateHeader(java.lang.CharSequence name,
java.lang.Iterable<java.util.Date> values)
Overwrites the current value, if any, of the passed header to the passed date values for this response.
|
HttpClientResponse<T> |
setHeader(java.lang.CharSequence name,
java.lang.Iterable<java.lang.Object> values)
Overwrites the current value, if any, of the passed header to the passed values for this response.
|
HttpClientResponse<T> |
setHeader(java.lang.CharSequence name,
java.lang.Object value)
Overwrites the current value, if any, of the passed header to the passed value for this response.
|
<TT> HttpClientResponse<TT> |
transformContent(rx.Observable.Transformer<T,TT> transformer)
Transforms the type of objects read from the content of this response, using the supplied
transformer. |
io.reactivex.netty.channel.Connection<?,?> |
unsafeConnection()
Returns the underlying connection on which this response was received.
|
io.netty.channel.Channel |
unsafeNettyChannel()
Returns the underlying channel on which this response was received.
|
toStringpublic static final java.lang.String KEEP_ALIVE_HEADER_NAME
public static final java.lang.String KEEP_ALIVE_TIMEOUT_HEADER_ATTR
public io.netty.handler.codec.http.HttpVersion getHttpVersion()
HttpClientResponsegetHttpVersion in class HttpClientResponse<T>public io.netty.handler.codec.http.HttpResponseStatus getStatus()
HttpClientResponsegetStatus in class HttpClientResponse<T>public java.util.Map<java.lang.String,java.util.Set<io.netty.handler.codec.http.cookie.Cookie>> getCookies()
HttpClientResponsegetCookies in class HttpClientResponse<T>public boolean containsHeader(java.lang.CharSequence name)
HttpClientResponsecontainsHeader in class HttpClientResponse<T>name - Name of the header.true if there is a header with the passed name in this response.public boolean containsHeader(java.lang.CharSequence name,
java.lang.CharSequence value,
boolean ignoreCaseValue)
HttpClientResponsecontainsHeader in class HttpClientResponse<T>name - Name of the header.value - Value of the header.ignoreCaseValue - true then the value comparision is done ignoring case.true if there is a header with the passed name and value in this response.public java.util.Iterator<java.util.Map.Entry<java.lang.CharSequence,java.lang.CharSequence>> headerIterator()
HttpClientResponseheaderIterator in class HttpClientResponse<T>public java.lang.String getHeader(java.lang.CharSequence name)
HttpClientResponsegetHeader in class HttpClientResponse<T>name - The name of the header to searchnull if there is no such headerpublic java.lang.String getHeader(java.lang.CharSequence name,
java.lang.String defaultValue)
HttpClientResponsegetHeader in class HttpClientResponse<T>name - The name of the header to searchdefaultValue - Default if the header does not exist.defaultValue if there is no such headerpublic java.util.List<java.lang.String> getAllHeaderValues(java.lang.CharSequence name)
HttpClientResponsegetAllHeaderValues in class HttpClientResponse<T>name - The name of the headers to searchList of header values which will be empty if no values are foundpublic long getContentLength()
HttpClientResponsegetContentLength in class HttpClientResponse<T>public long getContentLength(long defaultValue)
HttpClientResponsegetContentLength in class HttpClientResponse<T>defaultValue - Default value if the message does not have a "Content-Length" header or its value is
not a numberdefaultValue if this message does not have the "Content-Length"
header or its value is not a numberpublic long getDateHeader(java.lang.CharSequence name)
HttpClientResponse"E, dd MMM yyyy HH:mm:ss z"
getDateHeader in class HttpClientResponse<T>name - The name of the header to searchpublic long getDateHeader(java.lang.CharSequence name,
long defaultValue)
HttpClientResponse"E, dd MMM yyyy HH:mm:ss z"
getDateHeader in class HttpClientResponse<T>name - The name of the header to searchdefaultValue - Default value if there is no header with this name.defaultValue if there is no header with this name.public java.lang.String getHostHeader()
HttpClientResponse"Host" header.getHostHeader in class HttpClientResponse<T>public java.lang.String getHost(java.lang.String defaultValue)
HttpClientResponse"Host" header.getHost in class HttpClientResponse<T>defaultValue - Default if the header does not exist."Host" header or defaultValue if there is no such header.public int getIntHeader(java.lang.CharSequence name)
HttpClientResponsegetIntHeader in class HttpClientResponse<T>name - The name of the header to searchpublic int getIntHeader(java.lang.CharSequence name,
int defaultValue)
HttpClientResponsegetIntHeader in class HttpClientResponse<T>name - The name of the header to searchdefaultValue - Default if the header does not exist.defaultValue if there is no such header or the header value is not a
numberpublic boolean isContentLengthSet()
HttpClientResponsetrue if and only if this response has the content-length header set.isContentLengthSet in class HttpClientResponse<T>public boolean isKeepAlive()
HttpClientResponsetrue if and only if the connection can remain open and thus 'kept alive'. This methods respects
the value of the "Connection" header first and then the return value of
HttpVersion.isKeepAliveDefault().isKeepAlive in class HttpClientResponse<T>public boolean isTransferEncodingChunked()
HttpClientResponseisTransferEncodingChunked in class HttpClientResponse<T>public java.util.Set<java.lang.String> getHeaderNames()
HttpClientResponseSet that contains the names of all headers in this response. Note that modifying the
returned Set will not affect the state of this response.getHeaderNames in class HttpClientResponse<T>public HttpClientResponse<T> addHeader(java.lang.CharSequence name, java.lang.Object value)
HttpClientResponsename and value to this response.addHeader in class HttpClientResponse<T>name - Name of the header.value - Value for the header.thispublic HttpClientResponse<T> addCookie(io.netty.handler.codec.http.cookie.Cookie cookie)
HttpClientResponsecookie to this response.addCookie in class HttpClientResponse<T>cookie - Cookie to add.thispublic HttpClientResponse<T> addDateHeader(java.lang.CharSequence name, java.util.Date value)
HttpClientResponseHttpHeaders.addDateHeader(HttpMessage, CharSequence, Date) which formats the date as per the
HTTP specifications into the format:
"E, dd MMM yyyy HH:mm:ss z"
addDateHeader in class HttpClientResponse<T>name - Name of the header.value - Value of the header.thispublic HttpClientResponse<T> addDateHeader(java.lang.CharSequence name, java.lang.Iterable<java.util.Date> values)
HttpClientResponseHttpHeaders.addDateHeader(HttpMessage, CharSequence, Date) which formats the date as per the
HTTP specifications into the format:
"E, dd MMM yyyy HH:mm:ss z"
addDateHeader in class HttpClientResponse<T>name - Name of the header.values - Values for the header.thispublic HttpClientResponse<T> addHeader(java.lang.CharSequence name, java.lang.Iterable<java.lang.Object> values)
HttpClientResponsename and values to this response.addHeader in class HttpClientResponse<T>name - Name of the header.values - Values for the header.thispublic HttpClientResponse<T> setDateHeader(java.lang.CharSequence name, java.util.Date value)
HttpClientResponseHttpHeaders.addDateHeader(HttpMessage, CharSequence, Date) which formats the date
as per the HTTP specifications into
the format:
"E, dd MMM yyyy HH:mm:ss z"
setDateHeader in class HttpClientResponse<T>name - Name of the header.value - Value of the header.thispublic HttpClientResponse<T> setHeader(java.lang.CharSequence name, java.lang.Object value)
HttpClientResponsesetHeader in class HttpClientResponse<T>name - Name of the header.value - Value of the header.thispublic HttpClientResponse<T> setDateHeader(java.lang.CharSequence name, java.lang.Iterable<java.util.Date> values)
HttpClientResponseHttpHeaders.addDateHeader(HttpMessage, CharSequence, Date) which formats the
date as per the HTTP specifications
into the format:
"E, dd MMM yyyy HH:mm:ss z"
setDateHeader in class HttpClientResponse<T>name - Name of the header.values - Values of the header.thispublic HttpClientResponse<T> setHeader(java.lang.CharSequence name, java.lang.Iterable<java.lang.Object> values)
HttpClientResponsesetHeader in class HttpClientResponse<T>name - Name of the header.values - Values of the header.thispublic HttpClientResponse<T> removeHeader(java.lang.CharSequence name)
HttpClientResponseremoveHeader in class HttpClientResponse<T>name - Name of the header.thispublic io.reactivex.netty.channel.ContentSource<ServerSentEvent> getContentAsServerSentEvents()
HttpClientResponseSubscriber to the returned Observable, any subsequent subscriptions will
get an error.getContentAsServerSentEvents in class HttpClientResponse<T>ServerSentEvent messages.public io.reactivex.netty.channel.ContentSource<T> getContent()
HttpClientResponseSubscriber to the returned Observable, any
subsequent subscriptions will get an error.getContent in class HttpClientResponse<T>public rx.Observable<java.lang.Void> discardContent()
HttpClientResponsediscardContent in class HttpClientResponse<T>Observable, subscription to which will discard the content. This Observable will
error/complete when the content errors/completes and unsubscription from here will unsubscribe from the content.public <TT> HttpClientResponse<TT> transformContent(rx.Observable.Transformer<T,TT> transformer)
HttpClientResponsetransformer.transformContent in class HttpClientResponse<T>HttpClientResponse with transformed content.public io.netty.channel.Channel unsafeNettyChannel()
HttpClientResponseunsafeNettyChannel in class HttpClientResponse<T>public io.reactivex.netty.channel.Connection<?,?> unsafeConnection()
HttpClientResponseunsafeConnection in class HttpClientResponse<T>public java.lang.Long getKeepAliveTimeoutSeconds()
KEEP_ALIVE_HEADER_NAME) as described in
this specnull if this response does not define the appropriate header value.public static <C> HttpClientResponse<C> newInstance(HttpClientResponse<C> unsafeInstance, io.reactivex.netty.channel.Connection<?,?> connection)
public static <C> HttpClientResponse<C> newInstance(io.netty.handler.codec.http.HttpResponse nettyResponse, io.reactivex.netty.channel.Connection<?,?> connection)