Interface BlockingStreamingHttpServerResponse
- All Superinterfaces:
ContextMapHolder
,HttpMetaData
,HttpResponseMetaData
HttpResponse
but provides an ability to write the payload to an HttpPayloadWriter
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddCookie
(HttpCookiePair cookie) Adds a cookie.addCookie
(CharSequence name, CharSequence value) addHeader
(CharSequence name, CharSequence value) Adds a new header with the specifiedname
andvalue
.addHeaders
(HttpHeaders headers) Adds all header names and values ofheaders
object.addSetCookie
(HttpSetCookie cookie) Adds a set-cookie.addSetCookie
(CharSequence name, CharSequence value) context
(ContextMap context) Sets a context for thisHttpMetaData
.encoding
(ContentCodec encoding) TheContentCodec
used to encode the payload of a request or a response.Sends theHttpResponseMetaData
and returns anHttpPayloadWriter
to continue writing the payload body.default <T> HttpPayloadWriter<T>
sendMetaData
(HttpSerializer<T> serializer) Deprecated.<T> HttpPayloadWriter<T>
sendMetaData
(HttpStreamingSerializer<T> serializer) Sends theHttpResponseMetaData
to the client and returns anHttpPayloadWriter
of typeBlockingStreamingHttpServerResponse
to continue writing a payload body.Sends theHttpResponseMetaData
to the client and returns anOutputStream
to continue writing a payload body.setHeader
(CharSequence name, CharSequence value) Sets a header with the specifiedname
andvalue
.setHeaders
(HttpHeaders headers) Clears the current header entries and copies all header entries of the specifiedheaders
object.status
(HttpResponseStatus status) Set the status of thisStreamingHttpResponse
.version
(HttpProtocolVersion version) Set the protocol version of thisHttpMetaData
.Methods inherited from interface io.servicetalk.http.api.HttpMetaData
context, encoding, headers, toString, toString, version
Methods inherited from interface io.servicetalk.http.api.HttpResponseMetaData
status
-
Method Details
-
sendMetaData
HttpPayloadWriter<Buffer> sendMetaData()Sends theHttpResponseMetaData
and returns anHttpPayloadWriter
to continue writing the payload body.Note: calling any other method on this class after calling this method is not allowed.
- Returns:
HttpPayloadWriter
to write a payload body- Throws:
IllegalStateException
- if one of thesendMetaData*
methods has been called on this response
-
sendMetaData
Deprecated.Sends theHttpResponseMetaData
to the client and returns anHttpPayloadWriter
of typeBlockingStreamingHttpServerResponse
to continue writing a payload body. Each element will be serialized using providedserializer
.Note: calling any other method on this class after calling this method is not allowed.
- Type Parameters:
T
- the type of objects to write- Parameters:
serializer
- used to serialize the payload elements- Returns:
HttpPayloadWriter
to write a payload body- Throws:
IllegalStateException
- if one of thesendMetaData*
methods has been called on this response
-
sendMetaData
Sends theHttpResponseMetaData
to the client and returns anHttpPayloadWriter
of typeBlockingStreamingHttpServerResponse
to continue writing a payload body. Each element will be serialized using providedserializer
.Note: calling any other method on this class after calling this method is not allowed.
- Type Parameters:
T
- the type of objects to write- Parameters:
serializer
- used to serialize the payload elements- Returns:
HttpPayloadWriter
to write a payload body- Throws:
IllegalStateException
- if one of thesendMetaData*
methods has been called on this response
-
sendMetaDataOutputStream
HttpOutputStream sendMetaDataOutputStream()Sends theHttpResponseMetaData
to the client and returns anOutputStream
to continue writing a payload body.Note: calling any other method on this class after calling this method is not allowed.
- Returns:
HttpOutputStream
to write a payload body- Throws:
IllegalStateException
- if one of thesendMetaData*
methods has been called on this response
-
version
Description copied from interface:HttpMetaData
Set the protocol version of thisHttpMetaData
.- Specified by:
version
in interfaceHttpMetaData
- Specified by:
version
in interfaceHttpResponseMetaData
- Parameters:
version
- the protocol version to set.- Returns:
this
.
-
status
Description copied from interface:HttpResponseMetaData
Set the status of thisStreamingHttpResponse
.- Specified by:
status
in interfaceHttpResponseMetaData
- Parameters:
status
- TheHttpResponseStatus
to set.- Returns:
this
.
-
encoding
Description copied from interface:HttpMetaData
TheContentCodec
used to encode the payload of a request or a response. If the endpoint is setup withContentCodingHttpServiceFilter
, the server will auto-establish the accepted encoding for the response, unless the caller provides a specific encoding by calling this method. Any encoding passed here, takes precedence. In other words, a compressed response, can be disabled by passingIdentity.identity()
.- Specified by:
encoding
in interfaceHttpMetaData
- Parameters:
encoding
- TheContentCodec
used for the encoding of the payload.- Returns:
this
.- See Also:
-
addHeader
Description copied from interface:HttpMetaData
Adds a new header with the specifiedname
andvalue
.- Specified by:
addHeader
in interfaceHttpMetaData
- Specified by:
addHeader
in interfaceHttpResponseMetaData
- Parameters:
name
- the name of the header.value
- the value of the header.- Returns:
this
.
-
addHeaders
Description copied from interface:HttpMetaData
Adds all header names and values ofheaders
object.- Specified by:
addHeaders
in interfaceHttpMetaData
- Specified by:
addHeaders
in interfaceHttpResponseMetaData
- Parameters:
headers
- the headers to add.- Returns:
this
.
-
setHeader
Description copied from interface:HttpMetaData
Sets a header with the specifiedname
andvalue
. Any existing headers with the same name are overwritten.- Specified by:
setHeader
in interfaceHttpMetaData
- Specified by:
setHeader
in interfaceHttpResponseMetaData
- Parameters:
name
- the name of the header.value
- the value of the header.- Returns:
this
.
-
setHeaders
Description copied from interface:HttpMetaData
Clears the current header entries and copies all header entries of the specifiedheaders
object.- Specified by:
setHeaders
in interfaceHttpMetaData
- Specified by:
setHeaders
in interfaceHttpResponseMetaData
- Parameters:
headers
- the headers object which contains new values.- Returns:
this
.
-
addCookie
Description copied from interface:HttpMetaData
Adds a cookie.This may result in multiple
HttpCookiePair
s with same name.- Specified by:
addCookie
in interfaceHttpMetaData
- Specified by:
addCookie
in interfaceHttpResponseMetaData
- Parameters:
cookie
- the cookie to add.- Returns:
this
.
-
addCookie
Description copied from interface:HttpMetaData
Adds a cookie with the specifiedname
andvalue
.This may result in multiple
HttpSetCookie
s with same name. Added cookie will not be wrapped, not secure, and not HTTP-only, with no path, domain, expire date and maximum age.- Specified by:
addCookie
in interfaceHttpMetaData
- Specified by:
addCookie
in interfaceHttpResponseMetaData
- Parameters:
name
- the name of the cookie.value
- the value of the cookie.- Returns:
this
.
-
addSetCookie
Description copied from interface:HttpMetaData
Adds a set-cookie.This may result in multiple
HttpSetCookie
s with same name.- Specified by:
addSetCookie
in interfaceHttpMetaData
- Specified by:
addSetCookie
in interfaceHttpResponseMetaData
- Parameters:
cookie
- the cookie to add.- Returns:
this
.
-
addSetCookie
Description copied from interface:HttpMetaData
Adds a set-cookie with the specifiedname
andvalue
.This may result in multiple
HttpSetCookie
s with same name. Added cookie will not be wrapped, not secure, and not HTTP-only, with no path, domain, expire date and maximum age.- Specified by:
addSetCookie
in interfaceHttpMetaData
- Specified by:
addSetCookie
in interfaceHttpResponseMetaData
- Parameters:
name
- the name of the cookie.value
- the value of the cookie.- Returns:
this
.
-
context
Description copied from interface:HttpMetaData
Sets a context for thisHttpMetaData
.Context can be used to associate a state with a request or response message without serializing its state on the wire.
- Specified by:
context
in interfaceContextMapHolder
- Specified by:
context
in interfaceHttpMetaData
- Specified by:
context
in interfaceHttpResponseMetaData
- Parameters:
context
- the new context for thisHttpMetaData
.- Returns:
this
.
-
sendMetaData(HttpStreamingSerializer)
.