java.lang.Object
io.avaje.jex.Jex
public class Jex extends Object
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 Modifier and Type Class Description static classJex.Configstatic interfaceJex.ServerThe running server. -
Field Summary
Fields Modifier and Type Field Description Jex.Configconfig -
Method Summary
Modifier and Type Method Description JexaccessManager(AccessManager accessManager)Set the AccessManager.<T> Tattribute(Class<T> cls)Return a custom attribute.<T> Jexattribute(Class<T> cls, T instance)Set a custom attribute that can be used by an implementation.Jexconfigure(Consumer<Jex> configure)Configure via a lambda taking the jex instance.JexconfigureWith(io.avaje.inject.BeanScope beanScope)Configure given the dependency injection scope from avaje-inject.Jexcontext(String contextPath)Set the context path.static Jexcreate()Create Jex to configure with routes etc before starting.ErrorHandlingerrorHandling()Return the Error handler to add error handlers.JexerrorHandling(ErrorHandling.Service service)Configure error handlers.<T extends Exception>
Jexexception(Class<T> exceptionClass, ExceptionHandler<T> handler)Add an exception handler for the given exception type.JexjsonService(JsonService jsonService)Set the JsonService.AppLifecyclelifecycle()Return the application lifecycle support.Jexplugin(Plugin plugin)Add Plugin functionality.Jexport(int port)Set the port to use.Jexregister(TemplateRender renderer, String... extensions)Explicitly register a template renderer.Routingrouting()Return the Routing to configure.Jexrouting(Routing.Service routes)Add routes and handlers to the routing.Jexrouting(Collection<Routing.Service> routes)Add many routes and handlers to the routing.ServerConfigserverConfig()Return the server specific configuration.JexserverConfig(ServerConfig serverConfig)Set the server specific configuration.Jex.Serverstart()Start the server.StaticFileConfigstaticFiles()Return the static file configuration.
-
Field Details
-
config
-
-
Method Details
-
create
Create Jex to configure with routes etc before starting. -
attribute
Set a custom attribute that can be used by an implementation. -
attribute
Return a custom attribute. -
errorHandling
Configure error handlers. -
errorHandling
Return the Error handler to add error handlers. -
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
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 jex instance. -
exception
Add an exception handler for the given exception type. -
port
Set the port to use. -
context
Set the context path. -
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
-
start
Start the server. -
lifecycle
Return the application lifecycle support.
-