Class Webster

java.lang.Object
org.jini.rio.tools.webster.Webster
All Implemented Interfaces:
Runnable

public class Webster extends Object implements Runnable
Webster is a HTTP server which can serve code from multiple codebases. Environment variables used to control Webster are as follows:

org.jini.rio.tools.webster.port Sets the port for webster to use 0
org.jini.rio.tools.webster.restrictAccess Restricts access only to files under root. Disallows any "../" notation. true
org.jini.rio.tools.webster.root Root directory to serve code from. Webster supports multiple root directories which are separated by a ; System.getProperty(user.home)
  • Constructor Details

    • Webster

      public Webster() throws BindException
      Create a new Webster. The port is determined by the org.jini.rio.tools.webster.port system property. If the org.jini.rio.tools.webster.port system property does not exist, an anonynous port will be allocated.
      Throws:
      BindException
    • Webster

      public Webster(int port) throws BindException
      Create a new Webster
      Parameters:
      port - The port to use
      Throws:
      BindException
    • Webster

      public Webster(String roots) throws BindException
      Create a new Webster
      Parameters:
      roots - The root(s) to serve code from. This is a semi-colin delimited list of directories
      Throws:
      BindException
    • Webster

      public Webster(int port, String roots) throws BindException
      Create a new Webster
      Parameters:
      port - The port to use
      roots - The root(s) to serve code from. This is a semi-colin delimited list of directories
      Throws:
      BindException
    • Webster

      public Webster(int port, String roots, String bindAddress) throws BindException
      Create a new Webster
      Parameters:
      port - The port to use
      roots - The root(s) to serve code from. This is a semi-colin delimited list of directories
      bindAddress - TCP/IP address which Webster should bind to (null implies no specific address)
      Throws:
      BindException
    • Webster

      public Webster(int port, String roots, String bindAddress, int minThreads, int maxThreads) throws BindException
      Create a new Webster
      Parameters:
      port - The port to use
      roots - The root(s) to serve code from. This is a semi-colin delimited list of directories
      bindAddress - TCP/IP address which Webster should bind to (null implies no specific address)
      minThreads - Minimum threads to use in the ThreadPool
      maxThreads - Minimum threads to use in the ThreadPool
      Throws:
      BindException
    • Webster

      public Webster(String[] options, LifeCycle lifeCycle) throws BindException
      Create a new Webster, compatible with the ServiceStarter mechanism in Jini 2.0
      Parameters:
      options - String[] of options. Valid options are [-port port], [-roots list-of-roots], [-bindAddress address], [-minThreads minThreads], [-maxThreads maxThreads] [-soTimeout soTimeout]
      lifeCycle - The LifeCycle object, may be null
      Throws:
      BindException
  • Method Details

    • getRoots

      public String getRoots()
      Get the roots Webster is serving as a semicolon delimited String
    • getURL

      public String getURL()
    • getAddress

      public String getAddress()
      Get address that Webster is bound to
      Returns:
      The host address the server socket Webster is using is bound to. If the socket is null, return null.
    • getHostName

      public String getHostName()
    • getProtocol

      public String getProtocol()
    • terminate

      public void terminate()
      Terminate a running Webster instance
    • getPort

      public int getPort()
      Get the port Webster is bound to
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • parseFileName

      protected File parseFileName(String filename)
    • expandRoots

      protected String[] expandRoots()
    • main

      public static void main(String[] args) throws IOException
      Throws:
      IOException
    • deleteFile

      public static boolean deleteFile(File dir)