java.lang.Object
io.avaje.jex.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 ClassesModifier and TypeClassDescriptionstatic classstatic classJetty specific configuration options.static interfaceThe running server. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionaccessManager(AccessManager accessManager)Set the AccessManager.Configure via a lambda taking the jex instance.Set the context path.static Jexcreate()Create Jex to configure with routes etc before starting.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.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.start()Start the server.Return the static file configuration.
-
Field Details
-
inner
-
jetty
-
-
Method Details
-
create
Create Jex to configure with routes etc before starting. -
errorHandling
Configure error handlers. -
errorHandling
Return the Error handler to add error handlers. -
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. -
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.
-