org.kuali.rice.core.web.jetty
Class JettyServer

java.lang.Object
  extended by org.kuali.rice.core.web.jetty.JettyServer
All Implemented Interfaces:
Lifecycle

public class JettyServer
extends Object
implements Lifecycle


Field Summary
private  org.mortbay.jetty.servlet.Context context
           
private  String contextName
           
private  boolean failOnContextFailure
           
static String JETTYSERVER_TESTMODE_ATTRIB
          The name of an attribute we set in the ServletContext to indicate to the webapp that it is running within unit tests, in case it needs to alter its configuration or behavior.
private static org.apache.log4j.Logger LOG
           
private  int port
           
private  String relativeWebappRoot
           
private  org.mortbay.jetty.Server server
           
private  Class servletClass
           
private  boolean testMode
          Whether we are in test mode
 
Constructor Summary
JettyServer()
           
JettyServer(int port)
           
JettyServer(int port, String contextName)
           
JettyServer(int port, String contextName, Class servletClass)
           
JettyServer(int port, String contextName, String relativeWebappRoot)
           
JettyServer(int port, String contextName, String relativeWebappRoot, Class servletClass)
           
 
Method Summary
protected  boolean contextStartupFailed()
          A hack for Jetty so that we can detect if context startup failed.
protected  org.mortbay.jetty.Server createServer()
           
 org.mortbay.jetty.servlet.Context getContext()
           
 String getContextName()
           
 int getPort()
           
 String getRelativeWebappRoot()
           
 org.mortbay.jetty.Server getServer()
           
 boolean isFailOnContextFailure()
           
 boolean isStarted()
           
 boolean isTestMode()
           
static void main(String[] args)
           
protected  void setBaseDirSystemProperty()
           
 void setContextName(String contextName)
           
 void setFailOnContextFailure(boolean failOnContextFailure)
           
 void setPort(int port)
           
 void setRelativeWebappRoot(String relativeWebappRoot)
           
 void setTestMode(boolean t)
           
 void start()
           
 void stop()
           
 String toString()
           
private  boolean useWebAppContext()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG

JETTYSERVER_TESTMODE_ATTRIB

public static final String JETTYSERVER_TESTMODE_ATTRIB
The name of an attribute we set in the ServletContext to indicate to the webapp that it is running within unit tests, in case it needs to alter its configuration or behavior.

See Also:
Constant Field Values

port

private int port

contextName

private String contextName

relativeWebappRoot

private String relativeWebappRoot

servletClass

private Class servletClass

server

private org.mortbay.jetty.Server server

context

private org.mortbay.jetty.servlet.Context context

failOnContextFailure

private boolean failOnContextFailure

testMode

private boolean testMode
Whether we are in test mode

Constructor Detail

JettyServer

public JettyServer()

JettyServer

public JettyServer(int port)

JettyServer

public JettyServer(int port,
                   String contextName)

JettyServer

public JettyServer(int port,
                   String contextName,
                   String relativeWebappRoot)

JettyServer

public JettyServer(int port,
                   String contextName,
                   Class servletClass)

JettyServer

public JettyServer(int port,
                   String contextName,
                   String relativeWebappRoot,
                   Class servletClass)
Method Detail

setTestMode

public void setTestMode(boolean t)

isTestMode

public boolean isTestMode()

getServer

public org.mortbay.jetty.Server getServer()

getContext

public org.mortbay.jetty.servlet.Context getContext()

start

public void start()
           throws Exception
Specified by:
start in interface Lifecycle
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface Lifecycle
Throws:
Exception

isStarted

public boolean isStarted()
Specified by:
isStarted in interface Lifecycle

createServer

protected org.mortbay.jetty.Server createServer()

setBaseDirSystemProperty

protected void setBaseDirSystemProperty()

useWebAppContext

private boolean useWebAppContext()

contextStartupFailed

protected boolean contextStartupFailed()
                                throws Exception
A hack for Jetty so that we can detect if context startup failed. Jetty has no programatic way available to detect if context startup failed. Instead we have to use reflection to check the value of a private variable. See http://jira.codehaus.org/browse/JETTY-319 for more details on the issue.

Throws:
Exception

getRelativeWebappRoot

public String getRelativeWebappRoot()

setRelativeWebappRoot

public void setRelativeWebappRoot(String relativeWebappRoot)

getContextName

public String getContextName()

setContextName

public void setContextName(String contextName)

getPort

public int getPort()

setPort

public void setPort(int port)

isFailOnContextFailure

public boolean isFailOnContextFailure()

setFailOnContextFailure

public void setFailOnContextFailure(boolean failOnContextFailure)

toString

public String toString()
Overrides:
toString in class Object

main

public static void main(String[] args)


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.