|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.archive.crawler.SimpleHttpServer
public class SimpleHttpServer
Wrapper for embedded Jetty server. Loads up all webapps under webapp directory.
Field Summary | |
---|---|
static int |
DEFAULT_PORT
Default web port. |
Constructor Summary | |
---|---|
SimpleHttpServer()
|
|
SimpleHttpServer(boolean localhostOnly,
java.lang.String name,
java.lang.String context,
int port,
boolean expandWebapps)
Deprecated. Use SimpleHttpServer(name,context,hosts,port,expandWebapps) |
|
SimpleHttpServer(int port,
boolean expandWebapps)
|
|
SimpleHttpServer(java.util.List webapps,
int port,
boolean expandWebapps)
|
|
SimpleHttpServer(java.lang.String name,
java.lang.String context,
java.util.Collection<java.lang.String> hosts,
int port,
boolean expandWebapps)
Constructor. |
Method Summary | |
---|---|
protected void |
addWebapp(java.lang.String name,
java.lang.String context,
boolean expand)
Add a webapp. |
protected void |
finalize()
|
java.util.Collection<java.lang.String> |
getHosts()
Returns the hosts that the server is listening on. |
int |
getPort()
|
static java.lang.String |
getRootWebappName()
|
org.mortbay.http.HttpServer |
getServer()
|
protected org.mortbay.http.RequestLog |
getServerLogging()
Setup log files. |
java.io.File |
getWebappPath(java.lang.String name)
Get path to named webapp. |
protected void |
initialize(java.util.Collection<java.lang.String> hosts,
int port)
Initialize the server. |
protected void |
initialize(int port,
boolean localhostOnly)
Deprecated. Use initialize(Collection |
void |
resetAuthentication(java.lang.String realmAndRoleName,
java.lang.String oldUsername,
java.lang.String newUsername,
java.lang.String newPassword)
Reset the administrator login info. |
org.mortbay.http.HashUserRealm |
setAuthentication(java.lang.String realmName,
java.lang.String contextName,
java.lang.String authProperties)
Setup a realm on the server named for the webapp and add to the passed webapp's context. |
void |
setAuthentication(java.lang.String realmName,
java.lang.String contextName,
java.lang.String username,
java.lang.String password,
java.lang.String role)
|
void |
startServer()
Start the server. |
void |
stopServer()
Stop the running server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_PORT
Constructor Detail |
---|
public SimpleHttpServer() throws java.lang.Exception
java.lang.Exception
public SimpleHttpServer(int port, boolean expandWebapps) throws java.lang.Exception
java.lang.Exception
public SimpleHttpServer(boolean localhostOnly, java.lang.String name, java.lang.String context, int port, boolean expandWebapps) throws java.lang.Exception
name
- Name of webapp to load.context
- Where to mount the webapp. If passed context is
null or empty string, we'll use '/' + name
else if
passed '/' then we'll add the webapp as the root webapp.port
- Port to run on.expandWebapps
- True if we're to expand the webapp passed.
java.lang.Exception
public SimpleHttpServer(java.lang.String name, java.lang.String context, java.util.Collection<java.lang.String> hosts, int port, boolean expandWebapps) throws java.lang.Exception
name
- Name of webapp to loadcontext
- 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 webapphosts
- list of hosts to bind toport
- port to listen onexpandWebapps
- true to expand webapp passed
java.lang.Exception
public SimpleHttpServer(java.util.List webapps, int port, boolean expandWebapps) throws java.lang.Exception
webapps
- List of webapps to load.port
- Port to run on.expandWebapps
- True if we're to expand the webapps found.
java.lang.Exception
Method Detail |
---|
protected void addWebapp(java.lang.String name, java.lang.String context, boolean expand) throws java.io.IOException
name
- Name of webapp to add.context
- Context to add the webapp on.expand
- True if we should expand the webapps.
java.io.IOException
protected void initialize(int port, boolean localhostOnly)
port
- Port to start the server on.protected void initialize(java.util.Collection<java.lang.String> hosts, int port)
hosts
- the hostnames to bind to; if empty or null, will bind
to all interfacesport
- the port to listen onprotected org.mortbay.http.RequestLog getServerLogging() throws java.lang.Exception
java.lang.Exception
public void startServer() throws java.lang.Exception
java.lang.Exception
- if problem starting server or if server already
started.public void stopServer() throws java.lang.InterruptedException
java.lang.InterruptedException
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public int getPort()
public org.mortbay.http.HttpServer getServer()
public org.mortbay.http.HashUserRealm setAuthentication(java.lang.String realmName, java.lang.String contextName, java.lang.String authProperties) throws java.io.IOException
web.xml
needs to set with
a security constraint that points to a realm named for the passed
webapp, webappName
.
realmName
- Name of realm to configure.contextName
- Name of context we're using with this realm.
If null, we'll use the realm name as context name.authProperties
- Path to file that holds the auth login and
password.
java.io.IOException
public void setAuthentication(java.lang.String realmName, java.lang.String contextName, java.lang.String username, java.lang.String password, java.lang.String role) throws java.io.IOException
java.io.IOException
public void resetAuthentication(java.lang.String realmAndRoleName, java.lang.String oldUsername, java.lang.String newUsername, java.lang.String newPassword)
realmAndRoleName
- for our use, always 'admin'oldUsername
- previous username to replace/disablenewUsername
- new username (may be same as old)newPassword
- new passwordpublic java.io.File getWebappPath(java.lang.String name)
name
- Name of webpp. Possible names are 'admin' or 'selftest'.
public static java.lang.String getRootWebappName()
public java.util.Collection<java.lang.String> getHosts()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |