Package io.vertx.httpproxy
Interface BodyTransformers
-
public interface BodyTransformers
Range of transformers ready to be used.
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_MAX_BUFFERED_SIZE
The default maximum amount of bytes synchronous transformers apply
-
Method Summary
Static Methods Modifier and Type Method Description static BodyTransformer
discard()
Create a transformer that discards the body, the transformer consumes any media type.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
.static BodyTransformer
jsonArrayβ(Function<JsonArray,βJsonArray> transformer)
LikejsonArray(long, Function)
withDEFAULT_MAX_BUFFERED_SIZE
maximum buffered bytes.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
.static BodyTransformer
jsonObjectβ(Function<JsonObject,βJsonObject> transformer)
LikejsonObject(long, Function)
withDEFAULT_MAX_BUFFERED_SIZE
maximum buffered bytes.static BodyTransformer
jsonValueβ(long maxBufferedBytes, Function<Object,βObject> transformer)
Create a body transformer that transforms JSON value to JSON value, the transformer consumes and producesapplication/json
.static BodyTransformer
jsonValueβ(Function<Object,βObject> transformer)
LikejsonValue(long, Function)
withDEFAULT_MAX_BUFFERED_SIZE
maximum buffered bytes.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
.static BodyTransformer
textβ(Function<String,βString> transformer, String encoding)
Liketext(long, Function, String)
withDEFAULT_MAX_BUFFERED_SIZE
maximum buffered bytes.static BodyTransformer
transformβ(MediaType consumes, MediaType produces, long maxBufferedBytes, Function<Buffer,βBuffer> transformer)
Create a body transformer that transformsconsumes
media type to theproduces
media type, by applying thetransformer
function.static BodyTransformer
transformβ(MediaType consumes, MediaType produces, Function<Buffer,βBuffer> transformer)
Liketransform(MediaType, MediaType, long, Function)
withDEFAULT_MAX_BUFFERED_SIZE
maximum buffered bytes.
-
-
-
Field Detail
-
DEFAULT_MAX_BUFFERED_SIZE
static final long DEFAULT_MAX_BUFFERED_SIZE
The default maximum amount of bytes synchronous transformers apply- See Also:
- Constant Field Values
-
-
Method Detail
-
transform
static BodyTransformer transformβ(MediaType consumes, MediaType produces, Function<Buffer,βBuffer> transformer)
Liketransform(MediaType, MediaType, long, Function)
withDEFAULT_MAX_BUFFERED_SIZE
maximum buffered bytes.
-
transform
static BodyTransformer transformβ(MediaType consumes, MediaType produces, long maxBufferedBytes, Function<Buffer,βBuffer> transformer)
Create a body transformer that transforms
consumes
media type to theproduces
media type, by applying thetransformer
function.The transformer buffers up to
maxBufferedBytes
and then apply thetransformer
function. 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
-
jsonObject
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
static BodyTransformer jsonObjectβ(Function<JsonObject,βJsonObject> transformer)
LikejsonObject(long, Function)
withDEFAULT_MAX_BUFFERED_SIZE
maximum buffered bytes.
-
jsonArray
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
static BodyTransformer jsonArrayβ(Function<JsonArray,βJsonArray> transformer)
LikejsonArray(long, Function)
withDEFAULT_MAX_BUFFERED_SIZE
maximum buffered bytes.
-
jsonValue
static BodyTransformer jsonValueβ(long maxBufferedBytes, Function<Object,βObject> transformer)
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
static BodyTransformer jsonValueβ(Function<Object,βObject> transformer)
LikejsonValue(long, Function)
withDEFAULT_MAX_BUFFERED_SIZE
maximum buffered bytes.
-
text
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 function- Returns:
- the transformer instance
-
text
static BodyTransformer textβ(Function<String,βString> transformer, String encoding)
Liketext(long, Function, String)
withDEFAULT_MAX_BUFFERED_SIZE
maximum buffered bytes.
-
discard
static BodyTransformer discard()
Create a transformer that discards the body, the transformer consumes any media type.- Returns:
- the transformer instance
-
-