public interface Jex
Create configure and start Jex.
final Jex.Server app = Jex.create()
.routing(routing -> routing
.get("/", ctx -> ctx.text("hello world"))
.get("/one", ctx -> ctx.text("one"))
.port(8080)
.start();
app.shutdown();
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionaccessManager(AccessManager accessManager) Set the AccessManager.<T> TReturn a custom attribute.<T> JexSet a custom attribute that can be used by an implementation.config()Return the configuration.Configure via a lambda taking the JexConfig instance.configureWith(io.avaje.inject.BeanScope beanScope) Configure given the dependency injection scope from avaje-inject.Set the context path.static Jexcreate()Create Jex.Return the Error handler to add error handlers.errorHandling(ErrorHandling.Service service) Configure error handlers.exception(Class<T> exceptionClass, ExceptionHandler<T> handler) Add an exception handler for the given exception type.jsonService(JsonService jsonService) Set the JsonService.Return the application lifecycle support.Add Plugin functionality.port(int port) Set the port to use.register(TemplateRender renderer, String... extensions) Explicitly register a template renderer.routing()Return the Routing to configure.routing(Routing.Service routes) Add routes and handlers to the routing.routing(Collection<Routing.Service> routes) Add many routes and handlers to the routing.Return the server specific configuration.serverConfig(ServerConfig serverConfig) Set the server specific configuration.start()Start the server.Return the static file configuration.
-
Method Details
-
create
Create Jex.final Jex.Server app = Jex.create() .routing(routing -> routing .get("/", ctx -> ctx.text("hello world")) .get("/one", ctx -> ctx.text("one")) .port(8080) .start(); app.shutdown(); -
attribute
Set a custom attribute that can be used by an implementation. -
attribute
Return a custom attribute. -
errorHandling
Configure error handlers. -
errorHandling
ErrorHandling errorHandling()Return the Error handler to add error handlers. -
serverConfig
ServerConfig serverConfig()Return the server specific configuration. -
serverConfig
Set the server specific configuration. -
routing
Add routes and handlers to the routing. -
routing
Add many routes and handlers to the routing. -
routing
Routing routing()Return the Routing to configure. -
accessManager
Set the AccessManager. -
jsonService
Set the JsonService. -
plugin
Add Plugin functionality. -
configureWith
Configure given the dependency injection scope from avaje-inject.- Parameters:
beanScope- The scope potentially containing Handlers, AccessManager, Plugins etc.
-
configure
Configure via a lambda taking the JexConfig instance. -
exception
Add an exception handler for the given exception type. -
port
Set the port to use. -
context
Set the context path. -
staticFiles
StaticFileConfig staticFiles()Return the static file configuration. -
register
Explicitly register a template renderer.Note that if not explicitly registered TemplateRender's can be automatically registered via ServiceLoader just by including them to the class path.
- Parameters:
renderer- The template renderer to registerextensions- The extensions the renderer is used for
-
lifecycle
AppLifecycle lifecycle()Return the application lifecycle support. -
config
JexConfig config()Return the configuration. -
start
Jex.Server start()Start the server.
-