public sealed 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 TypeMethodDescription<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.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.HttpService routes) Add routes and handlers to the routing.routing(Collection<Routing.HttpService> routes) Add many routes and handlers to the routing.start()Start the server.default JexstaticResource(StaticContentConfig config) Add a static resource routedefault JexstaticResource(Consumer<StaticContentConfig> consumer) Add a static resource route using a consumer
-
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. -
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. -
staticResource
Add a static resource route -
staticResource
Add a static resource route using a consumer -
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. -
port
Set the port to use. -
context
Set the context path. -
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.
-