Interface BlockingStreamingHttpRequest
- All Superinterfaces:
ContextMapHolder,HttpMetaData,HttpRequestMetaData
HttpRequest but provides the payload as a BlockingIterable.-
Method Summary
Modifier and TypeMethodDescriptiondefault BlockingStreamingHttpRequestaddCookie(HttpCookiePair cookie) Adds a cookie.default BlockingStreamingHttpRequestaddCookie(CharSequence name, CharSequence value) default BlockingStreamingHttpRequestaddHeader(CharSequence name, CharSequence value) Adds a new header with the specifiednameandvalue.default BlockingStreamingHttpRequestaddHeaders(HttpHeaders headers) Adds all header names and values ofheadersobject.addQueryParameter(String key, String value) Adds a new query parameter with the specifiedkeyandvalue, which will be percent-encoded if needed.addQueryParameters(String key, Iterable<String> values) Adds new query parameters with the specifiedkeyandvalues.addQueryParameters(String key, String... values) Adds new query parameters with the specifiedkeyandvalues.default BlockingStreamingHttpRequestaddSetCookie(HttpSetCookie cookie) Adds a set-cookie.default BlockingStreamingHttpRequestaddSetCookie(CharSequence name, CharSequence value) appendPathSegments(String... segments) Appends segments to the currentHttpRequestMetaData.path(), performing encoding of each segment (including ('/') characters) according to percent-encoding.contentEncoding(BufferEncoder encoder) Set theBufferEncoderto use for this request.context(ContextMap context) Sets a context for thisHttpMetaData.default BlockingStreamingHttpRequestencoding(ContentCodec encoding) Deprecated.default BlockingStreamingHttpRequestSets the fragment part of the request target.Get theHttpMessageBodyIterablefor this request.messageBody(HttpMessageBodyIterable<Buffer> messageBody) Set theHttpMessageBodyIterablefor this response.messageBody(HttpMessageBodyIterable<T> messageBody, HttpStreamingSerializer<T> serializer) Set theHttpMessageBodyIterablefor this response.<T> HttpMessageBodyIterable<T>messageBody(HttpStreamingDeserializer<T> deserializer) Get theHttpMessageBodyIterablefor this request and deserialize to typeBlockingStreamingHttpRequest.method(HttpRequestMethod method) Set theHttpRequestMethodof thisStreamingHttpRequest.Sets the path, performing encoding according to percent-encoding, except for forward-slash ('/') characters.default <T> BlockingIterable<T>payloadBody(HttpDeserializer<T> deserializer) Deprecated.<T> BlockingIterable<T>payloadBody(HttpStreamingDeserializer<T> deserializer) Gets and deserializes the payload body.payloadBody(InputStream payloadBody) Returns aBlockingStreamingHttpRequestwith its underlying payload set topayloadBody.payloadBody(Iterable<Buffer> payloadBody) Returns aBlockingStreamingHttpRequestwith its underlying payload set topayloadBody.default <T> BlockingStreamingHttpRequestpayloadBody(Iterable<T> payloadBody, HttpSerializer<T> serializer) Deprecated.payloadBody(Iterable<T> payloadBody, HttpStreamingSerializer<T> serializer) Returns aBlockingStreamingHttpRequestwith its underlying payload set to the result of serialization.default InputStreamGets the underlying payload as anInputStream.Sets the path, performing encoding according to rfc3986, Query.Sets the path topath, without any encoding performed.Sets the query component toquery, without any encoding performed.requestTarget(String requestTarget) Set the request-target.requestTarget(String requestTarget, Charset encoding) Set the request-target.default BlockingStreamingHttpRequestsetHeader(CharSequence name, CharSequence value) Sets a header with the specifiednameandvalue.default BlockingStreamingHttpRequestsetHeaders(HttpHeaders headers) Clears the current header entries and copies all header entries of the specifiedheadersobject.setQueryParameter(String key, String value) setQueryParameters(String key, Iterable<String> values) Sets new query parameters with the specifiedkeyandvalues.setQueryParameters(String key, String... values) Sets new query parameters with the specifiedkeyandvalues.Translates thisBlockingStreamingHttpRequestto aHttpRequest.Translates thisBlockingStreamingHttpRequestto aStreamingHttpRequest.default <T> BlockingStreamingHttpRequesttransform(TrailersTransformer<T, Buffer> trailersTransformer) Deprecated.default <T> BlockingStreamingHttpRequesttransformPayloadBody(Function<BlockingIterable<Buffer>, BlockingIterable<T>> transformer, HttpSerializer<T> serializer) Deprecated.default <T,R> BlockingStreamingHttpRequest transformPayloadBody(Function<BlockingIterable<T>, BlockingIterable<R>> transformer, HttpDeserializer<T> deserializer, HttpSerializer<R> serializer) Deprecated.default BlockingStreamingHttpRequesttransformPayloadBody(UnaryOperator<BlockingIterable<Buffer>> transformer) Deprecated.UsepayloadBody()andpayloadBody(Iterable).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.HttpRequestMetaData
contentEncoding, effectiveHostAndPort, fragment, hasQueryParameter, hasQueryParameter, host, method, path, port, query, queryParameter, queryParameters, queryParameters, queryParametersIterator, queryParametersKeys, queryParametersSize, rawPath, rawQuery, removeQueryParameters, removeQueryParameters, requestTarget, requestTarget, scheme, userInfo
-
Method Details
-
payloadBody
BlockingIterable<Buffer> payloadBody() -
payloadBodyInputStream
Gets the underlying payload as anInputStream.- Returns:
- The
InputStreamrepresentation of the underlying payload body.
-
payloadBody
Deprecated.Gets and deserializes the payload body.- Type Parameters:
T- The resulting type of the deserialization operation.- Parameters:
deserializer- The function that deserializes the underlyingBlockingIterable.- Returns:
- The results of the deserialization operation.
-
payloadBody
Gets and deserializes the payload body.- Type Parameters:
T- The resulting type of the deserialization operation.- Parameters:
deserializer- The function that deserializes the underlyingBlockingIterable.- Returns:
- The results of the deserialization operation.
-
messageBody
HttpMessageBodyIterable<Buffer> messageBody()Get theHttpMessageBodyIterablefor this request.- Returns:
- the
HttpMessageBodyIterablefor this request.
-
messageBody
Get theHttpMessageBodyIterablefor this request and deserialize to typeBlockingStreamingHttpRequest.- Type Parameters:
T- The resulting type of the deserialization operation.- Parameters:
deserializer- The function that deserializes the underlyingBlockingIterable.- Returns:
- the
HttpMessageBodyIterablefor this request and deserialize to typeBlockingStreamingHttpRequest.
-
payloadBody
Returns aBlockingStreamingHttpRequestwith its underlying payload set topayloadBody.A best effort will be made to apply back pressure to the existing payload body which is being replaced. If this default policy is not sufficient you can use
transformPayloadBody(UnaryOperator)for more fine grain control.This method reserves the right to delay completion/consumption of
payloadBody. This may occur due to the combination with the existing payload body that is being replaced.- Parameters:
payloadBody- The new payload body.- Returns:
this
-
payloadBody
Returns aBlockingStreamingHttpRequestwith its underlying payload set topayloadBody.After the request is sent, it owns the passed
InputStream, meaning that theInputStreamwill be automatically closed when the request is finished.A best effort will be made to apply back pressure to the existing payload body which is being replaced. If this default policy is not sufficient you can use
transformPayloadBody(UnaryOperator)for more fine grain control.This method reserves the right to delay completion/consumption of
payloadBody. This may occur due to the combination with the existing payload body that is being replaced.- Parameters:
payloadBody- The new payload body.- Returns:
this
-
messageBody
Set theHttpMessageBodyIterablefor this response.- Parameters:
messageBody- The new message body.- Returns:
this.
-
payloadBody
@Deprecated default <T> BlockingStreamingHttpRequest payloadBody(Iterable<T> payloadBody, HttpSerializer<T> serializer) Deprecated.Returns aBlockingStreamingHttpRequestwith its underlying payload set to the result of serialization.A best effort will be made to apply back pressure to the existing payload body which is being replaced. If this default policy is not sufficient you can use
transformPayloadBody(Function, HttpSerializer)for more fine grain control.This method reserves the right to delay completion/consumption of
payloadBody. This may occur due to the combination with the existing payload body that is being replaced.- Type Parameters:
T- The type of objects to serialize.- Parameters:
payloadBody- The new payload body, prior to serialization.serializer- Used to serialize the payload body.- Returns:
this
-
payloadBody
<T> BlockingStreamingHttpRequest payloadBody(Iterable<T> payloadBody, HttpStreamingSerializer<T> serializer) Returns aBlockingStreamingHttpRequestwith its underlying payload set to the result of serialization.A best effort will be made to apply back pressure to the existing payload body which is being replaced. If this default policy is not sufficient
payloadBody()can be used to drain with more fine grain control.This method reserves the right to delay completion/consumption of
payloadBody. This may occur due to the combination with the existing payload body that is being replaced.- Type Parameters:
T- The type of objects to serialize.- Parameters:
payloadBody- The new payload body, prior to serialization.serializer- Used to serialize the payload body.- Returns:
this
-
messageBody
<T> BlockingStreamingHttpRequest messageBody(HttpMessageBodyIterable<T> messageBody, HttpStreamingSerializer<T> serializer) Set theHttpMessageBodyIterablefor this response.- Type Parameters:
T- The type of the serialized objects.- Parameters:
messageBody- The serialized message body.serializer- The function that serializes the underlyingBlockingIterable.- Returns:
this
-
transformPayloadBody
@Deprecated default <T> BlockingStreamingHttpRequest transformPayloadBody(Function<BlockingIterable<Buffer>, BlockingIterable<T>> transformer, HttpSerializer<T> serializer) Deprecated.Returns aBlockingStreamingHttpRequestwith its underlying payload transformed to the result of serialization.- Type Parameters:
T- The type of objects to serialize.- Parameters:
transformer- AFunctionwhich take as a parameter the existing payload bodyBlockingIterableand returns the new payload bodyBlockingIterableprior to serialization. It is assumed the existing payload bodyBlockingIterablewill be transformed/consumed or else no more requests may be processed.serializer- Used to serialize the payload body.- Returns:
this
-
transformPayloadBody
@Deprecated default <T,R> BlockingStreamingHttpRequest transformPayloadBody(Function<BlockingIterable<T>, BlockingIterable<R>> transformer, HttpDeserializer<T> deserializer, HttpSerializer<R> serializer) Deprecated.Returns aBlockingStreamingHttpRequestwith its underlying payload transformed to the result of serialization.- Type Parameters:
T- The type of objects to deserialize.R- The type of objects to serialize.- Parameters:
transformer- AFunctionwhich take as a parameter the existing payload bodyBlockingIterableand returns the new payload bodyBlockingIterableprior to serialization. It is assumed the existing payload bodyBlockingIterablewill be transformed/consumed or else no more requests may be processed.deserializer- Used to deserialize the existing payload body.serializer- Used to serialize the payload body.- Returns:
this
-
transformPayloadBody
@Deprecated default BlockingStreamingHttpRequest transformPayloadBody(UnaryOperator<BlockingIterable<Buffer>> transformer) Deprecated.UsepayloadBody()andpayloadBody(Iterable).Returns aBlockingStreamingHttpRequestwith its underlying payload transformed toBuffers.- Parameters:
transformer- AFunctionwhich take as a parameter the existing payload bodyBlockingIterableand returns the new payload bodyBlockingIterable. It is assumed the existing payload bodyBlockingIterablewill be transformed/consumed or else no more requests may be processed.- Returns:
this
-
transform
@Deprecated default <T> BlockingStreamingHttpRequest transform(TrailersTransformer<T, Buffer> trailersTransformer) Deprecated.Returns aBlockingStreamingHttpRequestwith its underlying payload transformed toBuffers, with access to the trailers.- Type Parameters:
T- The type of state used during the transformation.- Parameters:
trailersTransformer-TrailersTransformerto use for this transform.- Returns:
this
-
toRequest
Single<HttpRequest> toRequest()Translates thisBlockingStreamingHttpRequestto aHttpRequest.- Returns:
- a
Singlethat completes with aHttpRequestrepresentation of thisBlockingStreamingHttpRequest.
-
toStreamingRequest
StreamingHttpRequest toStreamingRequest()Translates thisBlockingStreamingHttpRequestto aStreamingHttpRequest.- Returns:
- a
StreamingHttpRequestrepresentation of thisBlockingStreamingHttpRequest.
-
rawPath
Description copied from interface:HttpRequestMetaDataSets the path topath, without any encoding performed. This assumes that any characters that require encoding have been encoded according to percent-encoding by the caller.Because this modifies the request target, this may result in the clearing of internal caches. See
HttpRequestMetaData.requestTarget(String).- Specified by:
rawPathin interfaceHttpRequestMetaData- Parameters:
path- the encoded path to set.- Returns:
this.
-
path
Description copied from interface:HttpRequestMetaDataSets the path, performing encoding according to percent-encoding, except for forward-slash ('/') characters. This allows forpath("/abc")without it turning into'%2Fabc'.- Specified by:
pathin interfaceHttpRequestMetaData- Parameters:
path- the un-encoded path to set.- Returns:
this.
-
appendPathSegments
Description copied from interface:HttpRequestMetaDataAppends segments to the currentHttpRequestMetaData.path(), performing encoding of each segment (including ('/') characters) according to percent-encoding. A/is used to separate each segment and between the currentHttpRequestMetaData.path()and the following segments.- Specified by:
appendPathSegmentsin interfaceHttpRequestMetaData- Parameters:
segments- the un-encoded path to set.- Returns:
this.
-
rawQuery
Description copied from interface:HttpRequestMetaDataSets the query component toquery, without any encoding performed. This assumes that any characters that require encoding have been encoded according to percent-encoding by the caller.Because this modifies the request target, this may result in the clearing of internal caches. See
HttpRequestMetaData.requestTarget(String).- Specified by:
rawQueryin interfaceHttpRequestMetaData- Parameters:
query- the encoded query to set.nullwill clear the query value (e.g. no?present inHttpRequestMetaData.requestTarget().- Returns:
this.
-
query
Description copied from interface:HttpRequestMetaDataSets the path, performing encoding according to rfc3986, Query.- Specified by:
queryin interfaceHttpRequestMetaData- Parameters:
query- the un-encoded query to set.nullwill clear the query value (e.g. no?present inHttpRequestMetaData.requestTarget().- Returns:
this.
-
addQueryParameter
Description copied from interface:HttpRequestMetaDataAdds a new query parameter with the specifiedkeyandvalue, which will be percent-encoded if needed.- Specified by:
addQueryParameterin interfaceHttpRequestMetaData- Parameters:
key- the query parameter key.value- the query parameter value.- Returns:
this.
-
addQueryParameters
Description copied from interface:HttpRequestMetaDataAdds new query parameters with the specifiedkeyandvalues. This method is semantically equivalent to:for (T value : values) { addQueryParameter(key, value); }- Specified by:
addQueryParametersin interfaceHttpRequestMetaData- Parameters:
key- the query parameter key.values- the query parameter values.- Returns:
this.
-
addQueryParameters
Description copied from interface:HttpRequestMetaDataAdds new query parameters with the specifiedkeyandvalues. This method is semantically equivalent to:for (T value : values) { query.addQueryParameter(key, value); }- Specified by:
addQueryParametersin interfaceHttpRequestMetaData- Parameters:
key- the query parameter key.values- the query parameter values.- Returns:
this.
-
setQueryParameter
Description copied from interface:HttpRequestMetaDataSets a query parameter with the specifiedkeyandvalue, which will be percent-encoded if needed. Any existing query parameters with the same key are overwritten.- Specified by:
setQueryParameterin interfaceHttpRequestMetaData- Parameters:
key- the query parameter key.value- the query parameter value.- Returns:
this.
-
setQueryParameters
Description copied from interface:HttpRequestMetaDataSets new query parameters with the specifiedkeyandvalues. This method is equivalent to:removeQueryParameter(key); for (T value : values) { query.addQueryParameter(key, value); }- Specified by:
setQueryParametersin interfaceHttpRequestMetaData- Parameters:
key- the query parameter key.values- the query parameter values.- Returns:
this.
-
setQueryParameters
Description copied from interface:HttpRequestMetaDataSets new query parameters with the specifiedkeyandvalues. This method is equivalent to:removeQueryParameter(key); for (T value : values) { query.addQueryParameter(key, value); }- Specified by:
setQueryParametersin interfaceHttpRequestMetaData- Parameters:
key- the query parameter key.values- the query parameter values.- Returns:
this.
-
version
Description copied from interface:HttpMetaDataSet the protocol version of thisHttpMetaData.- Specified by:
versionin interfaceHttpMetaData- Specified by:
versionin interfaceHttpRequestMetaData- Parameters:
version- the protocol version to set.- Returns:
this.
-
fragment
Description copied from interface:HttpRequestMetaDataSets the fragment part of the request target.- Specified by:
fragmentin interfaceHttpRequestMetaData- Parameters:
fragment- the fragment to set.- Returns:
this.
-
encoding
Deprecated.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:
-
contentEncoding
Description copied from interface:HttpRequestMetaDataSet theBufferEncoderto use for this request. The value can be used by filters (such asContentEncodingHttpRequesterFilter) to applyHttpHeaderNames.CONTENT_ENCODINGto the request.- Specified by:
contentEncodingin interfaceHttpRequestMetaData- Parameters:
encoder-BufferEncoderto use for this request.- Returns:
this.
-
method
Description copied from interface:HttpRequestMetaDataSet theHttpRequestMethodof thisStreamingHttpRequest.- Specified by:
methodin interfaceHttpRequestMetaData- Parameters:
method- theHttpRequestMethodto set.- Returns:
this.
-
requestTarget
Description copied from interface:HttpRequestMetaDataSet the request-target.This will be treated as encoded according to percent-encoding.
This may result in clearing of internal caches used by methods that are derived from the
request-target, such asHttpRequestMetaData.path(),HttpRequestMetaData.rawQuery(), etc.- Specified by:
requestTargetin interfaceHttpRequestMetaData- Parameters:
requestTarget- the percent-encoded request-target to set.- Returns:
this.
-
requestTarget
Description copied from interface:HttpRequestMetaDataSet the request-target.This may result in clearing of internal caches used by methods that are derived from the
request-target, such asHttpRequestMetaData.path(),HttpRequestMetaData.rawQuery(), etc.- Specified by:
requestTargetin interfaceHttpRequestMetaData- Parameters:
requestTarget- the request-target to set.encoding- theCharsetto use to encoderequestTargetbefore setting the value.- Returns:
this.
-
addHeader
Description copied from interface:HttpMetaDataAdds a new header with the specifiednameandvalue.- Specified by:
addHeaderin interfaceHttpMetaData- Specified by:
addHeaderin interfaceHttpRequestMetaData- 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 interfaceHttpRequestMetaData- 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 interfaceHttpRequestMetaData- 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 interfaceHttpRequestMetaData- 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 interfaceHttpRequestMetaData- 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 interfaceHttpRequestMetaData- 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 interfaceHttpRequestMetaData- 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 interfaceHttpRequestMetaData- 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 interfaceHttpRequestMetaData- Parameters:
context- the new context for thisHttpMetaData.- Returns:
this.
-
payloadBody(HttpStreamingDeserializer).