Class ListenerSettings

java.lang.Object
com.codingchili.core.listener.ListenerSettings

public class ListenerSettings extends Object
Settings for transport listeners.
  • Field Details

  • Constructor Details

    • ListenerSettings

      public ListenerSettings()
  • Method Details

    • getTimeout

      public int getTimeout()
      Returns:
      timeout in MS after the router times out the request.
    • setTimeout

      public ListenerSettings setTimeout(int timeout)
      Parameters:
      timeout - the timeout in MS which the router times out the request.
      Returns:
      fluent
    • getKeystore

      public String getKeystore()
      Returns:
      the name of the keystore to use if security is enabled.
    • setKeystore

      public ListenerSettings setKeystore(String keystore)
      Parameters:
      keystore - the name of the keystore to use, sets secure to true when called. The certificate must be added using #SecuritySettings.addKeystore() before it is available. if not added will throw an exception.
      Returns:
      fluent.
    • isBinaryWebsockets

      public boolean isBinaryWebsockets()
      Returns:
      if true indicates that websocket frames should be written as binary.
    • setBinaryWebsockets

      public ListenerSettings setBinaryWebsockets(boolean binaryWebsockets)
      Parameters:
      binaryWebsockets - set to true to write websocket frames as binary, otherwise writes a text frame.
      Returns:
      fluent.
    • isSecure

      public boolean isSecure()
      Returns:
      true if TLS security is enabled on listeners that supports it. Security options are set on the default httpClientOptions.
    • setSecure

      public ListenerSettings setSecure(boolean secure)
      Parameters:
      secure - if set to false disables transport security for the listeners that supports it.
      Returns:
      fluent
    • getMaxRequestBytes

      public int getMaxRequestBytes()
      Returns:
      the maximum number of bytes in a request.
    • setMaxRequestBytes

      public ListenerSettings setMaxRequestBytes(int maxRequestBytes)
      Parameters:
      maxRequestBytes - sets the maximum number of bytes in a single request.
      Returns:
      fluent
    • getType

      public WireType getType()
      Returns:
      the type of the listener, for example tcp or udp.
    • setType

      public ListenerSettings setType(WireType type)
      Parameters:
      type - the type to set for the listener.
      Returns:
      fluent
    • getPort

      public int getPort()
      Returns:
      the port the listener is to be activated on.
    • setPort

      public ListenerSettings setPort(int port)
      Parameters:
      port - the port the listener is to be activated on.
      Returns:
      fluent
    • getApi

      public Map<String,​Endpoint> getApi()
      Returns:
      api mappings for this listener
    • setApi

      public ListenerSettings setApi(Map<String,​Endpoint> api)
      Parameters:
      api - the api mappings to set for the listener
      Returns:
      fluent
    • addApi

      public ListenerSettings addApi(String route, Endpoint api)
      Parameters:
      route - the handler of the route/identity/target to map
      api - the endpoint the request is mapped to.
      Returns:
      fluent
    • isAlpn

      public boolean isAlpn()
      Returns:
      true if ALPN is enabled - this is required to support HTTP/2.
    • setAlpn

      public void setAlpn(boolean alpn)
      Parameters:
      alpn - if true attempt to use ALPN - also requires that secure is set to true.
    • getHttpOptions

      public io.vertx.core.http.HttpServerOptions getHttpOptions()
      Returns:
      HttpOptions created from the listeners settings.
    • setHttpOptions

      public ListenerSettings setHttpOptions(io.vertx.core.http.HttpServerOptions httpOptions)
      Parameters:
      httpOptions - sets the HttpOptions for the listener if applicable
      Returns:
      fluent
    • addMapping

      public ListenerSettings addMapping(String route, Endpoint endpoint)
      Adds a new mapping from the request target to another endpoint.
      Parameters:
      route - the request target to match for this mapping to apply
      endpoint - the endpoint to set the request to
      Returns:
      fluent
    • addListenPort

      public void addListenPort(int port)
      Parameters:
      port - adds a port that the server is listening to. useful if the port is set to 0.
    • getListenPorts

      public Set<Integer> getListenPorts()
      Returns:
      a list of ports the listener is listening to. this list contains all ports that are being listened to for the configuration, which may differ from the requested listening port.
    • getDefaultTarget

      public String getDefaultTarget()
      Returns:
      get the default target to use if unspecified.
    • setDefaultTarget

      public ListenerSettings setDefaultTarget(String defaultTarget)
      Parameters:
      defaultTarget - sets the default target where target is unspecified.
      Returns:
      fluent
    • getDefaultSettings

      public static ListenerSettings getDefaultSettings()
      Returns:
      static supplier of the default settings; used to avoid instantiating a new settings object on every read of setting properties in listeners where no settings has been configured.
    • getBasePath

      public String getBasePath()
      Returns:
      a regex that matches the basePath for received calls. When using #RestRequest the basePath will not be considered when mapping the URL to target/route.
    • setBasePath

      public void setBasePath(String basePath)
      Parameters:
      basePath - see #getBasePath()