Package tech.greenfield.vertx.irked
Class Irked
- java.lang.Object
-
- tech.greenfield.vertx.irked.Irked
-
public class Irked extends Object
Helper for creating Irked routers- Author:
- odeda
-
-
Constructor Summary
Constructors Constructor Description Irked(io.vertx.core.Vertx vertx)Deprecated, for removal: This API element is subject to removal in a future version.Will be removed in 5.0.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Irkedirked(io.vertx.core.Vertx vertx)Vert.x-styled Irked factory method.static io.vertx.ext.web.handler.LoggerHandlerlogger()Create aLoggerHandlerinstance to log HTTP access under a simple SLF4J logger name.static io.vertx.ext.web.handler.LoggerHandlerlogger(io.vertx.ext.web.handler.LoggerFormat format)Create aLoggerHandlerinstance to log HTTP access under a simple SLF4J logger name.static io.vertx.ext.web.handler.LoggerHandlerlogger(String loggerName, io.vertx.ext.web.handler.LoggerFormat format)Create aLoggerHandlerinstance to log HTTP access under a simple SLF4J logger name.Routerrouter()Create a new Irked routerstatic Routerrouter(io.vertx.core.Vertx vertx)Create a new Irked routerio.vertx.core.Handler<io.vertx.core.http.HttpServerRequest>setupRequestHandler(Controller... apis)Create an HTTP request handler, that can be used inHttpServer.requestHandler(), with the provided set of APIs configured
-
-
-
Constructor Detail
-
Irked
@Deprecated(forRemoval=true) public Irked(io.vertx.core.Vertx vertx)
Deprecated, for removal: This API element is subject to removal in a future version.Will be removed in 5.0. Please useirked(Vertx)insteadCreate new Irked instance that can generate request handlers- Parameters:
vertx- Vert.x instance in which to generate routers
-
-
Method Detail
-
irked
public static Irked irked(io.vertx.core.Vertx vertx)
Vert.x-styled Irked factory method.- Parameters:
vertx- Vert.x instance in which to generated routers- Returns:
- a new Irked instance that can generate
Routers and request handlers
-
setupRequestHandler
public io.vertx.core.Handler<io.vertx.core.http.HttpServerRequest> setupRequestHandler(Controller... apis) throws InvalidRouteConfiguration
Create an HTTP request handler, that can be used inHttpServer.requestHandler(), with the provided set of APIs configured- Parameters:
apis- set of Irked API controllers to configure routing for- Returns:
- an HTTP request handler for the Vert.x HTTP server
- Throws:
InvalidRouteConfiguration- in case one of the route configurations is invalid
-
router
public Router router()
Create a new Irked router- Returns:
- router that can be used to configure Irked API controllers and handle HTTP requests from Vert.x HTTP server
-
router
public static Router router(io.vertx.core.Vertx vertx)
Create a new Irked router- Parameters:
vertx- Vert.x instance in which to generate routers- Returns:
- router that can be used to configure Irked API controllers and handle HTTP requests from Vert.x HTTP server
-
logger
public static io.vertx.ext.web.handler.LoggerHandler logger()
Create aLoggerHandlerinstance to log HTTP access under a simple SLF4J logger name. The implementation returned from is a subclass of the original Vert.xLoggerHandlerImplexcept where the underlying logger is replaced so that the logger isn't named for a full class name of an internal Vert.x implementation class - this makes it easier to set up filters and manage the access log. To use - define a field in your main (root) controller like so:
This method uses the hard coded log name "@Endpoint private LoggerHandler accessLog = Irked.logger();access" and the default log format.- Returns:
- an instance of a
LoggerHandlerthat will log HTTP requests
-
logger
public static io.vertx.ext.web.handler.LoggerHandler logger(io.vertx.ext.web.handler.LoggerFormat format)
Create aLoggerHandlerinstance to log HTTP access under a simple SLF4J logger name. The implementation returned from is a subclass of the original Vert.xLoggerHandlerImplexcept where the underlying logger is replaced so that the logger isn't named for a full class name of an internal Vert.x implementation class - this makes it easier to set up filters and manage the access log. To use - define a field in your main (root) controller like so:
This method uses the hard coded log name "@Endpoint private LoggerHandler accessLog = Irked.logger(LoggerFormat.SHORT);access".- Parameters:
format- LoggerFormat to use for formatting the log- Returns:
- an instance of a
LoggerHandlerthat will log HTTP requests
-
logger
public static io.vertx.ext.web.handler.LoggerHandler logger(String loggerName, io.vertx.ext.web.handler.LoggerFormat format)
Create aLoggerHandlerinstance to log HTTP access under a simple SLF4J logger name. The implementation returned from is a subclass of the original Vert.xLoggerHandlerImplexcept where the underlying logger is replaced so that the logger isn't named for a full class name of an internal Vert.x implementation class - this makes it easier to set up filters and manage the access log. To use - define a field in your main (root) controller like so:@Endpoint private LoggerHandler accessLog = Irked.logger("access_log", LoggerFormat.SHORT);- Parameters:
loggerName- text to use for the logger nameformat- LoggerFormat to use for formatting the log- Returns:
- an instance of a
LoggerHandlerthat will log HTTP requests
-
-