vertx / io.vertx.ext.web.api.validation / HTTPRequestValidationHandler

HTTPRequestValidationHandler

interface HTTPRequestValidationHandler : ValidationHandler

An interface for add HTTP Request validation. This class can validate parameters inside query, path, headers an body (watch below) You can assign multiple body type at the same time(for example a JSON schema together with a XML schema). This interface support:

Also you can add a form parameter for validation without care about content type of your request. For form parameters this interface support both "multipart/form-data" and "application/x-www-form-urlencoded" This interface allow extra parameters in the request, so it doesn't care if in a request there's a parameter without a specified validation rule If a parameter is flagged as an array, it will be validated also if the size of array is 1 element

Author
Francesco Guardiani @slinkydeveloper

Functions

addCustomValidatorFunction

abstract fun addCustomValidatorFunction(customValidator: CustomValidator): HTTPRequestValidationHandler

Add a custom validator. For more informations about custom validator, see CustomValidator

addExpectedContentType

abstract fun addExpectedContentType(contentType: String): HTTPRequestValidationHandler

Add an expected content type of request. It's not needed to add application/json, application/xml, multipart/form-data and application/x-www-form-urlencoded

addFormParam

abstract fun addFormParam(parameterName: String, type: ParameterType, required: Boolean): HTTPRequestValidationHandler

Add a single parameter inside a form with included parameter types

addFormParamWithCustomTypeValidator

abstract fun addFormParamWithCustomTypeValidator(parameterName: String, validator: ParameterTypeValidator, required: Boolean, allowEmptyValue: Boolean): HTTPRequestValidationHandler

Add a form parameter with a custom type validator. For more informations about how to construct built-in or custom type validator, check out ParameterTypeValidator

addFormParamWithPattern

abstract fun addFormParamWithPattern(parameterName: String, pattern: String, required: Boolean): HTTPRequestValidationHandler

Add a single parameter inside a form with a custom pattern

addFormParamsArray

abstract fun addFormParamsArray(parameterName: String, type: ParameterType, required: Boolean): HTTPRequestValidationHandler

Add a form parameters array with included parameter types

addFormParamsArrayWithPattern

abstract fun addFormParamsArrayWithPattern(parameterName: String, pattern: String, required: Boolean): HTTPRequestValidationHandler

Add a form parameters array with a custom pattern

addHeaderParam

abstract fun addHeaderParam(headerName: String, type: ParameterType, required: Boolean): HTTPRequestValidationHandler

Add a header parameter with included parameter types

addHeaderParamWithCustomTypeValidator

abstract fun addHeaderParamWithCustomTypeValidator(headerName: String, validator: ParameterTypeValidator, required: Boolean, allowEmptyValue: Boolean): HTTPRequestValidationHandler

Add a header parameter with a custom type validator. For more informations about how to construct built-in or custom type validator, check out ParameterTypeValidator

addHeaderParamWithPattern

abstract fun addHeaderParamWithPattern(headerName: String, pattern: String, required: Boolean): HTTPRequestValidationHandler

Add a header parameter with a custom pattern

addJsonBodySchema

abstract fun addJsonBodySchema(jsonSchema: String): HTTPRequestValidationHandler

Add a json schema for body with Content-Type "application/json"

addMultipartRequiredFile

abstract fun addMultipartRequiredFile(filename: String, contentType: String): HTTPRequestValidationHandler

Add an expected filename inside multipart request.

addPathParam

abstract fun addPathParam(parameterName: String, type: ParameterType): HTTPRequestValidationHandler

Add a path parameter with included parameter types. All path params are required

addPathParamWithCustomTypeValidator

abstract fun addPathParamWithCustomTypeValidator(parameterName: String, validator: ParameterTypeValidator, allowEmptyValue: Boolean): HTTPRequestValidationHandler

Add a path parameter with a custom type validator. All path params are required. For more informations about how to construct built-in or custom type validator, check out ParameterTypeValidator

addPathParamWithPattern

abstract fun addPathParamWithPattern(parameterName: String, pattern: String): HTTPRequestValidationHandler

Add a path parameter with a custom pattern. All path params are required

addQueryParam

abstract fun addQueryParam(parameterName: String, type: ParameterType, required: Boolean): HTTPRequestValidationHandler

Add a query parameter with included parameter types

addQueryParamWithCustomTypeValidator

abstract fun addQueryParamWithCustomTypeValidator(parameterName: String, validator: ParameterTypeValidator, required: Boolean, allowEmptyValue: Boolean): HTTPRequestValidationHandler

Add a query parameter with a custom type validator. For more informations about how to construct built-in or custom type validator, check out ParameterTypeValidator

addQueryParamWithPattern

abstract fun addQueryParamWithPattern(parameterName: String, pattern: String, required: Boolean): HTTPRequestValidationHandler

Add a query parameter with a custom pattern

addQueryParamsArray

abstract fun addQueryParamsArray(arrayName: String, type: ParameterType, required: Boolean): HTTPRequestValidationHandler

Add a query parameters array with included parameter types

addQueryParamsArrayWithPattern

abstract fun addQueryParamsArrayWithPattern(arrayName: String, pattern: String, required: Boolean): HTTPRequestValidationHandler

Add a query parameters array with a custom pattern

addXMLBodySchema

abstract fun addXMLBodySchema(xmlSchema: String): HTTPRequestValidationHandler

Add a xml schema for body with Content-Type "application/xml"

create

open static fun create(): HTTPRequestValidationHandler

Factory method to create an HTTPRequestValidationHandler