public final class HttpServerResponseImpl<C> extends HttpServerResponse<C>
| Modifier and Type | Method and Description |
|---|---|
WebSocketHandshaker |
acceptWebSocketUpgrade(WebSocketHandler handler)
Accepts the upgrade to websockets, if requested and after sending a successful handshake response,
invokes the passed handler to handle the websocket connection.
|
HttpServerResponse<C> |
addCookie(io.netty.handler.codec.http.cookie.Cookie cookie)
Adds the passed
cookie to this response. |
HttpServerResponse<C> |
addDateHeader(java.lang.CharSequence name,
java.util.Date value)
Adds the passed header as a date value to this response.
|
HttpServerResponse<C> |
addDateHeader(java.lang.CharSequence name,
java.lang.Iterable<java.util.Date> values)
Adds multiple date values for the passed header name to this response.
|
HttpServerResponse<C> |
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. |
HttpServerResponse<C> |
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.
|
static <T> HttpServerResponse<T> |
create(HttpServerRequest<?> request,
io.reactivex.netty.channel.Connection connection,
io.netty.handler.codec.http.HttpResponse headers) |
rx.Observable<java.lang.Void> |
dispose()
Disposes this response.
|
HttpServerResponse<C> |
flushOnlyOnReadComplete()
This is a performance optimization to not flush the channel on every response send.
|
java.util.List<java.lang.String> |
getAllHeaderValues(java.lang.CharSequence name)
Returns the values of headers with the specified name
|
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. |
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.
|
io.netty.handler.codec.http.HttpResponseStatus |
getStatus()
Returns the status of this response.
|
HttpServerResponse<C> |
removeHeader(java.lang.CharSequence name)
Removes the passed header from this response.
|
ResponseContentWriter<C> |
sendHeaders()
Sends the headers for this response when the returned
Observable is subscribed. |
HttpServerResponse<C> |
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.
|
HttpServerResponse<C> |
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.
|
HttpServerResponse<C> |
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.
|
HttpServerResponse<C> |
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.
|
HttpServerResponse<C> |
setStatus(io.netty.handler.codec.http.HttpResponseStatus status)
Sets the status for the response.
|
HttpServerResponse<C> |
setTransferEncodingChunked()
Sets the HTTP transfer encoding to chunked for this response.
|
<CC> HttpServerResponse<CC> |
transformContent(io.reactivex.netty.channel.AllocatingTransformer<CC,C> transformer)
Creates a new
HttpServerResponse instance modifying the content type using the passed transformer. |
HttpServerResponse<ServerSentEvent> |
transformToServerSentEvents()
Converts this response to enable writing
ServerSentEvents. |
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.
|
ResponseContentWriter<C> |
write(rx.Observable<C> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel. |
<T extends TrailingHeaders> |
write(rx.Observable<C> contentSource,
rx.functions.Func0<T> trailerFactory,
rx.functions.Func2<T,C,T> trailerMutator)
Uses the passed
Observable as the source of content for this request. |
<T extends TrailingHeaders> |
write(rx.Observable<C> contentSource,
rx.functions.Func0<T> trailerFactory,
rx.functions.Func2<T,C,T> trailerMutator,
rx.functions.Func1<C,java.lang.Boolean> flushSelector)
Uses the passed
Observable as the source of content for this request. |
ResponseContentWriter<C> |
write(rx.Observable<C> msgs,
rx.functions.Func1<C,java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
ResponseContentWriter<C> |
writeAndFlushOnEach(rx.Observable<C> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
ResponseContentWriter<C> |
writeBytes(rx.Observable<byte[]> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel. |
<T extends TrailingHeaders> |
writeBytes(rx.Observable<byte[]> contentSource,
rx.functions.Func0<T> trailerFactory,
rx.functions.Func2<T,byte[],T> trailerMutator)
Uses the passed
Observable as the source of content for this request. |
<T extends TrailingHeaders> |
writeBytes(rx.Observable<byte[]> contentSource,
rx.functions.Func0<T> trailerFactory,
rx.functions.Func2<T,byte[],T> trailerMutator,
rx.functions.Func1<byte[],java.lang.Boolean> flushSelector)
Uses the passed
Observable as the source of content for this request. |
ResponseContentWriter<C> |
writeBytes(rx.Observable<byte[]> msgs,
rx.functions.Func1<byte[],java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
ResponseContentWriter<C> |
writeBytesAndFlushOnEach(rx.Observable<byte[]> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
ResponseContentWriter<C> |
writeString(rx.Observable<java.lang.String> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel. |
<T extends TrailingHeaders> |
writeString(rx.Observable<java.lang.String> contentSource,
rx.functions.Func0<T> trailerFactory,
rx.functions.Func2<T,java.lang.String,T> trailerMutator)
Uses the passed
Observable as the source of content for this request. |
<T extends TrailingHeaders> |
writeString(rx.Observable<java.lang.String> contentSource,
rx.functions.Func0<T> trailerFactory,
rx.functions.Func2<T,java.lang.String,T> trailerMutator,
rx.functions.Func1<java.lang.String,java.lang.Boolean> flushSelector)
Uses the passed
Observable as the source of content for this request. |
ResponseContentWriter<C> |
writeString(rx.Observable<java.lang.String> msgs,
rx.functions.Func1<java.lang.String,java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
ResponseContentWriter<C> |
writeStringAndFlushOnEach(rx.Observable<java.lang.String> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
all, amb, amb, amb, amb, amb, amb, amb, amb, amb, ambWith, asObservable, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, cache, cache, cast, collect, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, compose, concat, concat, concat, concat, concat, concat, concat, concat, concat, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatEager, concatMap, concatMapEager, concatMapEager, concatWith, contains, count, countLong, create, debounce, debounce, debounce, defaultIfEmpty, defer, delay, delay, delay, delay, delaySubscription, delaySubscription, delaySubscription, dematerialize, distinct, distinct, distinctUntilChanged, distinctUntilChanged, doOnCompleted, doOnEach, doOnEach, doOnError, doOnNext, doOnRequest, doOnSubscribe, doOnTerminate, doOnUnsubscribe, elementAt, elementAtOrDefault, empty, error, exists, extend, filter, finallyDo, first, first, firstOrDefault, firstOrDefault, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMapIterable, flatMapIterable, forEach, forEach, forEach, from, from, from, from, from, fromCallable, groupBy, groupBy, groupJoin, ignoreElements, interval, interval, interval, interval, isEmpty, join, just, just, just, just, just, just, just, just, just, just, last, last, lastOrDefault, lastOrDefault, lift, limit, map, materialize, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeWith, nest, never, observeOn, ofType, onBackpressureBuffer, onBackpressureBuffer, onBackpressureBuffer, onBackpressureDrop, onBackpressureDrop, onBackpressureLatest, onErrorResumeNext, onErrorResumeNext, onErrorReturn, onExceptionResumeNext, publish, publish, range, range, reduce, reduce, repeat, repeat, repeat, repeat, repeatWhen, repeatWhen, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, retry, retry, retry, retryWhen, retryWhen, sample, sample, sample, scan, scan, sequenceEqual, sequenceEqual, serialize, share, single, single, singleOrDefault, singleOrDefault, skip, skip, skip, skipLast, skipLast, skipLast, skipUntil, skipWhile, startWith, startWith, startWith, startWith, startWith, startWith, startWith, startWith, startWith, startWith, startWith, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeOn, switchIfEmpty, switchMap, switchOnNext, take, take, take, takeFirst, takeLast, takeLast, takeLast, takeLast, takeLast, takeLastBuffer, takeLastBuffer, takeLastBuffer, takeLastBuffer, takeLastBuffer, takeUntil, takeUntil, takeWhile, throttleFirst, throttleFirst, throttleLast, throttleLast, throttleWithTimeout, throttleWithTimeout, timeInterval, timeInterval, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timer, timer, timer, timer, timestamp, timestamp, toBlocking, toList, toMap, toMap, toMap, toMultimap, toMultimap, toMultimap, toMultimap, toSingle, toSortedList, toSortedList, toSortedList, toSortedList, unsafeSubscribe, unsubscribeOn, using, using, window, window, window, window, window, window, window, window, window, window, window, window, withLatestFrom, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipWith, zipWithpublic io.netty.handler.codec.http.HttpResponseStatus getStatus()
HttpServerResponseHttpResponseStatus.OKgetStatus in class HttpServerResponse<C>public boolean containsHeader(java.lang.CharSequence name)
HttpServerResponsecontainsHeader in class HttpServerResponse<C>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)
HttpServerResponsecontainsHeader in class HttpServerResponse<C>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.lang.String getHeader(java.lang.CharSequence name)
HttpServerResponsegetHeader in class HttpServerResponse<C>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)
HttpServerResponsegetHeader in class HttpServerResponse<C>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)
HttpServerResponsegetAllHeaderValues in class HttpServerResponse<C>name - The name of the headers to searchList of header values which will be empty if no values are foundpublic long getDateHeader(java.lang.CharSequence name)
HttpServerResponse"E, dd MMM yyyy HH:mm:ss z"
getDateHeader in class HttpServerResponse<C>name - The name of the header to searchpublic long getDateHeader(java.lang.CharSequence name,
long defaultValue)
HttpServerResponse"E, dd MMM yyyy HH:mm:ss z"
getDateHeader in class HttpServerResponse<C>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 int getIntHeader(java.lang.CharSequence name)
HttpServerResponsegetIntHeader in class HttpServerResponse<C>name - The name of the header to searchpublic int getIntHeader(java.lang.CharSequence name,
int defaultValue)
HttpServerResponsegetIntHeader in class HttpServerResponse<C>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 java.util.Set<java.lang.String> getHeaderNames()
HttpServerResponseSet 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 HttpServerResponse<C>public HttpServerResponse<C> addHeader(java.lang.CharSequence name, java.lang.Object value)
HttpServerResponsename and value to this response.addHeader in class HttpServerResponse<C>name - Name of the header.value - Value for the header.thispublic HttpServerResponse<C> addCookie(io.netty.handler.codec.http.cookie.Cookie cookie)
HttpServerResponsecookie to this response.addCookie in class HttpServerResponse<C>cookie - Cookie to add.thispublic HttpServerResponse<C> addDateHeader(java.lang.CharSequence name, java.util.Date value)
HttpServerResponseHttpHeaders.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 HttpServerResponse<C>name - Name of the header.value - Value of the header.thispublic HttpServerResponse<C> addDateHeader(java.lang.CharSequence name, java.lang.Iterable<java.util.Date> values)
HttpServerResponseHttpHeaders.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 HttpServerResponse<C>name - Name of the header.values - Values for the header.thispublic HttpServerResponse<C> addHeader(java.lang.CharSequence name, java.lang.Iterable<java.lang.Object> values)
HttpServerResponsename and values to this response.addHeader in class HttpServerResponse<C>name - Name of the header.values - Values for the header.thispublic HttpServerResponse<C> setDateHeader(java.lang.CharSequence name, java.util.Date value)
HttpServerResponseHttpHeaders.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 HttpServerResponse<C>name - Name of the header.value - Value of the header.thispublic HttpServerResponse<C> setHeader(java.lang.CharSequence name, java.lang.Object value)
HttpServerResponsesetHeader in class HttpServerResponse<C>name - Name of the header.value - Value of the header.thispublic HttpServerResponse<C> setDateHeader(java.lang.CharSequence name, java.lang.Iterable<java.util.Date> values)
HttpServerResponseHttpHeaders.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 HttpServerResponse<C>name - Name of the header.values - Values of the header.thispublic HttpServerResponse<C> setHeader(java.lang.CharSequence name, java.lang.Iterable<java.lang.Object> values)
HttpServerResponsesetHeader in class HttpServerResponse<C>name - Name of the header.values - Values of the header.thispublic HttpServerResponse<C> removeHeader(java.lang.CharSequence name)
HttpServerResponseremoveHeader in class HttpServerResponse<C>name - Name of the header.thispublic HttpServerResponse<C> setStatus(io.netty.handler.codec.http.HttpResponseStatus status)
HttpServerResponsesetStatus in class HttpServerResponse<C>status - Status to set.thispublic HttpServerResponse<C> setTransferEncodingChunked()
HttpServerResponseHttpHeaders.setTransferEncodingChunked(HttpMessage)setTransferEncodingChunked in class HttpServerResponse<C>thispublic HttpServerResponse<C> flushOnlyOnReadComplete()
HttpServerResponseObservable written). Something like this:
resp.sendHeaders()
.writeStringAndFlushOnEach(Observable.interval(1, TimeUnit.SECONDS))
.map(aLong -> "Interval =>" + aLong)
)
RequestHandler, something like:
response.writeString(Observable.just("Hello world");
When set, this will make the channel to be flushed only when all the requests available on the channel are
read. Thus, making it possible to do a gathering write for all pipelined requests on a connection. This reduces
the number of system calls and is helpful in "Hello World" benchmarks.flushOnlyOnReadComplete in class HttpServerResponse<C>public ResponseContentWriter<C> sendHeaders()
HttpServerResponseObservable is subscribed. Alternatively, one can
continue to write contents using the returned ResponseContentWritersendHeaders in class HttpServerResponse<C>ResponseContentWriter which can be subscribed to only send the headers or to write payload.public HttpServerResponse<ServerSentEvent> transformToServerSentEvents()
HttpServerResponseServerSentEvents.transformToServerSentEvents in class HttpServerResponse<C>ServerSentEvent enabled.public <CC> HttpServerResponse<CC> transformContent(io.reactivex.netty.channel.AllocatingTransformer<CC,C> transformer)
HttpServerResponseHttpServerResponse instance modifying the content type using the passed transformer.transformContent in class HttpServerResponse<C>CC - New type of the content.transformer - Transformer to transform the content stream.HttpServerResponse with the transformed content stream.public WebSocketHandshaker acceptWebSocketUpgrade(WebSocketHandler handler)
HttpServerResponseacceptWebSocketUpgrade in class HttpServerResponse<C>WebSocketHandshaker for sending a handshake to the client. Subscription to the handshaker, will
send the handshake.public rx.Observable<java.lang.Void> dispose()
HttpServerResponsedispose in class HttpServerResponse<C>Observable, subscription to which will dispose this response.public io.netty.channel.Channel unsafeNettyChannel()
HttpServerResponseunsafeNettyChannel in class HttpServerResponse<C>public io.reactivex.netty.channel.Connection<?,?> unsafeConnection()
HttpServerResponseunsafeConnection in class HttpServerResponse<C>public ResponseContentWriter<C> write(rx.Observable<C> msgs)
ResponseContentWriterObservable, writes the passed message stream on the underneath channel.
write in class ResponseContentWriter<C>msgs - Stream of messages to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public <T extends TrailingHeaders> rx.Observable<java.lang.Void> write(rx.Observable<C> contentSource, rx.functions.Func0<T> trailerFactory, rx.functions.Func2<T,C,T> trailerMutator)
ResponseContentWriterObservable as the source of content for this request. This method provides a way to
write trailing headers.
A new instance of TrailingHeaders will be created using the passed trailerFactory and the passed
trailerMutator will be invoked for every item emitted from the content source, giving a chance to modify
the trailing headers instance.
write in class ResponseContentWriter<C>contentSource - Content source for the response.trailerFactory - A factory function to create a new TrailingHeaders per subscription of the content.trailerMutator - A function to mutate the trailing header on each item emitted from the content source.Observable which can be subscribed to execute the request.public <T extends TrailingHeaders> rx.Observable<java.lang.Void> write(rx.Observable<C> contentSource, rx.functions.Func0<T> trailerFactory, rx.functions.Func2<T,C,T> trailerMutator, rx.functions.Func1<C,java.lang.Boolean> flushSelector)
ResponseContentWriterObservable as the source of content for this request. This method provides a way to
write trailing headers.
A new instance of TrailingHeaders will be created using the passed trailerFactory and the passed
trailerMutator will be invoked for every item emitted from the content source, giving a chance to modify
the trailing headers instance.
write in class ResponseContentWriter<C>contentSource - Content source for the response.trailerFactory - A factory function to create a new TrailingHeaders per subscription of the content.trailerMutator - A function to mutate the trailing header on each item emitted from the content source.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable which can be subscribed to execute the request.public ResponseContentWriter<C> write(rx.Observable<C> msgs, rx.functions.Func1<C,java.lang.Boolean> flushSelector)
ResponseContentWriterObservable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.write in class ResponseContentWriter<C>msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs.
Channel is flushed, iff this function returns, true.Observable representing the result of this and all writes done prior to the flush. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic ResponseContentWriter<C> writeAndFlushOnEach(rx.Observable<C> msgs)
ResponseContentWriterObservable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.writeAndFlushOnEach in class ResponseContentWriter<C>msgs - Message stream to write.Observable representing the result of this and all writes done prior to the flush. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public ResponseContentWriter<C> writeString(rx.Observable<java.lang.String> msgs)
ResponseContentWriterObservable, writes the passed message stream on the underneath channel.
writeString in class ResponseContentWriter<C>msgs - Stream of messages to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public <T extends TrailingHeaders> rx.Observable<java.lang.Void> writeString(rx.Observable<java.lang.String> contentSource, rx.functions.Func0<T> trailerFactory, rx.functions.Func2<T,java.lang.String,T> trailerMutator)
ResponseContentWriterObservable as the source of content for this request. This method provides a way to
write trailing headers.
A new instance of TrailingHeaders will be created using the passed trailerFactory and the passed
trailerMutator will be invoked for every item emitted from the content source, giving a chance to modify
the trailing headers instance.
writeString in class ResponseContentWriter<C>contentSource - Content source for the response.trailerFactory - A factory function to create a new TrailingHeaders per subscription of the content.trailerMutator - A function to mutate the trailing header on each item emitted from the content source.Observable which can be subscribed to execute the request.public <T extends TrailingHeaders> rx.Observable<java.lang.Void> writeString(rx.Observable<java.lang.String> contentSource, rx.functions.Func0<T> trailerFactory, rx.functions.Func2<T,java.lang.String,T> trailerMutator, rx.functions.Func1<java.lang.String,java.lang.Boolean> flushSelector)
ResponseContentWriterObservable as the source of content for this request. This method provides a way to
write trailing headers.
A new instance of TrailingHeaders will be created using the passed trailerFactory and the passed
trailerMutator will be invoked for every item emitted from the content source, giving a chance to modify
the trailing headers instance.
writeString in class ResponseContentWriter<C>contentSource - Content source for the response.trailerFactory - A factory function to create a new TrailingHeaders per subscription of the content.trailerMutator - A function to mutate the trailing header on each item emitted from the content source.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable which can be subscribed to execute the request.public ResponseContentWriter<C> writeString(rx.Observable<java.lang.String> msgs, rx.functions.Func1<java.lang.String,java.lang.Boolean> flushSelector)
ResponseContentWriterObservable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.writeString in class ResponseContentWriter<C>msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs.
Channel is flushed, iff this function returns, true.Observable representing the result of this and all writes done prior to the flush. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic ResponseContentWriter<C> writeStringAndFlushOnEach(rx.Observable<java.lang.String> msgs)
ResponseContentWriterObservable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.writeStringAndFlushOnEach in class ResponseContentWriter<C>msgs - Message stream to write.Observable representing the result of this and all writes done prior to the flush. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public ResponseContentWriter<C> writeBytes(rx.Observable<byte[]> msgs)
ResponseContentWriterObservable, writes the passed message stream on the underneath channel.
writeBytes in class ResponseContentWriter<C>msgs - Stream of messages to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public <T extends TrailingHeaders> rx.Observable<java.lang.Void> writeBytes(rx.Observable<byte[]> contentSource, rx.functions.Func0<T> trailerFactory, rx.functions.Func2<T,byte[],T> trailerMutator)
ResponseContentWriterObservable as the source of content for this request. This method provides a way to
write trailing headers.
A new instance of TrailingHeaders will be created using the passed trailerFactory and the passed
trailerMutator will be invoked for every item emitted from the content source, giving a chance to modify
the trailing headers instance.
writeBytes in class ResponseContentWriter<C>contentSource - Content source for the response.trailerFactory - A factory function to create a new TrailingHeaders per subscription of the content.trailerMutator - A function to mutate the trailing header on each item emitted from the content source.Observable which can be subscribed to execute the request.public <T extends TrailingHeaders> rx.Observable<java.lang.Void> writeBytes(rx.Observable<byte[]> contentSource, rx.functions.Func0<T> trailerFactory, rx.functions.Func2<T,byte[],T> trailerMutator, rx.functions.Func1<byte[],java.lang.Boolean> flushSelector)
ResponseContentWriterObservable as the source of content for this request. This method provides a way to
write trailing headers.
A new instance of TrailingHeaders will be created using the passed trailerFactory and the passed
trailerMutator will be invoked for every item emitted from the content source, giving a chance to modify
the trailing headers instance.
writeBytes in class ResponseContentWriter<C>contentSource - Content source for the response.trailerFactory - A factory function to create a new TrailingHeaders per subscription of the content.trailerMutator - A function to mutate the trailing header on each item emitted from the content source.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable which can be subscribed to execute the request.public ResponseContentWriter<C> writeBytes(rx.Observable<byte[]> msgs, rx.functions.Func1<byte[],java.lang.Boolean> flushSelector)
ResponseContentWriterObservable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.writeBytes in class ResponseContentWriter<C>msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs.
Channel is flushed, iff this function returns, true.Observable representing the result of this and all writes done prior to the flush. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic ResponseContentWriter<C> writeBytesAndFlushOnEach(rx.Observable<byte[]> msgs)
ResponseContentWriterObservable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.writeBytesAndFlushOnEach in class ResponseContentWriter<C>msgs - Message stream to write.Observable representing the result of this and all writes done prior to the flush. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public static <T> HttpServerResponse<T> create(HttpServerRequest<?> request, io.reactivex.netty.channel.Connection connection, io.netty.handler.codec.http.HttpResponse headers)