Rio Project 4.2 API Documentation



org.rioproject.tools.webster
Class Webster

java.lang.Object
  extended by org.rioproject.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.rioproject.tools.webster.port Sets the port for webster to use 0
org.rioproject.tools.webster.port Sets the port for webster to use 0
org.rioproject.tools.webster.root Root directory to serve code from. Webster supports multiple root directories which are separated by a ; System.getProperty(user.home)

Author:
Dennis Reedy

Constructor Summary
Webster()
          Create a new Webster.
Webster(int port)
          Create a new Webster The Webster will be serving code as determined by the either the org.rioproject.tools.webster.root system property (if set) or defaulting to the user.dir system property.
Webster(int port, String roots)
          Create a new Webster
Webster(int port, String roots, String bindAddress)
          Create a new Webster
Webster(ServerSocketFactory socketFactory, String roots, String bindAddress)
          Create a new Webster
Webster(String[] options, LifeCycle lifeCycle)
          Create a new Webster, compatible with the ServiceStarter mechanism in Jini 2.0
 
Method Summary
protected  String[] expandRoots()
           
 String getAddress()
          Get address that Webster is bound to
 int getPort()
          Get the port Webster is bound to
 String getRoots()
          Get the roots Webster is serving
static void main(String[] args)
           
protected  File parseFileName(String filename)
           
 void run()
           
 void terminate()
          Terminate a running Webster instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Webster

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

The Webster will be serving code as determined by the either the org.rioproject.tools.webster.root system property (if set) or defaulting to the user.dir system property.

Throws:
BindException - if Webster cannot create a socket

Webster

public Webster(int port)
        throws BindException
Create a new Webster

The Webster will be serving code as determined by the either the org.rioproject.tools.webster.root system property (if set) or defaulting to the user.dir system property.

Parameters:
port - The port to use
Throws:
BindException - if Webster cannot create a socket

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 - if Webster cannot create a socket

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 - if Webster cannot create a socket

Webster

public Webster(ServerSocketFactory socketFactory,
               String roots,
               String bindAddress)
        throws BindException
Create a new Webster

Parameters:
socketFactory - The ServerSocketFactory to use when creating the socket the Webster will be bound to
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 - if Webster cannot create a socket

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], [-maxThreads maxThreads] [-soTimeout soTimeout] [-portRange range]. Note -port and -portRange are mutually exclusive
lifeCycle - The LifeCycle object, may be null
Throws:
BindException - if Webster cannot create a socket
IllegalArgumentException - if both -port and -portRange are provided
NumberFormatException - if the ports cannot be parsed into an integer
Method Detail

getRoots

public String getRoots()
Get the roots Webster is serving

Returns:
The roots Webster is serving as a semicolon delimited String

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.

terminate

public void terminate()
Terminate a running Webster instance


getPort

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

Returns:
Te 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)

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.