consciouscode.seedling.jetty
Class SeedlingServletContextHandler

java.lang.Object
  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.handler.ScopedHandler
                          extended by org.eclipse.jetty.server.handler.ContextHandler
                              extended by org.eclipse.jetty.servlet.ServletContextHandler
                                  extended by consciouscode.seedling.jetty.SeedlingServletContextHandler
All Implemented Interfaces:
ServiceNode, org.eclipse.jetty.server.Handler, org.eclipse.jetty.server.HandlerContainer, org.eclipse.jetty.server.Server.Graceful, 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 SeedlingServletContextHandler
extends org.eclipse.jetty.servlet.ServletContextHandler
implements ServiceNode

Extends Jetty's servlet ContextHandler to automatically build path mappings from entries in the Seedling container.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jetty.servlet.ServletContextHandler
org.eclipse.jetty.servlet.ServletContextHandler.Context, org.eclipse.jetty.servlet.ServletContextHandler.Decorator
 
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
 
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener
 
Field Summary
 
Fields inherited from class org.eclipse.jetty.servlet.ServletContextHandler
_decorators, _defaultSecurityHandlerClass, _options, _restrictedContextListeners, _securityHandler, _servletHandler, _sessionHandler, NO_SECURITY, NO_SESSIONS, SECURITY, SESSIONS
 
Fields inherited from class org.eclipse.jetty.server.handler.ContextHandler
_scontext, MANAGED_ATTRIBUTES
 
Fields inherited from class org.eclipse.jetty.server.handler.ScopedHandler
_nextScope, _outerScope
 
Fields inherited from class org.eclipse.jetty.server.handler.HandlerWrapper
_handler
 
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
Constructor Summary
SeedlingServletContextHandler()
           
SeedlingServletContextHandler(org.eclipse.jetty.server.HandlerContainer parent, org.eclipse.jetty.server.session.SessionHandler sessionHandler, org.eclipse.jetty.security.SecurityHandler securityHandler, org.eclipse.jetty.servlet.ServletHandler servletHandler, org.eclipse.jetty.server.handler.ErrorHandler errorHandler)
           
SeedlingServletContextHandler(org.eclipse.jetty.server.HandlerContainer parent, String contextPath)
           
SeedlingServletContextHandler(org.eclipse.jetty.server.HandlerContainer parent, String contextPath, boolean sessions, boolean security)
           
SeedlingServletContextHandler(org.eclipse.jetty.server.HandlerContainer parent, String contextPath, int options)
           
SeedlingServletContextHandler(org.eclipse.jetty.server.HandlerContainer parent, String contextPath, org.eclipse.jetty.server.session.SessionHandler sessionHandler, org.eclipse.jetty.security.SecurityHandler securityHandler, org.eclipse.jetty.servlet.ServletHandler servletHandler, org.eclipse.jetty.server.handler.ErrorHandler errorHandler)
           
SeedlingServletContextHandler(int options)
           
 
Method Summary
 BranchNode getPathBranch()
           
 javax.servlet.Servlet getRootServlet()
          Gets the servlet that will handle "/*" paths.
 org.eclipse.jetty.servlet.ServletHolder getRootServletHolder()
          Gets the servlet holder that will handle "/*" paths.
 void setPathBranch(BranchNode branch)
           
 void setRootServlet(javax.servlet.Servlet servlet)
          Sets the servlet that will handle "/*" paths.
 void setRootServletHolder(org.eclipse.jetty.servlet.ServletHolder servlet)
          Sets the servlet holder that will handle "/*" paths.
 void startService()
          Starts a Seedling service.
 void stopService()
          Stops a Seedling service.
 
Methods inherited from class org.eclipse.jetty.servlet.ServletContextHandler
addDecorator, addFilter, addFilter, addFilter, addFilter, addFilter, addFilter, addServlet, addServlet, addServlet, callContextDestroyed, callContextInitialized, doStop, getDecorators, getDefaultSecurityHandlerClass, getSecurityHandler, getServletHandler, getSessionHandler, newSecurityHandler, newServletHandler, newSessionHandler, setDecorators, setDefaultSecurityHandlerClass, setSecurityHandler, setServletHandler, setSessionHandler, startContext
 
Methods inherited from class org.eclipse.jetty.server.handler.ContextHandler
addEventListener, addLocaleEncoding, checkContext, checkManagedAttribute, clearAttributes, doHandle, doScope, doStart, dump, getAllowNullPathInfo, getAttribute, getAttributeNames, getAttributes, getBaseResource, getClassLoader, getClassPath, getConnectorNames, getContextPath, getCurrentContext, getDisplayName, getErrorHandler, getEventListeners, getInitParameter, getInitParameterNames, getInitParams, getLocaleEncoding, getLocaleEncoding, getLogger, getMaxFormContentSize, getMimeTypes, getResource, getResourceBase, getResourcePaths, getServletContext, getVirtualHosts, getWelcomeFiles, handle, isAliases, isAvailable, isCompactPath, isProtectedTarget, isShutdown, loadClass, newResource, newResource, removeAttribute, setAliases, setAllowNullPathInfo, setAttribute, setAttributes, setAvailable, setBaseResource, setClassLoader, setCompactPath, setConnectorNames, setContextPath, setDisplayName, setErrorHandler, setEventListeners, setInitParameter, setLogger, setManagedAttribute, setMaxFormContentSize, setMimeTypes, setResourceBase, setServer, setShutdown, setVirtualHosts, setWelcomeFiles, toString
 
Methods inherited from class org.eclipse.jetty.server.handler.ScopedHandler
handle, never, nextHandle, nextScope
 
Methods inherited from class org.eclipse.jetty.server.handler.HandlerWrapper
destroy, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, setHandler
 
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
addBean, dump, dump, dump, dump, dumpStdErr, getBean, getBeans, getBeans, removeBean, 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.server.Handler
destroy, getServer, handle
 
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

Constructor Detail

SeedlingServletContextHandler

public SeedlingServletContextHandler()

SeedlingServletContextHandler

public SeedlingServletContextHandler(org.eclipse.jetty.server.HandlerContainer parent,
                                     org.eclipse.jetty.server.session.SessionHandler sessionHandler,
                                     org.eclipse.jetty.security.SecurityHandler securityHandler,
                                     org.eclipse.jetty.servlet.ServletHandler servletHandler,
                                     org.eclipse.jetty.server.handler.ErrorHandler errorHandler)

SeedlingServletContextHandler

public SeedlingServletContextHandler(org.eclipse.jetty.server.HandlerContainer parent,
                                     String contextPath,
                                     boolean sessions,
                                     boolean security)

SeedlingServletContextHandler

public SeedlingServletContextHandler(org.eclipse.jetty.server.HandlerContainer parent,
                                     String contextPath,
                                     int options)

SeedlingServletContextHandler

public SeedlingServletContextHandler(org.eclipse.jetty.server.HandlerContainer parent,
                                     String contextPath,
                                     org.eclipse.jetty.server.session.SessionHandler sessionHandler,
                                     org.eclipse.jetty.security.SecurityHandler securityHandler,
                                     org.eclipse.jetty.servlet.ServletHandler servletHandler,
                                     org.eclipse.jetty.server.handler.ErrorHandler errorHandler)

SeedlingServletContextHandler

public SeedlingServletContextHandler(org.eclipse.jetty.server.HandlerContainer parent,
                                     String contextPath)

SeedlingServletContextHandler

public SeedlingServletContextHandler(int options)
Method Detail

getRootServletHolder

public org.eclipse.jetty.servlet.ServletHolder getRootServletHolder()
Gets the servlet holder that will handle "/*" paths.


setRootServletHolder

public void setRootServletHolder(org.eclipse.jetty.servlet.ServletHolder servlet)
Sets the servlet holder that will handle "/*" paths.

Parameters:
servlet - may be null to disable root paths.

getRootServlet

public javax.servlet.Servlet getRootServlet()
Gets the servlet that will handle "/*" paths. If getRootServletHolder() returns a holder, its servlet will be replaced with this one when the context starts.


setRootServlet

public void setRootServlet(javax.servlet.Servlet servlet)
Sets the servlet that will handle "/*" paths. If getRootServletHolder() returns a holder, its servlet will be replaced with this one when the context starts.

Parameters:
servlet - may be null.

getPathBranch

public BranchNode getPathBranch()

setPathBranch

public void setPathBranch(BranchNode branch)

startService

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
Throws:
Exception

stopService

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:
Runtime.addShutdownHook(java.lang.Thread)


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