Package io.servicetalk.http.api
Class HttpSerializationProviders
java.lang.Object
io.servicetalk.http.api.HttpSerializationProviders
Deprecated.
A factory to create
HttpSerializationProvider
s.-
Method Summary
Modifier and TypeMethodDescriptionstatic HttpDeserializer<Map<String,
List<String>>> Deprecated.static HttpDeserializer<Map<String,
List<String>>> formUrlEncodedDeserializer
(Charset charset) Deprecated.static HttpDeserializer<Map<String,
List<String>>> formUrlEncodedDeserializer
(Charset charset, Predicate<HttpHeaders> checkContentType) Deprecated.static HttpSerializer<Map<String,
List<String>>> Deprecated.static HttpSerializer<Map<String,
List<String>>> formUrlEncodedSerializer
(Charset charset) Deprecated.static HttpSerializer<Map<String,
List<String>>> formUrlEncodedSerializer
(Charset charset, Consumer<HttpHeaders> addContentType) Deprecated.static HttpSerializationProvider
jsonSerializer
(SerializationProvider serializationProvider) static HttpSerializationProvider
jsonSerializer
(Serializer serializer) static HttpSerializationProvider
serializationProvider
(SerializationProvider serializationProvider, Consumer<HttpHeaders> addContentType, Predicate<HttpHeaders> checkContentType) Deprecated.static HttpSerializationProvider
serializationProvider
(Serializer serializer, Consumer<HttpHeaders> addContentType, Predicate<HttpHeaders> checkContentType) Deprecated.static HttpDeserializer<String>
Deprecated.UseHttpSerializers.textSerializerUtf8()
for aggregated.static HttpDeserializer<String>
textDeserializer
(Charset charset) Deprecated.UseHttpSerializers.textSerializer(Charset)
for aggregated.static HttpDeserializer<String>
textDeserializer
(Charset charset, Predicate<HttpHeaders> checkContentType) Deprecated.UseHttpSerializers.textSerializer(Charset)
for aggregated.static HttpSerializer<String>
Deprecated.UseHttpSerializers.textSerializerUtf8()
for aggregated.static HttpSerializer<String>
textSerializer
(Charset charset) Deprecated.UseHttpSerializers.textSerializer(Charset)
for aggregated.static HttpSerializer<String>
textSerializer
(Charset charset, Consumer<HttpHeaders> addContentType) Deprecated.UseHttpSerializers.textSerializer(Charset)
for aggregated.
-
Method Details
-
formUrlEncodedSerializer
Deprecated.Creates anHttpSerializer
that can serialize a key-valuesMap
s withStandardCharsets.UTF_8
Charset
to urlencoded forms.- Returns:
HttpSerializer
that could serialize key-valueMap
.- See Also:
-
formUrlEncodedSerializer
@Deprecated public static HttpSerializer<Map<String,List<String>>> formUrlEncodedSerializer(Charset charset) Deprecated.Creates anHttpSerializer
that can serialize key-valuesMap
s with the specifiedCharset
to to urlencoded forms.- Parameters:
charset
-Charset
for the key-valueMap
that will be serialized.- Returns:
HttpSerializer
that could serialize from key-valueMap
.- See Also:
-
formUrlEncodedSerializer
@Deprecated public static HttpSerializer<Map<String,List<String>>> formUrlEncodedSerializer(Charset charset, Consumer<HttpHeaders> addContentType) Deprecated.Creates anHttpSerializer
that can serialize a key-valuesMap
s with the specifiedCharset
to urlencoded forms.- Parameters:
charset
-Charset
for the key-valueMap
that will be serialized.addContentType
- AConsumer
that adds relevant headers to the passedHttpHeaders
matching the serialized payload. Typically, this involves adding aHttpHeaderNames.CONTENT_TYPE
header.- Returns:
HttpSerializer
that could serialize from key-valueMap
.- See Also:
-
formUrlEncodedDeserializer
Deprecated.Creates anHttpDeserializer
that can deserialize key-valuesMap
s withStandardCharsets.UTF_8
from urlencoded forms.- Returns:
HttpDeserializer
that could deserialize a key-valuesMap
.- See Also:
-
formUrlEncodedDeserializer
@Deprecated public static HttpDeserializer<Map<String,List<String>>> formUrlEncodedDeserializer(Charset charset) Deprecated.Creates anHttpDeserializer
that can deserialize key-valuesMap
s withStandardCharsets.UTF_8
from urlencoded forms.- Parameters:
charset
-Charset
for the key-valueMap
that will be deserialized. deserialized payload. If the validation fails, then deserialization will fail withSerializationException
- Returns:
HttpDeserializer
that could deserialize a key-valueMap
.- See Also:
-
formUrlEncodedDeserializer
@Deprecated public static HttpDeserializer<Map<String,List<String>>> formUrlEncodedDeserializer(Charset charset, Predicate<HttpHeaders> checkContentType) Deprecated.Creates anHttpDeserializer
that can deserialize key-valuesMap
s withStandardCharsets.UTF_8
from urlencoded forms.- Parameters:
charset
-Charset
for the key-valueMap
that will be deserialized.checkContentType
- Checks theHttpHeaders
to see if a compatible encoding is found. deserialized payload. If the validation fails, then deserialization will fail withSerializationException
- Returns:
HttpDeserializer
that could deserialize a key-valueMap
.- See Also:
-
textSerializer
Deprecated.UseHttpSerializers.textSerializerUtf8()
for aggregated. For streaming, use one of the following:- Returns:
HttpSerializer
that could serializeString
.
-
textSerializer
Deprecated.UseHttpSerializers.textSerializer(Charset)
for aggregated. For streaming, use one of the following:- Parameters:
charset
-Charset
for theString
that will be serialized.- Returns:
HttpSerializer
that could serialize fromString
.
-
textSerializer
@Deprecated public static HttpSerializer<String> textSerializer(Charset charset, Consumer<HttpHeaders> addContentType) Deprecated.UseHttpSerializers.textSerializer(Charset)
for aggregated. For streaming, use one of the following:- Parameters:
charset
-Charset
for theString
that will be serialized.addContentType
- AConsumer
that adds relevant headers to the passedHttpHeaders
matching the serialized payload. Typically, this involves adding aHttpHeaderNames.CONTENT_TYPE
header.- Returns:
HttpSerializer
that could serialize fromString
.
-
textDeserializer
Deprecated.UseHttpSerializers.textSerializerUtf8()
for aggregated. For streaming, use one of the following:HttpSerializers.appSerializerUtf8FixLen()
HttpSerializers.appSerializerAsciiVarLen()
- Aggregate the payload (e.g.
StreamingHttpRequest.toRequest()
) and useHttpSerializers.textSerializer(Charset)
if your payload is text HttpSerializers.streamingSerializer(StreamingSerializerDeserializer, Consumer, Predicate)
targeted at yourHttpHeaderNames.CONTENT_TYPE
- Returns:
HttpDeserializer
that could deserializeString
.
-
textDeserializer
Deprecated.UseHttpSerializers.textSerializer(Charset)
for aggregated. For streaming, use one of the following:HttpSerializers.appSerializerUtf8FixLen()
HttpSerializers.appSerializerAsciiVarLen()
- Aggregate the payload (e.g.
StreamingHttpRequest.toRequest()
) and useHttpSerializers.textSerializer(Charset)
if your payload is text HttpSerializers.streamingSerializer(StreamingSerializerDeserializer, Consumer, Predicate)
targeted at yourHttpHeaderNames.CONTENT_TYPE
- Parameters:
charset
-Charset
for theString
that will be deserialized.- Returns:
HttpDeserializer
that could deserializeString
.
-
textDeserializer
@Deprecated public static HttpDeserializer<String> textDeserializer(Charset charset, Predicate<HttpHeaders> checkContentType) Deprecated.UseHttpSerializers.textSerializer(Charset)
for aggregated. For streaming, use one of the following:HttpSerializers.appSerializerUtf8FixLen()
HttpSerializers.appSerializerAsciiVarLen()
- Aggregate the payload (e.g.
StreamingHttpRequest.toRequest()
) and useHttpSerializers.textSerializer(Charset)
if your payload is text HttpSerializers.streamingSerializer(StreamingSerializerDeserializer, Consumer, Predicate)
targeted at yourHttpHeaderNames.CONTENT_TYPE
- Parameters:
charset
-Charset
for theString
that will be deserialized.checkContentType
- APredicate
that validates the passedHttpHeaders
as expected for the deserialized payload. If the validation fails, then deserialization will fail withSerializationException
- Returns:
HttpDeserializer
that could deserializeString
.
-
jsonSerializer
Deprecated.Creates a newHttpSerializationProvider
that could serialize/deserialize to/from JSON using the passedSerializer
. For serialization, the returnedHttpSerializationProvider
adds aHttpHeaderNames.CONTENT_TYPE
header with valueHttpHeaderValues.APPLICATION_JSON
. For deserialization, it expects aHttpHeaderNames.CONTENT_TYPE
header with valueHttpHeaderValues.APPLICATION_JSON
. If the expected header is not present, then deserialization will fail withSerializationException
.- Parameters:
serializer
-Serializer
that has the capability of serializing/deserializing to/from JSON.- Returns:
HttpSerializationProvider
that has the capability of serializing/deserializing to/from JSON.
-
jsonSerializer
@Deprecated public static HttpSerializationProvider jsonSerializer(SerializationProvider serializationProvider) Deprecated.Creates a newHttpSerializationProvider
that could serialize/deserialize to/from JSON using the passedSerializationProvider
. For serialization, the returnedHttpSerializationProvider
adds aHttpHeaderNames.CONTENT_TYPE
header with valueHttpHeaderValues.APPLICATION_JSON
. For deserialization, it expects aHttpHeaderNames.CONTENT_TYPE
header with valueHttpHeaderValues.APPLICATION_JSON
. If the expected header is not present, then deserialization will fail withSerializationException
.- Parameters:
serializationProvider
-SerializationProvider
that has the capability of serializing/deserializing to/from JSON.- Returns:
HttpSerializationProvider
that has the capability of serializing/deserializing to/from JSON.
-
serializationProvider
@Deprecated public static HttpSerializationProvider serializationProvider(Serializer serializer, Consumer<HttpHeaders> addContentType, Predicate<HttpHeaders> checkContentType) Deprecated.Creates a newHttpSerializationProvider
that could serialize/deserialize to/from the desired content-type using the passedSerializer
.For serialization, the returned
HttpSerializationProvider
would updateHttpHeaders
appropriately to indicate the content-type using the passedaddContentType
.For deserialization, it would validate headers as specified by the passed
checkContentType predicate
. If the validation fails, then deserialization will fail withSerializationException
.- Parameters:
serializer
-Serializer
that has the capability of serializing/deserializing to/from a desired content-type.addContentType
- AConsumer
that adds relevant headers to the passedHttpHeaders
matching the serialized payload. Typically, this involves adding aHttpHeaderNames.CONTENT_TYPE
header.checkContentType
- APredicate
that validates the passedHttpHeaders
as expected for the deserialized payload. If the validation fails, then deserialization will fail withSerializationException
- Returns:
HttpSerializationProvider
that has the capability of serializing/deserializing to/from a desired content-type.
-
serializationProvider
@Deprecated public static HttpSerializationProvider serializationProvider(SerializationProvider serializationProvider, Consumer<HttpHeaders> addContentType, Predicate<HttpHeaders> checkContentType) Deprecated.Creates a newHttpSerializationProvider
that could serialize/deserialize to/from the desired content-type using the passedSerializationProvider
.For serialization, the returned
HttpSerializationProvider
would updateHttpHeaders
appropriately to indicate the content-type using the passedaddContentType
.For deserialization, it would validate headers as specified by the passed
checkContentType predicate
. If the validation fails, then deserialization will fail withSerializationException
.- Parameters:
serializationProvider
-SerializationProvider
that has the capability of serializing/deserializing to/from a desired content-type.addContentType
- AConsumer
that adds relevant headers to the passedHttpHeaders
matching the serialized payload. Typically, this involves adding aHttpHeaderNames.CONTENT_TYPE
header.checkContentType
- APredicate
that validates the passedHttpHeaders
as expected for the deserialized payload. If the validation fails, then deserialization will fail withSerializationException
.- Returns:
HttpSerializationProvider
that has the capability of serializing/deserializing to/from a desired content-type.
-
HttpSerializers
.