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

Interface JexConfig


public sealed interface JexConfig
Jex configuration interface.

Provides a fluent API for configuring Jex's various settings, including port, host, health endpoint, trailing slash handling, JSON service, template renderers, executor service, HTTPS configuration, compression, and plugin loading.

  • Method Details

    • compression

      CompressionConfig compression()
      Returns the configured compression settings.
    • compression

      JexConfig compression(Consumer<CompressionConfig> consumer)
      Configures compression settings using a consumer function.
      Parameters:
      consumer - The consumer function to configure compression settings.
      Returns:
      The updated configuration.
    • contextPath

      String contextPath()
      Return the contextPath. (Defaults to "/")
    • contextPath

      JexConfig contextPath(String contextPath)
      Set the contextPath passed to the underlying HttpServer. (defaults to "/")
      Parameters:
      contextPath - The context path
    • disableSpiPlugins

      JexConfig disableSpiPlugins()
      Disables auto-configuring the current instance with JexPlugin loaded using the ServiceLoader.
    • executor

      Executor executor()
      Executor for serving requests. Defaults to a Executors.newVirtualThreadPerTaskExecutor()
    • executor

      JexConfig executor(Executor executor)
      Sets the executor service used to handle incoming requests.
      Parameters:
      executor - The executor service.
    • health

      boolean health()
      Returns whether the health endpoint is enabled.
    • health

      JexConfig health(boolean health)
      Enables/Disables the default health endpoint.
      Parameters:
      health - whether to enable/disable.
    • host

      String host()
      Returns the configured host.
    • host

      JexConfig host(String host)
      Set the host on which the HttpServer will bind to. Defaults to any local address.
      Parameters:
      host - The host.
    • httpsConfig

      HttpsConfigurator httpsConfig()
      Return the HttpsConfigurator if https is enabled.
    • httpsConfig

      JexConfig httpsConfig(HttpsConfigurator https)
      Enable https with the provided HttpsConfigurator
      Parameters:
      https - The HTTPS configuration.
    • ignoreTrailingSlashes

      boolean ignoreTrailingSlashes()
      Returns whether trailing slashes in request URIs are ignored.
    • ignoreTrailingSlashes

      JexConfig ignoreTrailingSlashes(boolean ignoreTrailingSlashes)
      Configures whether trailing slashes in request URIs should be ignored.
      Parameters:
      ignoreTrailingSlashes - whether to enable/disable trailing slashes.
    • jsonService

      JsonService jsonService()
      Returns the configured JSON service.
    • jsonService

      JexConfig jsonService(JsonService jsonService)
      Sets the JSON service used for (de)serialization.
      Parameters:
      jsonService - The json service instance.
    • port

      int port()
      Returns the configured port number. (Defaults to 8080 if not set)
    • port

      JexConfig port(int port)
      Sets the port number on which the HttpServer will listen for incoming requests.
      Parameters:
      port - The port number.
    • renderer

      JexConfig renderer(String extension, TemplateRender renderer)
      Registers a template renderer for a specific file extension.
      Parameters:
      extension - The file extension.
      renderer - The template renderer implementation.
    • renderers

      Map<String,TemplateRender> renderers()
      Returns a map of registered template renderers, keyed by file extension.
    • scheme

      String scheme()
      Return the schema as http or https.
    • socketBacklog

      int socketBacklog()
      Return the socket backlog.
    • socketBacklog

      JexConfig socketBacklog(int backlog)
      Set the socket backlog. If this value is less than or equal to zero, then a system default value is used
      Parameters:
      backlog - the socket backlog. If this value is less than or equal to zero, then a system default value is used
    • useSpiPlugins

      boolean useSpiPlugins()
      Return true if SPI plugins should be loaded and registered.