public interface RouterFactory
operation(String)
(String, Handler)}
RouterFactory.create(vertx, "src/resources/spec.yaml", asyncResult -> {
if (!asyncResult.succeeded()) {
// IO failure or spec invalid
} else {
OpenAPI3RouterFactory routerFactory = asyncResult.result();
routerFactory.operation("operation_id").handler(routingContext -> {
// Do something
}, routingContext -> {
// Do something with failure handler
});
Router router = routerFactory.createRouter();
}
});
this#bodyHandler(BodyHandler)
this#rootHandler(Handler)
Modifier and Type | Method and Description |
---|---|
RouterFactory |
bodyHandler(BodyHandler bodyHandler)
Supply your own BodyHandler if you would like to control body limit, uploads directory and deletion of uploaded
files.
|
static Future<RouterFactory> |
create(Vertx vertx,
String url)
Create a new
RouterFactory |
static void |
create(Vertx vertx,
String url,
Handler<AsyncResult<RouterFactory>> handler)
Like
this#create(Vertx, String) |
static Future<RouterFactory> |
create(Vertx vertx,
String url,
OpenAPILoaderOptions options)
Create a new
RouterFactory |
static void |
create(Vertx vertx,
String url,
OpenAPILoaderOptions options,
Handler<AsyncResult<RouterFactory>> handler)
Like
this#create(Vertx, String, OpenAPILoaderOptions) |
Router |
createRouter()
Construct a new router based on spec.
|
OpenAPIHolder |
getOpenAPI() |
RouterFactoryOptions |
getOptions() |
SchemaParser |
getSchemaParser() |
SchemaRouter |
getSchemaRouter() |
RouterFactory |
mountServiceInterface(Class interfaceClass,
String address)
Introspect the Web Api Service interface to route to service all matching method names with operation ids.
|
RouterFactory |
mountServicesFromExtensions()
Introspect the OpenAPI spec to mount handlers for all operations that specifies a x-vertx-event-bus annotation.
|
Operation |
operation(String operationId)
Access to an operation defined in the contract with
operationId |
List<Operation> |
operations()
Access to all operations defined in the contract
|
RouterFactory |
rootHandler(Handler<RoutingContext> rootHandler)
Add global handler to be applied prior to
Router being generated. |
RouterFactory |
securityHandler(String securitySchemaName,
AuthenticationHandler handler)
Mount to paths that have to follow a security schema a security handler
|
RouterFactory |
serviceExtraPayloadMapper(java.util.function.Function<RoutingContext,JsonObject> serviceExtraPayloadMapper)
When set, this function is called while creating the payload of
ServiceRequest |
RouterFactory |
setOptions(RouterFactoryOptions options)
Set options of router factory.
|
Operation operation(String operationId)
operationId
operationId
- RouterFactory bodyHandler(BodyHandler bodyHandler)
bodyHandler
- RouterFactory rootHandler(Handler<RoutingContext> rootHandler)
Router
being generated. bodyHandler(BodyHandler)
rootHandler
- RouterFactory securityHandler(String securitySchemaName, AuthenticationHandler handler)
securitySchemaName
- handler
- RouterFactory mountServicesFromExtensions()
RouterFactory mountServiceInterface(Class interfaceClass, String address)
RouterFactory setOptions(RouterFactoryOptions options)
RouterFactoryOptions
options
- RouterFactoryOptions getOptions()
RouterFactoryOptions
OpenAPIHolder getOpenAPI()
$ref
sSchemaRouter getSchemaRouter()
Schema
instancesSchemaParser getSchemaParser()
Schema
RouterFactory serviceExtraPayloadMapper(java.util.function.Function<RoutingContext,JsonObject> serviceExtraPayloadMapper)
ServiceRequest
serviceExtraPayloadMapper
- Router createRouter()
static Future<RouterFactory> create(Vertx vertx, String url)
RouterFactory
vertx
- url
- location of your spec. It can be an absolute path, a local path or remote url (with HTTP/HTTPS protocol)static void create(Vertx vertx, String url, Handler<AsyncResult<RouterFactory>> handler)
this#create(Vertx, String)
static Future<RouterFactory> create(Vertx vertx, String url, OpenAPILoaderOptions options)
RouterFactory
vertx
- url
- location of your spec. It can be an absolute path, a local path or remote url (with HTTP/HTTPS protocol)options
- options for specification loadingstatic void create(Vertx vertx, String url, OpenAPILoaderOptions options, Handler<AsyncResult<RouterFactory>> handler)
this#create(Vertx, String, OpenAPILoaderOptions)
Copyright © 2020 Eclipse. All rights reserved.