public abstract class HttpClientResponse<T>
extends java.lang.Object
HttpClient
| Constructor and Description |
|---|
HttpClientResponse() |
| Modifier and Type | Method and Description |
|---|---|
abstract HttpClientResponse<T> |
addCookie(io.netty.handler.codec.http.cookie.Cookie cookie)
Adds the passed
cookie to this response. |
abstract HttpClientResponse<T> |
addDateHeader(java.lang.CharSequence name,
java.util.Date value)
Adds the passed header as a date value to this response.
|
abstract 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.
|
abstract 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. |
abstract HttpClientResponse<T> |
addHeader(java.lang.CharSequence name,
java.lang.Object value)
Adds an HTTP header with the passed
name and value to this response. |
abstract boolean |
containsHeader(java.lang.CharSequence name)
Checks if there is a header with the passed name in this response.
|
abstract 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.
|
abstract rx.Observable<java.lang.Void> |
discardContent()
Marks the content to be discarded.
|
abstract java.util.List<java.lang.String> |
getAllHeaderValues(java.lang.CharSequence name)
Returns the values of headers with the specified name
|
abstract io.reactivex.netty.channel.ContentSource<T> |
getContent()
Returns the content as a stream.
|
abstract io.reactivex.netty.channel.ContentSource<ServerSentEvent> |
getContentAsServerSentEvents()
Returns the content as a stream of Server sent events.
|
abstract long |
getContentLength()
Returns the length of the content.
|
abstract long |
getContentLength(long defaultValue)
Returns the length of the content.
|
abstract 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.
|
abstract long |
getDateHeader(java.lang.CharSequence name)
Returns the date header value with the specified header name.
|
abstract long |
getDateHeader(java.lang.CharSequence name,
long defaultValue)
Returns the date header value with the specified header name.
|
abstract java.lang.String |
getHeader(java.lang.CharSequence name)
Returns the value of a header with the specified name.
|
abstract java.lang.String |
getHeader(java.lang.CharSequence name,
java.lang.String defaultValue)
Returns the value of a header with the specified name.
|
abstract java.util.Set<java.lang.String> |
getHeaderNames()
Returns a new
Set that contains the names of all headers in this response. |
abstract java.lang.String |
getHost(java.lang.String defaultValue)
Returns the value of the
"Host" header. |
abstract java.lang.String |
getHostHeader()
Returns the value of the
"Host" header. |
abstract io.netty.handler.codec.http.HttpVersion |
getHttpVersion()
Returns the HTTP version for this response.
|
abstract int |
getIntHeader(java.lang.CharSequence name)
Returns the integer header value with the specified header name.
|
abstract int |
getIntHeader(java.lang.CharSequence name,
int defaultValue)
Returns the integer header value with the specified header name.
|
abstract io.netty.handler.codec.http.HttpResponseStatus |
getStatus()
Returns the HTTP status for this response.
|
abstract java.util.Iterator<java.util.Map.Entry<java.lang.CharSequence,java.lang.CharSequence>> |
headerIterator()
Returns an iterator over the header entries.
|
abstract boolean |
isContentLengthSet()
Returns
true if and only if this response has the content-length header set. |
abstract boolean |
isKeepAlive()
Returns
true if and only if the connection can remain open and thus 'kept alive'. |
abstract boolean |
isTransferEncodingChunked()
Checks to see if the transfer encoding of this response is chunked
|
abstract HttpClientResponse<T> |
removeHeader(java.lang.CharSequence name)
Removes the passed header from this response.
|
abstract 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.
|
abstract 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.
|
abstract 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.
|
abstract 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.
|
java.lang.String |
toString() |
abstract <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. |
abstract io.reactivex.netty.channel.Connection<?,?> |
unsafeConnection()
Returns the underlying connection on which this response was received.
|
abstract io.netty.channel.Channel |
unsafeNettyChannel()
Returns the underlying channel on which this response was received.
|
public abstract io.netty.handler.codec.http.HttpVersion getHttpVersion()
public abstract io.netty.handler.codec.http.HttpResponseStatus getStatus()
public abstract java.util.Map<java.lang.String,java.util.Set<io.netty.handler.codec.http.cookie.Cookie>> getCookies()
public abstract boolean containsHeader(java.lang.CharSequence name)
name - Name of the header.true if there is a header with the passed name in this response.public abstract boolean containsHeader(java.lang.CharSequence name,
java.lang.CharSequence value,
boolean ignoreCaseValue)
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 abstract java.util.Iterator<java.util.Map.Entry<java.lang.CharSequence,java.lang.CharSequence>> headerIterator()
public abstract java.lang.String getHeader(java.lang.CharSequence name)
name - The name of the header to searchnull if there is no such headerpublic abstract java.lang.String getHeader(java.lang.CharSequence name,
java.lang.String defaultValue)
name - The name of the header to searchdefaultValue - Default if the header does not exist.defaultValue if there is no such headerpublic abstract java.util.List<java.lang.String> getAllHeaderValues(java.lang.CharSequence name)
name - The name of the headers to searchList of header values which will be empty if no values are foundpublic abstract long getContentLength()
java.lang.NumberFormatException - if the message does not have the "Content-Length" header or its value is
not a number.public abstract long getContentLength(long defaultValue)
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 abstract long getDateHeader(java.lang.CharSequence name)
throws java.text.ParseException
"E, dd MMM yyyy HH:mm:ss z"
name - The name of the header to searchjava.text.ParseException - if there is no such header or the header value is not a formatted datepublic abstract long getDateHeader(java.lang.CharSequence name,
long defaultValue)
"E, dd MMM yyyy HH:mm:ss z"
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 abstract java.lang.String getHostHeader()
"Host" header.public abstract java.lang.String getHost(java.lang.String defaultValue)
"Host" header.defaultValue - Default if the header does not exist."Host" header or defaultValue if there is no such header.public abstract int getIntHeader(java.lang.CharSequence name)
name - The name of the header to searchjava.lang.NumberFormatException - if there is no such header or the header value is not a numberpublic abstract int getIntHeader(java.lang.CharSequence name,
int defaultValue)
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 abstract boolean isContentLengthSet()
true if and only if this response has the content-length header set.public abstract boolean isKeepAlive()
true 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().public abstract boolean isTransferEncodingChunked()
public abstract java.util.Set<java.lang.String> getHeaderNames()
Set that contains the names of all headers in this response. Note that modifying the
returned Set will not affect the state of this response.public abstract HttpClientResponse<T> addHeader(java.lang.CharSequence name, java.lang.Object value)
name and value to this response.name - Name of the header.value - Value for the header.thispublic abstract HttpClientResponse<T> addCookie(io.netty.handler.codec.http.cookie.Cookie cookie)
cookie to this response.cookie - Cookie to add.thispublic abstract HttpClientResponse<T> addDateHeader(java.lang.CharSequence name, java.util.Date value)
HttpHeaders.addDateHeader(HttpMessage, CharSequence, Date) which formats the date as per the
HTTP specifications into the format:
"E, dd MMM yyyy HH:mm:ss z"
name - Name of the header.value - Value of the header.thispublic abstract HttpClientResponse<T> addDateHeader(java.lang.CharSequence name, java.lang.Iterable<java.util.Date> values)
HttpHeaders.addDateHeader(HttpMessage, CharSequence, Date) which formats the date as per the
HTTP specifications into the format:
"E, dd MMM yyyy HH:mm:ss z"
name - Name of the header.values - Values for the header.thispublic abstract HttpClientResponse<T> addHeader(java.lang.CharSequence name, java.lang.Iterable<java.lang.Object> values)
name and values to this response.name - Name of the header.values - Values for the header.thispublic abstract HttpClientResponse<T> setDateHeader(java.lang.CharSequence name, java.util.Date value)
HttpHeaders.addDateHeader(HttpMessage, CharSequence, Date) which formats the date
as per the HTTP specifications into
the format:
"E, dd MMM yyyy HH:mm:ss z"
name - Name of the header.value - Value of the header.thispublic abstract HttpClientResponse<T> setHeader(java.lang.CharSequence name, java.lang.Object value)
name - Name of the header.value - Value of the header.thispublic abstract HttpClientResponse<T> setDateHeader(java.lang.CharSequence name, java.lang.Iterable<java.util.Date> values)
HttpHeaders.addDateHeader(HttpMessage, CharSequence, Date) which formats the
date as per the HTTP specifications
into the format:
"E, dd MMM yyyy HH:mm:ss z"
name - Name of the header.values - Values of the header.thispublic abstract HttpClientResponse<T> setHeader(java.lang.CharSequence name, java.lang.Iterable<java.lang.Object> values)
name - Name of the header.values - Values of the header.thispublic abstract HttpClientResponse<T> removeHeader(java.lang.CharSequence name)
name - Name of the header.thispublic abstract io.reactivex.netty.channel.ContentSource<ServerSentEvent> getContentAsServerSentEvents()
Subscriber to the returned Observable, any subsequent subscriptions will
get an error.ServerSentEvent messages.public abstract io.reactivex.netty.channel.ContentSource<T> getContent()
Subscriber to the returned Observable, any
subsequent subscriptions will get an error.public abstract rx.Observable<java.lang.Void> discardContent()
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 abstract <TT> HttpClientResponse<TT> transformContent(rx.Observable.Transformer<T,TT> transformer)
transformer.HttpClientResponse with transformed content.public abstract io.netty.channel.Channel unsafeNettyChannel()
public abstract io.reactivex.netty.channel.Connection<?,?> unsafeConnection()
public java.lang.String toString()
toString in class java.lang.Object