Class BodyTransformers
java.lang.Object
io.vertx.rxjava3.httpproxy.BodyTransformers
- All Implemented Interfaces:
io.vertx.lang.rx.RxDelegate
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.vertx.lang.rx.TypeArg<BodyTransformers> static final longThe default maximum amount of bytes synchronous transformers apply -
Constructor Summary
ConstructorsConstructorDescriptionBodyTransformers(BodyTransformers delegate) BodyTransformers(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionstatic BodyTransformerdiscard()Create a transformer that discards the body, the transformer consumes any media type.booleaninthashCode()static BodyTransformerCreate a body transformer that transforms JSON array to JSON array, the transformer consumes and producesapplication/json.static BodyTransformerLikejsonArray(long, Function)withBodyTransformersmaximum buffered bytes.static BodyTransformerjsonObject(long maxBufferedBytes, Function<JsonObject, JsonObject> transformer) Create a body transformer that transforms JSON object to JSON object, the transformer consumes and producesapplication/json.static BodyTransformerjsonObject(Function<JsonObject, JsonObject> transformer) LikejsonObject(long, Function)withBodyTransformersmaximum buffered bytes.static BodyTransformerCreate a body transformer that transforms JSON value to JSON value, the transformer consumes and producesapplication/json.static BodyTransformerLikejsonValue(long, Function)withBodyTransformersmaximum buffered bytes.static BodyTransformersstatic BodyTransformerCreate a transformer that transforms text to text, the transformer consumes and producestext/plain.static BodyTransformerLiketext(long, Function, String)withBodyTransformersmaximum buffered bytes.toString()static BodyTransformertransform(MediaType consumes, MediaType produces, long maxBufferedBytes, Function<Buffer, Buffer> transformer) Create a body transformer that transformsconsumesmedia type to theproducesmedia type, by applying thetransformerfunction.static BodyTransformerLiketransform(MediaType, MediaType, Function)withBodyTransformersmaximum buffered bytes.
-
Field Details
-
__TYPE_ARG
-
DEFAULT_MAX_BUFFERED_SIZE
public static final long DEFAULT_MAX_BUFFERED_SIZEThe default maximum amount of bytes synchronous transformers apply- See Also:
-
-
Constructor Details
-
BodyTransformers
-
BodyTransformers
-
-
Method Details
-
toString
-
equals
-
hashCode
-
getDelegate
- Specified by:
getDelegatein interfaceio.vertx.lang.rx.RxDelegate
-
jsonObject
public static BodyTransformer jsonObject(long maxBufferedBytes, Function<JsonObject, JsonObject> transformer) Create a body transformer that transforms JSON object to JSON object, the transformer consumes and producesapplication/json.- Parameters:
maxBufferedBytes- the maximum amount of bytes buffered by the body transformertransformer- the transformer function- Returns:
- the transformer instance
-
jsonObject
LikejsonObject(long, Function)withBodyTransformersmaximum buffered bytes.- Parameters:
transformer-- Returns:
-
jsonArray
public static BodyTransformer jsonArray(long maxBufferedBytes, Function<JsonArray, JsonArray> transformer) Create a body transformer that transforms JSON array to JSON array, the transformer consumes and producesapplication/json.- Parameters:
maxBufferedBytes- the maximum amount of bytes buffered by the body transformertransformer- the transformer function- Returns:
- the transformer instance
-
jsonArray
LikejsonArray(long, Function)withBodyTransformersmaximum buffered bytes.- Parameters:
transformer-- Returns:
-
jsonValue
Create a body transformer that transforms JSON value to JSON value, the transformer consumes and producesapplication/json.- Parameters:
maxBufferedBytes- the maximum amount of bytes buffered by the body transformertransformer- the transformer function- Returns:
- the transformer instance
-
jsonValue
LikejsonValue(long, Function)withBodyTransformersmaximum buffered bytes.- Parameters:
transformer-- Returns:
-
text
public static BodyTransformer text(long maxBufferedBytes, Function<String, String> transformer, String encoding) Create a transformer that transforms text to text, the transformer consumes and producestext/plain.- Parameters:
maxBufferedBytes- the maximum amount of bytes buffered by the body transformertransformer- the transformer functionencoding-- Returns:
- the transformer instance
-
text
Liketext(long, Function, String)withBodyTransformersmaximum buffered bytes.- Parameters:
transformer-encoding-- Returns:
-
discard
Create a transformer that discards the body, the transformer consumes any media type.- Returns:
- the transformer instance
-
transform
public static BodyTransformer transform(MediaType consumes, MediaType produces, Function<Buffer, Buffer> transformer) Liketransform(MediaType, MediaType, Function)withBodyTransformersmaximum buffered bytes.- Parameters:
consumes-produces-transformer-- Returns:
-
transform
public static BodyTransformer transform(MediaType consumes, MediaType produces, long maxBufferedBytes, Function<Buffer, Buffer> transformer) Create a body transformer that transforms
consumesmedia type to theproducesmedia type, by applying thetransformerfunction.The transformer buffers up to
maxBufferedBytesand then apply thetransformerfunction. When the body exceeds the limit, the transformes signal an error and fail the transformation.- Parameters:
consumes- the consumed media typeproduces- the produced media typemaxBufferedBytes- the maximum amount of bytes buffered by the body transformertransformer- the transformer- Returns:
- the body transformer
-
newInstance
-