| java.lang.Object org.archive.crawler.SimpleHttpServer
SimpleHttpServer | public class SimpleHttpServer (Code) | | Wrapper for embedded Jetty server.
Loads up all webapps under webapp directory.
|
Field Summary | |
final public static int | DEFAULT_PORT Default web port. |
Constructor Summary | |
public | SimpleHttpServer() | public | SimpleHttpServer(int port, boolean expandWebapps) | public | SimpleHttpServer(boolean localhostOnly, String name, String context, int port, boolean expandWebapps) Parameters: name - Name of webapp to load. Parameters: context - Where to mount the webapp. | public | SimpleHttpServer(String name, String context, Collection<String> hosts, int port, boolean expandWebapps) Constructor.
Parameters: name - Name of webapp to load Parameters: context - Where to mount the webap. | public | SimpleHttpServer(List webapps, int port, boolean expandWebapps) |
Method Summary | |
protected void | addWebapp(String name, String context, boolean expand) Add a webapp. | protected void | finalize() | public Collection<String> | getHosts() Returns the hosts that the server is listening on. | public int | getPort() | public static String | getRootWebappName() | public HttpServer | getServer() | protected RequestLog | getServerLogging() Setup log files.
RequestLog instance to add to a server. | public File | getWebappPath(String name) Get path to named webapp.
Parameters: name - Name of webpp. | protected void | initialize(int port, boolean localhostOnly) Initialize the server. | protected void | initialize(Collection<String> hosts, int port) Initialize the server. | public void | resetAuthentication(String realmAndRoleName, String oldUsername, String newUsername, String newPassword) Reset the administrator login info. | public HashUserRealm | setAuthentication(String realmName, String contextName, String authProperties) Setup a realm on the server named for the webapp and add to the
passed webapp's context.
Used by the selftest to check digest authentication is working.
For this all to work, the web.xml needs to set with
a security constraint that points to a realm named for the passed
webapp, webappName .
Parameters: realmName - Name of realm to configure. Parameters: contextName - Name of context we're using with this realm.If null, we'll use the realm name as context name. Parameters: authProperties - Path to file that holds the auth login andpassword. | public void | setAuthentication(String realmName, String contextName, String username, String password, String role) | public synchronized void | startServer() Start the server. | public synchronized void | stopServer() Stop the running server. |
DEFAULT_PORT | final public static int DEFAULT_PORT(Code) | | Default web port.
|
SimpleHttpServer | public SimpleHttpServer(int port, boolean expandWebapps) throws Exception(Code) | | |
SimpleHttpServer | public SimpleHttpServer(boolean localhostOnly, String name, String context, int port, boolean expandWebapps) throws Exception(Code) | | Parameters: name - Name of webapp to load. Parameters: context - Where to mount the webapp. If passed context isnull or empty string, we'll use '/' + name else ifpassed '/' then we'll add the webapp as the root webapp. Parameters: port - Port to run on. Parameters: expandWebapps - True if we're to expand the webapp passed. throws: Exception - |
SimpleHttpServer | public SimpleHttpServer(String name, String context, Collection<String> hosts, int port, boolean expandWebapps) throws Exception(Code) | | Constructor.
Parameters: name - Name of webapp to load Parameters: context - Where to mount the webap. If null or empty string,we'll use '/' + name ; if passed '/'then we'll add the webapp as the root webapp Parameters: hosts - list of hosts to bind to Parameters: port - port to listen on Parameters: expandWebapps - true to expand webapp passed throws: Exception - |
SimpleHttpServer | public SimpleHttpServer(List webapps, int port, boolean expandWebapps) throws Exception(Code) | | Parameters: webapps - List of webapps to load. Parameters: port - Port to run on. Parameters: expandWebapps - True if we're to expand the webapps found. throws: Exception - |
addWebapp | protected void addWebapp(String name, String context, boolean expand) throws IOException(Code) | | Add a webapp.
Parameters: name - Name of webapp to add. Parameters: context - Context to add the webapp on. Parameters: expand - True if we should expand the webapps. throws: IOException - |
getHosts | public Collection<String> getHosts()(Code) | | Returns the hosts that the server is listening on.
the hosts that the server is listening on. |
getPort | public int getPort()(Code) | | Port server is running on. |
getRootWebappName | public static String getRootWebappName()(Code) | | Returns the root webapp name. |
getServer | public HttpServer getServer()(Code) | | Server reference. |
getServerLogging | protected RequestLog getServerLogging() throws Exception(Code) | | Setup log files.
RequestLog instance to add to a server. throws: Exception - |
getWebappPath | public File getWebappPath(String name)(Code) | | Get path to named webapp.
Parameters: name - Name of webpp. Possible names are 'admin' or 'selftest'. Path to deployed webapp. |
initialize | protected void initialize(int port, boolean localhostOnly)(Code) | | Initialize the server.
Called from constructors.
Parameters: port - Port to start the server on. |
initialize | protected void initialize(Collection<String> hosts, int port)(Code) | | Initialize the server. Called from constructors.
Parameters: hosts - the hostnames to bind to; if empty or null, will bindto all interfaces Parameters: port - the port to listen on |
resetAuthentication | public void resetAuthentication(String realmAndRoleName, String oldUsername, String newUsername, String newPassword)(Code) | | Reset the administrator login info.
Parameters: realmAndRoleName - for our use, always 'admin' Parameters: oldUsername - previous username to replace/disable Parameters: newUsername - new username (may be same as old) Parameters: newPassword - new password |
setAuthentication | public HashUserRealm setAuthentication(String realmName, String contextName, String authProperties) throws IOException(Code) | | Setup a realm on the server named for the webapp and add to the
passed webapp's context.
Used by the selftest to check digest authentication is working.
For this all to work, the web.xml needs to set with
a security constraint that points to a realm named for the passed
webapp, webappName .
Parameters: realmName - Name of realm to configure. Parameters: contextName - Name of context we're using with this realm.If null, we'll use the realm name as context name. Parameters: authProperties - Path to file that holds the auth login andpassword. Hash of user realms. throws: IOException - |
startServer | public synchronized void startServer() throws Exception(Code) | | Start the server.
throws: Exception - if problem starting server or if server alreadystarted. |
|
|