vertx / io.vertx.ext.web.api.contract / RouterFactoryOptions

RouterFactoryOptions

open class RouterFactoryOptions

Author
Francesco Guardiani @slinkydeveloper

Constructors

<init>

RouterFactoryOptions()
RouterFactoryOptions(json: JsonObject)
RouterFactoryOptions(other: RouterFactoryOptions)

Properties

DEFAULT_MOUNT_NOT_IMPLEMENTED_HANDLER

static val DEFAULT_MOUNT_NOT_IMPLEMENTED_HANDLER: Boolean

By default, RouterFactory mounts Not Implemented handler

DEFAULT_MOUNT_RESPONSE_CONTENT_TYPE_HANDLER

static val DEFAULT_MOUNT_RESPONSE_CONTENT_TYPE_HANDLER: Boolean

By default, RouterFactory will mount ResponseContentTypeHandler when required

DEFAULT_MOUNT_VALIDATION_FAILURE_HANDLER

static val DEFAULT_MOUNT_VALIDATION_FAILURE_HANDLER: Boolean

By default, RouterFactory loads validation failure handler

DEFAULT_NOT_IMPLEMENTED_HANDLER

static val DEFAULT_NOT_IMPLEMENTED_HANDLER: Handler<RoutingContext>

Default not implemented handler. It sends a response with status code 501, status message "Not Implemented" and empty body

DEFAULT_REQUIRE_SECURITY_HANDLERS

static val DEFAULT_REQUIRE_SECURITY_HANDLERS: Boolean

By default, RouterFactory requires security handlers to be defined while calling getRouter() or it will throw an Exception

DEFAULT_VALIDATION_HANDLER

static val DEFAULT_VALIDATION_HANDLER: Handler<RoutingContext>

Default validation failure handler. When ValidationException occurs, It sends a response with status code 400, status message "Bad Request" and error message as body

Functions

addGlobalHandler

open fun addGlobalHandler(globalHandler: Handler<RoutingContext>): RouterFactoryOptions

Add global handler to be applied prior to io.vertx.ext.web.Router being generated.

getBodyHandler

open fun getBodyHandler(): BodyHandler

getGlobalHandlers

open fun getGlobalHandlers(): MutableList<Handler<RoutingContext>>

getNotImplementedFailureHandler

open fun getNotImplementedFailureHandler(): Handler<RoutingContext>

getValidationFailureHandler

open fun getValidationFailureHandler(): Handler<RoutingContext>

isMountNotImplementedHandler

open fun isMountNotImplementedHandler(): Boolean

isMountResponseContentTypeHandler

open fun isMountResponseContentTypeHandler(): Boolean

isMountValidationFailureHandler

open fun isMountValidationFailureHandler(): Boolean

isRequireSecurityHandlers

open fun isRequireSecurityHandlers(): Boolean

setBodyHandler

open fun setBodyHandler(bodyHandler: BodyHandler): RouterFactoryOptions

Supply your own BodyHandler if you would like to control body limit, uploads directory and deletion of uploaded files

setMountNotImplementedHandler

open fun setMountNotImplementedHandler(mountOperationsWithoutHandler: Boolean): RouterFactoryOptions

Automatic mount handlers that return HTTP 501 status code for operations where you didn't specify an handler.

setMountResponseContentTypeHandler

open fun setMountResponseContentTypeHandler(mountResponseContentTypeHandler: Boolean): RouterFactoryOptions

If true, when required, the factory will mount a io.vertx.ext.web.handler.ResponseContentTypeHandler

setMountValidationFailureHandler

open fun setMountValidationFailureHandler(mountGlobalValidationFailureHandler: Boolean): RouterFactoryOptions

Enable or disable validation failure handler. If you enable it during router creation a failure handler that manages ValidationException will be mounted. You can change the validation failure handler with with function RouterFactoryOptions#setValidationFailureHandler(Handler). If failure is different from ValidationException, next failure handler will be called.

setNotImplementedFailureHandler

open fun setNotImplementedFailureHandler(notImplementedFailureHandler: Handler<RoutingContext>): RouterFactoryOptions

Set not implemented failure handler. It's called when you don't define an handler for a specific operation. You can enable/disable this feature from RouterFactoryOptions#setMountNotImplementedHandler(boolean)

setRequireSecurityHandlers

open fun setRequireSecurityHandlers(requireSecurityHandlers: Boolean): RouterFactoryOptions

If true, when you call RouterFactory#getRouter() the factory will mount for every path the required security handlers and, if a security handler is not defined, it throws an RouterFactoryException

setValidationFailureHandler

open fun setValidationFailureHandler(validationFailureHandler: Handler<RoutingContext>): RouterFactoryOptions

Set default validation failure handler. You can enable/disable this feature from RouterFactoryOptions#setMountValidationFailureHandler(boolean)

toJson

open fun toJson(): JsonObject