Package rife.engine

Class Server

java.lang.Object
rife.engine.Server

public class Server extends Object
Embedded Jetty server that can directly start from a RIFE2 site.
Since:
1.0
  • Field Details

    • DEFAULT_PORT

      public static final int DEFAULT_PORT
      See Also:
    • DEFAULT_HOST

      public static final String DEFAULT_HOST
    • DEFAULT_STATIC_RESOURCE_BASE

      public static final String DEFAULT_STATIC_RESOURCE_BASE
    • DEFAULT_MIN_THREADS

      public static final int DEFAULT_MIN_THREADS
      See Also:
    • DEFAULT_MAX_THREADS

      public static final int DEFAULT_MAX_THREADS
      See Also:
    • DEFAULT_IDLE_TIMEOUT_MS

      public static final int DEFAULT_IDLE_TIMEOUT_MS
      See Also:
    • sslKeyStorePath_

      protected String sslKeyStorePath_
    • sslKeyStorePassword_

      protected String sslKeyStorePassword_
    • sslCertAlias_

      protected String sslCertAlias_
    • sslTrustStorePath_

      protected String sslTrustStorePath_
    • sslTrustStorePassword_

      protected String sslTrustStorePassword_
    • sslNeedClientAuth_

      protected boolean sslNeedClientAuth_
    • sslWantClientAuth_

      protected boolean sslWantClientAuth_
    • enableVirtualThreads_

      protected boolean enableVirtualThreads_
  • Constructor Details

    • Server

      public Server()
      Instantiates a new embedded Jetty server.
      Since:
      1.0
  • Method Details

    • port

      public Server port(int port)
      Configures the HTTP port the server will be listening to.
      Parameters:
      port - a port number (defaults to 8080)
      Returns:
      the instance of the server that's being configured
      Since:
      1.0
    • host

      public Server host(String host)
      Configures the host the server will be listening on.
      Parameters:
      host - the hostname to listen on
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • staticResourceBase

      public Server staticResourceBase(String base)
      Configures the base path where static resources will be looked up.
      Parameters:
      base - the base path for static resources
      Returns:
      the instance of the server that's being configured
      Since:
      1.0
    • staticUberJarResourceBase

      public Server staticUberJarResourceBase(String base)
      Configures the base directory where static resources will be looked up from.

      This will be relative to the classpath root of an Uber Jar that contains your web application as well as the RIFE2 framework classes and everything else required to run your web application.

      Parameters:
      base - the base directory for static resources
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • minThreads

      public Server minThreads(int minThreads)
      Configures the minimum number of threads to use.

      Defaults to 8.

      Parameters:
      minThreads - the minimum number of threads to use
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • maxThreads

      public Server maxThreads(int maxThreads)
      Configures the maximum number of threads to use.

      Defaults to 200.

      Parameters:
      maxThreads - the maximum number of threads to use
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • idleTimeout

      public Server idleTimeout(int idleTimeout)
      Configures the maximum thread idle time in ms.

      Defaults to 60000.

      Parameters:
      idleTimeout - the maximum thread idle time in ms
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • sslKeyStorePath

      public Server sslKeyStorePath(String path)
      Sets the file system path to the SSL key store.

      When this is provided, the embedded server will switch from http to https. Other SSL parameters have no effect unless the key store path is configured.

      Parameters:
      path - the SSL key store path
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • sslKeyStorePassword

      public Server sslKeyStorePassword(String password)
      Sets the password for the SSL key store.
      Parameters:
      password - the SSL key store password
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • sslCertAlias

      public Server sslCertAlias(String alias)
      Sets the SSL certificate alias.
      Parameters:
      alias - the SSL certificate alias
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • sslTrustStorePath

      public Server sslTrustStorePath(String path)
      Sets the path to the SSL trust store.
      Parameters:
      path - the SSL trust store path
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • sslTrustStorePassword

      public Server sslTrustStorePassword(String password)
      Sets the password for the SSL trust store.
      Parameters:
      password - the SSL trust store password
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • sslNeedClientAuth

      public Server sslNeedClientAuth(boolean auth)
      Sets whether the SSL client certificate needs to be authenticated.
      Parameters:
      auth - true if the client certificate needs to be authenticated; or false otherwise
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • sslWantClientAuth

      public Server sslWantClientAuth(boolean auth)
      Sets whether the server wants SSL client certificate to be authenticated.
      Parameters:
      auth - true of server wants the client certificate to be authenticated; or false otherwise
      Returns:
      the instance of the server that's being configured
      Since:
      1.1
    • enabledVirtualThreads

      public Server enabledVirtualThreads(boolean enable)
      Sets whether virtual threads are used.

      When virtual threads are available, RIFE2's embedded server will automatically switch to using them. Use this method to explicitly disable virtual threads.

      Parameters:
      enable - true if virtual threads should be used when a suitable JDK is present; or false if virtual threads should never be used
      Returns:
      the instance of the server that's being configured
    • properties

      public HierarchicalProperties properties()
      Retrieves the hierarchical properties for this server instance.
      Returns:
      this server's collection of hierarchical properties
      Since:
      1.0
    • start

      public Server start(Site site)
      Start the embedded server for a particular site.
      Parameters:
      site - the Site instance that the server will be set up for
      Returns:
      the instance of the server that's being started
      Since:
      1.0
      See Also:
    • stop

      public void stop()
      Stop running the embedded server.
      Since:
      1.0