Class SeedlingServer

  extended by org.eclipse.jetty.util.component.AbstractLifeCycle
      extended by org.eclipse.jetty.util.component.AggregateLifeCycle
          extended by org.eclipse.jetty.server.handler.AbstractHandler
              extended by org.eclipse.jetty.server.handler.AbstractHandlerContainer
                  extended by org.eclipse.jetty.server.handler.HandlerWrapper
                      extended by org.eclipse.jetty.server.Server
                          extended by consciouscode.seedling.jetty.SeedlingServer
All Implemented Interfaces:
LocatableNode, ServiceNode, org.eclipse.jetty.server.Handler, org.eclipse.jetty.server.HandlerContainer, org.eclipse.jetty.util.Attributes, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.LifeCycle

public class SeedlingServer
extends org.eclipse.jetty.server.Server
implements LocatableNode, ServiceNode

Extends Jetty's Server to automatically build context mappings from entries in the Seedling container.

Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.server.Server
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
Field Summary
Fields inherited from class org.eclipse.jetty.server.handler.HandlerWrapper
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
Constructor Summary
SeedlingServer(int port)
Method Summary
 Log getLog()
 NodeLocation getNodeLocation()
          Returns the location of this node.
 BranchNode getPathBranch()
 org.eclipse.jetty.server.handler.ContextHandler getRootContextHandler()
          Gets the context that will handle "/" paths.
 void nodeInstalled(NodeLocation location)
          Register the Seedling address at which this node has been installed.
 void setLog(Log log)
 void setPathBranch(BranchNode branch)
 void setRootContextHandler(org.eclipse.jetty.server.handler.ContextHandler handler)
          Sets the context that will handle "/" paths.
 void startService()
          Starts a Seedling service.
 void stopService()
          Stops a Seedling service.
Methods inherited from class org.eclipse.jetty.server.Server
addBean, addConnector, addLifeCycle, clearAttributes, doStart, doStop, dump, getAttribute, getAttributeNames, getConnectors, getContainer, getGracefulShutdown, getMaxCookieVersion, getSendDateHeader, getSendServerVersion, getSessionIdManager, getStopAtShutdown, getThreadPool, getVersion, handle, handleAsync, isDumpAfterStart, isDumpBeforeStop, join, main, removeAttribute, removeBean, removeConnector, removeLifeCycle, setAttribute, setConnectors, setDumpAfterStart, setDumpBeforeStop, setGracefulShutdown, setMaxCookieVersion, setSendDateHeader, setSendServerVersion, setSessionIdManager, setStopAtShutdown, setThreadPool, toString
Methods inherited from class org.eclipse.jetty.server.handler.HandlerWrapper
destroy, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, handle, setHandler, setServer
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandlerContainer
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler
dumpThis, getServer
Methods inherited from class org.eclipse.jetty.util.component.AggregateLifeCycle
dump, dump, dump, dump, dumpStdErr, getBean, getBeans, getBeans, removeBeans
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop

Constructor Detail


public SeedlingServer()


public SeedlingServer(int port)
Method Detail


public Log getLog()


public void setLog(Log log)


public org.eclipse.jetty.server.handler.ContextHandler getRootContextHandler()
Gets the context that will handle "/" paths.


public void setRootContextHandler(org.eclipse.jetty.server.handler.ContextHandler handler)
Sets the context that will handle "/" paths.


public BranchNode getPathBranch()


public void setPathBranch(BranchNode branch)


public void nodeInstalled(NodeLocation location)
Description copied from interface: LocatableNode
Register the Seedling address at which this node has been installed. This is called immediately after the node has been installed into the tree.

Note: This is not called setNodeLocation because the location is not intended as a writable property.

Specified by:
nodeInstalled in interface LocatableNode
location - is this node's new location. It must not be null.


public final NodeLocation getNodeLocation()
Description copied from interface: LocatableNode
Returns the location of this node. The NodeLocation can be used to access the node's name, parent branch, and path.

Specified by:
getNodeLocation in interface LocatableNode
this node's location, or null if the node has not been installed into a Seedling.


public void startService()
                  throws Exception
Description copied from interface: ServiceNode
Starts a Seedling service. This is called by the Seedling runtime after the node has been installed and all properties have been set to their configured values. Any exceptions thrown by an implementation of this method are handled by the Seedling. Instances of RuntimeException are propagated to the application, but any other kind of exception is wrapped in a ServiceException and rethrown.

Specified by:
startService in interface ServiceNode


public void stopService()
Description copied from interface: ServiceNode
Stops a Seedling service. This is called by the Seedling runtime as the node is uninstalled, either explicitly or by the Seedling itself being stopped.

Implementations of this method must not do anything that may change the state of the parent Seedling. In particular, it cannot call any overload of the following methods: BranchNode.getNode(java.lang.String), BranchNode.getChild(java.lang.String), GrowingBranch.installChild(java.lang.String, java.lang.Object), GrowingBranch.uninstallChild(java.lang.String).

Furthermore, this method may be called from within a JVM shutdown hook, which implies that it must work promptly and carefully.

Specified by:
stopService in interface ServiceNode
See Also:

Copyright © 2001–2012 Todd V. Jonker. All Rights Reserved.