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 specifiednameandvalue.addHeaders(HttpHeaders headers) Adds all header names and values ofheadersobject.addSetCookie(HttpSetCookie cookie) Adds a set-cookie.addSetCookie(CharSequence name, CharSequence value) context(ContextMap context) Sets a context for thisHttpMetaData.encoding(ContentCodec encoding) TheContentCodecused to encode the payload of a request or a response.Sends theHttpResponseMetaDataand returns anHttpPayloadWriterto continue writing the payload body.default <T> HttpPayloadWriter<T>sendMetaData(HttpSerializer<T> serializer) Deprecated.<T> HttpPayloadWriter<T>sendMetaData(HttpStreamingSerializer<T> serializer) Sends theHttpResponseMetaDatato the client and returns anHttpPayloadWriterof typeBlockingStreamingHttpServerResponseto continue writing a payload body.Sends theHttpResponseMetaDatato the client and returns anOutputStreamto continue writing a payload body.setHeader(CharSequence name, CharSequence value) Sets a header with the specifiednameandvalue.setHeaders(HttpHeaders headers) Clears the current header entries and copies all header entries of the specifiedheadersobject.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, versionMethods inherited from interface io.servicetalk.http.api.HttpResponseMetaData
status
-
Method Details
-
sendMetaData
HttpPayloadWriter<Buffer> sendMetaData()Sends theHttpResponseMetaDataand returns anHttpPayloadWriterto continue writing the payload body.Note: calling any other method on this class after calling this method is not allowed.
- Returns:
HttpPayloadWriterto write a payload body- Throws:
IllegalStateException- if one of thesendMetaData*methods has been called on this response
-
sendMetaData
Deprecated.Sends theHttpResponseMetaDatato the client and returns anHttpPayloadWriterof typeBlockingStreamingHttpServerResponseto 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:
HttpPayloadWriterto write a payload body- Throws:
IllegalStateException- if one of thesendMetaData*methods has been called on this response
-
sendMetaData
Sends theHttpResponseMetaDatato the client and returns anHttpPayloadWriterof typeBlockingStreamingHttpServerResponseto 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:
HttpPayloadWriterto write a payload body- Throws:
IllegalStateException- if one of thesendMetaData*methods has been called on this response
-
sendMetaDataOutputStream
HttpOutputStream sendMetaDataOutputStream()Sends theHttpResponseMetaDatato the client and returns anOutputStreamto continue writing a payload body.Note: calling any other method on this class after calling this method is not allowed.
- Returns:
HttpOutputStreamto write a payload body- Throws:
IllegalStateException- if one of thesendMetaData*methods has been called on this response
-
version
Description copied from interface:HttpMetaDataSet the protocol version of thisHttpMetaData.- Specified by:
versionin interfaceHttpMetaData- Specified by:
versionin interfaceHttpResponseMetaData- Parameters:
version- the protocol version to set.- Returns:
this.
-
status
Description copied from interface:HttpResponseMetaDataSet the status of thisStreamingHttpResponse.- Specified by:
statusin interfaceHttpResponseMetaData- Parameters:
status- TheHttpResponseStatusto set.- Returns:
this.
-
encoding
Description copied from interface:HttpMetaDataTheContentCodecused 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:
encodingin interfaceHttpMetaData- Parameters:
encoding- TheContentCodecused for the encoding of the payload.- Returns:
this.- See Also:
-
addHeader
Description copied from interface:HttpMetaDataAdds a new header with the specifiednameandvalue.- Specified by:
addHeaderin interfaceHttpMetaData- Specified by:
addHeaderin interfaceHttpResponseMetaData- Parameters:
name- the name of the header.value- the value of the header.- Returns:
this.
-
addHeaders
Description copied from interface:HttpMetaDataAdds all header names and values ofheadersobject.- Specified by:
addHeadersin interfaceHttpMetaData- Specified by:
addHeadersin interfaceHttpResponseMetaData- Parameters:
headers- the headers to add.- Returns:
this.
-
setHeader
Description copied from interface:HttpMetaDataSets a header with the specifiednameandvalue. Any existing headers with the same name are overwritten.- Specified by:
setHeaderin interfaceHttpMetaData- Specified by:
setHeaderin interfaceHttpResponseMetaData- Parameters:
name- the name of the header.value- the value of the header.- Returns:
this.
-
setHeaders
Description copied from interface:HttpMetaDataClears the current header entries and copies all header entries of the specifiedheadersobject.- Specified by:
setHeadersin interfaceHttpMetaData- Specified by:
setHeadersin interfaceHttpResponseMetaData- Parameters:
headers- the headers object which contains new values.- Returns:
this.
-
addCookie
Description copied from interface:HttpMetaDataAdds a cookie.This may result in multiple
HttpCookiePairs with same name.- Specified by:
addCookiein interfaceHttpMetaData- Specified by:
addCookiein interfaceHttpResponseMetaData- Parameters:
cookie- the cookie to add.- Returns:
this.
-
addCookie
Description copied from interface:HttpMetaDataAdds a cookie with the specifiednameandvalue.This may result in multiple
HttpSetCookies 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:
addCookiein interfaceHttpMetaData- Specified by:
addCookiein interfaceHttpResponseMetaData- Parameters:
name- the name of the cookie.value- the value of the cookie.- Returns:
this.
-
addSetCookie
Description copied from interface:HttpMetaDataAdds a set-cookie.This may result in multiple
HttpSetCookies with same name.- Specified by:
addSetCookiein interfaceHttpMetaData- Specified by:
addSetCookiein interfaceHttpResponseMetaData- Parameters:
cookie- the cookie to add.- Returns:
this.
-
addSetCookie
Description copied from interface:HttpMetaDataAdds a set-cookie with the specifiednameandvalue.This may result in multiple
HttpSetCookies 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:
addSetCookiein interfaceHttpMetaData- Specified by:
addSetCookiein interfaceHttpResponseMetaData- Parameters:
name- the name of the cookie.value- the value of the cookie.- Returns:
this.
-
context
Description copied from interface:HttpMetaDataSets 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:
contextin interfaceContextMapHolder- Specified by:
contextin interfaceHttpMetaData- Specified by:
contextin interfaceHttpResponseMetaData- Parameters:
context- the new context for thisHttpMetaData.- Returns:
this.
-
sendMetaData(HttpStreamingSerializer).