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

Interface Jex


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

 
  • 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.
    • routing

      Jex routing(Routing.HttpService routes)
      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

      default Jex staticResource(StaticContentConfig config)
      Add a static resource route
    • staticResource

      default Jex staticResource(Consumer<StaticContentConfig> consumer)
      Add a static resource route using a consumer
    • jsonService

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

      Jex plugin(JexPlugin 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.
    • port

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

      Jex context(String contextPath)
      Set the context path.
    • 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.