Package rife.engine

Class TomcatServer

java.lang.Object
rife.engine.TomcatServer

public class TomcatServer extends Object
Embedded Tomcat server that can directly start from a RIFE2 site.
Since:
1.7.1
  • Constructor Details

    • TomcatServer

      public TomcatServer()
      Instantiates a new embedded Tomcat server.
      Since:
      1.7.1
  • Method Details

    • addRole

      public TomcatServer addRole(String role, String user)
      Add a role for a user.
      Parameters:
      role - the role name
      user - the username
      Returns:
      the instance of the server that's being configured
      Since:
      1.7.1
    • addUser

      public TomcatServer addUser(String user, String pass)
      Add a user for the in-memory realm.
      Parameters:
      user - the username
      pass - the password
      Returns:
      the instance of the server that's being configured
      Since:
      1.7.1
    • addWebapp

      public TomcatServer addWebapp(String docBase)
      Adds a web application to the webapps directory.
      Parameters:
      docBase - the base directory for the context, for static file
      Returns:
      the instance of the server that's being configured
      Since:
      1.7.1
      See Also:
    • addContext

      public TomcatServer addContext(String docBase)
      Adds a web application location to the root context.
      Parameters:
      docBase - the base directory for the context, for static file
      Returns:
      the instance of the server that's being configured
      Since:
      1.8.1
      See Also:
    • baseDir

      public TomcatServer baseDir(String dir)
      Configures the Tomcat base directory on which all others, such as the work directory, will be derived.
      Parameters:
      dir - the base directory
      Returns:
      the instance of the server that's being configured
      Since:
      1.7.1
    • hostname

      public TomcatServer hostname(String host)
      Configures the host name the server will be listening on.
      Parameters:
      host - the default host name
      Returns:
      the instance of the server that's being configured
      Since:
      1.7.1
    • port

      public TomcatServer port(int port)
      Configures the port the server will be listening to.
      Parameters:
      port - the port number
      Returns:
      the instance of the server that's being configured
      Since:
      1.7.1
    • connectionTimeout

      public TomcatServer connectionTimeout(int timeout)
      Configures the connection timeout of the Tomcat connector in ms.

      Tomcat applies this timeout to blocking writes that make no progress, so it bounds how long a sending thread can be stalled by the client of a server-sent events stream that stopped reading. Keep it longer than the heartbeat interval, so that healthy idle streams are kept alive.

      Defaults to Tomcat's own connector default of 60 seconds.

      Parameters:
      timeout - the connection timeout in ms
      Returns:
      the instance of the server that's being configured
      Since:
      1.10
    • scanManifest

      public TomcatServer scanManifest(boolean scanManifest)
      Configures whether JARs declared in Class-Path MANIFEST.MF entry of other scanned JARs will be scanned.

      By default, manifests are not scanned.

      Parameters:
      scanManifest - true to scan manifests, false otherwise
      Returns:
      the instance of the server that's being configured
      Since:
      1.8.0
    • properties

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

      public TomcatServer start(Site site)
      Starts the embedded server.
      Parameters:
      site - the Site instance that the server will be set up for
      Returns:
      the instance of the server that's being configured
      Since:
      1.7.1
    • stop

      public void stop()
      Stops the embedded server.
      Since:
      1.7.1