Module io.avaje.jex
Package io.avaje.jex

Interface Jex


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();

 
  • Method Details

    • create

      static Jex 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

      <T> Jex attribute(Class<T> cls, T instance)
      Set a custom attribute that can be used by an implementation.
    • attribute

      <T> T attribute(Class<T> cls)
      Return a custom attribute.
    • errorHandling

      Jex errorHandling(ErrorHandling.Service service)
      Configure error handlers.
    • errorHandling

      ErrorHandling errorHandling()
      Return the Error handler to add error handlers.
    • serverConfig

      ServerConfig serverConfig()
      Return the server specific configuration.
    • serverConfig

      Jex serverConfig(ServerConfig serverConfig)
      Set the server specific configuration.
    • routing

      Jex routing(Routing.Service routes)
      Add routes and handlers to the routing.
    • routing

      Jex routing(Collection<Routing.Service> routes)
      Add many routes and handlers to the routing.
    • routing

      Routing routing()
      Return the Routing to configure.
    • accessManager

      Jex accessManager(AccessManager accessManager)
      Set the AccessManager.
    • jsonService

      Jex jsonService(JsonService jsonService)
      Set the JsonService.
    • plugin

      Jex plugin(Plugin plugin)
      Add Plugin functionality.
    • configureWith

      Jex configureWith(io.avaje.inject.BeanScope beanScope)
      Configure given the dependency injection scope from avaje-inject.
      Parameters:
      beanScope - The scope potentially containing Handlers, AccessManager, Plugins etc.
    • configure

      Jex configure(Consumer<JexConfig> configure)
      Configure via a lambda taking the JexConfig instance.
    • exception

      <T extends Exception> Jex exception(Class<T> exceptionClass, ExceptionHandler<T> handler)
      Add an exception handler for the given exception type.
    • port

      Jex port(int port)
      Set the port to use.
    • context

      Jex context(String contextPath)
      Set the context path.
    • staticFiles

      StaticFileConfig staticFiles()
      Return the static file configuration.
    • register

      Jex register(TemplateRender renderer, String... extensions)
      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 register
      extensions - 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.