|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jetty.util.component.AbstractLifeCycle org.eclipse.jetty.server.handler.AbstractHandler org.eclipse.jetty.server.handler.AbstractHandlerContainer org.eclipse.jetty.server.handler.HandlerWrapper org.eclipse.jetty.server.handler.ScopedHandler org.eclipse.jetty.server.handler.ContextHandler org.eclipse.jetty.servlet.ServletContextHandler org.eclipse.jetty.webapp.WebAppContext
public class WebAppContext
Web Application Context Handler.
The WebAppContext handler is an extension of ContextHandler that
coordinates the construction and configuration of nested handlers:
ConstraintSecurityHandler
, SessionHandler
and ServletHandler
.
The handlers are configured by pluggable configuration classes, with
the default being org.eclipse.jetty.server.server.webapp.WebXmlConfiguration
and
org.eclipse.jetty.server.server.webapp.JettyWebXmlConfiguration
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.jetty.servlet.ServletContextHandler |
---|
ServletContextHandler.Context |
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
LifeCycle.Listener |
Field Summary | |
---|---|
static String |
ERROR_PAGE
|
static String |
TEMPDIR
|
static String |
WEB_DEFAULTS_XML
|
Fields inherited from class org.eclipse.jetty.servlet.ServletContextHandler |
---|
_defaultSecurityHandlerClass, _options, _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 |
Fields inherited from interface org.eclipse.jetty.server.handler.CompleteHandler |
---|
COMPLETE_HANDLER_ATTR |
Constructor Summary | |
---|---|
WebAppContext()
|
|
WebAppContext(HandlerContainer parent,
String webApp,
String contextPath)
|
|
WebAppContext(SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler)
|
|
WebAppContext(String webApp,
String contextPath)
|
Method Summary | |
---|---|
void |
addEventListener(EventListener listener)
Add EventListener Conveniance method that calls setEventListeners(EventListener[]) |
protected void |
doStart()
|
protected void |
doStop()
|
void |
dumpUrl()
|
String[] |
getConfigurationClasses()
|
Configuration[] |
getConfigurations()
|
static ContextHandler |
getCurrentWebAppContext()
|
String |
getDefaultsDescriptor()
The default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xml |
String |
getDescriptor()
|
String |
getExtraClasspath()
|
String |
getOverrideDescriptor()
The override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xml |
PermissionCollection |
getPermissions()
|
Resource |
getResource(String uriInContext)
|
String |
getResourceAlias(String alias)
|
Map |
getResourceAliases()
|
String[] |
getServerClasses()
|
String[] |
getSystemClasses()
|
File |
getTempDirectory()
|
Throwable |
getUnavailableException()
Get an exception that caused the webapp to be unavailable |
String |
getWar()
|
Resource |
getWebInf()
|
boolean |
isConfigurationDiscovered()
Is the context Automatically configured. |
boolean |
isCopyWebDir()
|
boolean |
isDistributable()
|
boolean |
isExtractWAR()
|
boolean |
isLogUrlOnStart()
|
boolean |
isParentLoaderPriority()
|
protected boolean |
isProtectedTarget(String target)
Check the target. |
boolean |
isServerClass(String name)
|
boolean |
isSystemClass(String name)
|
protected void |
loadConfigurations()
|
String |
removeResourceAlias(String alias)
|
void |
setClassLoader(ClassLoader classLoader)
|
void |
setConfigurationClasses(String[] configurations)
|
void |
setConfigurationDiscovered(boolean discovered)
Set the configuration discovery mode. |
void |
setConfigurations(Configuration[] configurations)
|
void |
setCopyWebDir(boolean copy)
|
void |
setDefaultsDescriptor(String defaultsDescriptor)
The default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xml |
void |
setDescriptor(String descriptor)
|
void |
setDisplayName(String servletContextName)
|
void |
setDistributable(boolean distributable)
|
void |
setEventListeners(EventListener[] eventListeners)
Set the context event listeners. |
void |
setExtraClasspath(String extraClasspath)
|
void |
setExtractWAR(boolean extractWAR)
|
void |
setLogUrlOnStart(boolean logOnStart)
Sets whether or not the web app name and URL is logged on startup |
void |
setOverrideDescriptor(String overrideDescriptor)
The override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xml |
void |
setParentLoaderPriority(boolean java2compliant)
|
void |
setPermissions(PermissionCollection permissions)
|
void |
setResourceAlias(String alias,
String uri)
Set Resource Alias. |
void |
setResourceAliases(Map map)
|
void |
setServerClasses(String[] serverClasses)
Set the server classes patterns. |
void |
setSystemClasses(String[] systemClasses)
Set the system classes patterns. |
void |
setTempDirectory(File dir)
Set temporary directory for context. |
void |
setWar(String war)
|
protected void |
startContext()
Finish constructing handlers and link them together. |
String |
toString()
|
Methods inherited from class org.eclipse.jetty.servlet.ServletContextHandler |
---|
addFilter, addFilter, addFilter, addServlet, addServlet, addServlet, getDefaultSecurityHandlerClass, getSecurityHandler, getServletHandler, getSessionHandler, newSecurityHandler, newServletHandler, newSessionHandler, setDefaultSecurityHandlerClass, setSecurityHandler, setServletHandler, setSessionHandler |
Methods inherited from class org.eclipse.jetty.server.handler.ScopedHandler |
---|
handle, nextHandle, nextScope |
Methods inherited from class org.eclipse.jetty.server.handler.HandlerWrapper |
---|
expandChildren, getHandler, getHandlers, setHandler |
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandlerContainer |
---|
dump, expandHandler, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass |
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler |
---|
destroy, dump, getServer |
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
addLifeCycleListener, 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 |
Field Detail |
---|
public static final String TEMPDIR
public static final String WEB_DEFAULTS_XML
public static final String ERROR_PAGE
Constructor Detail |
---|
public WebAppContext()
public WebAppContext(String webApp, String contextPath)
contextPath
- The context pathwebApp
- The URL or filename of the webapp directory or war file.public WebAppContext(HandlerContainer parent, String webApp, String contextPath)
parent
- The parent HandlerContainer.contextPath
- The context pathwebApp
- The URL or filename of the webapp directory or war file.public WebAppContext(SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler)
Method Detail |
---|
public static ContextHandler getCurrentWebAppContext()
public void setDisplayName(String servletContextName)
setDisplayName
in class ContextHandler
servletContextName
- The servletContextName to set.public Throwable getUnavailableException()
public void setResourceAlias(String alias, String uri)
alias
- uri
- public Map getResourceAliases()
public void setResourceAliases(Map map)
public String getResourceAlias(String alias)
public String removeResourceAlias(String alias)
public void setClassLoader(ClassLoader classLoader)
setClassLoader
in class ContextHandler
classLoader
- The classLoader to set.public Resource getResource(String uriInContext) throws MalformedURLException
getResource
in class ContextHandler
MalformedURLException
public boolean isConfigurationDiscovered()
public void setConfigurationDiscovered(boolean discovered)
servlet3autoConfig
- the servlet3autoConfig to setprotected void doStart() throws Exception
doStart
in class ContextHandler
Exception
HandlerWrapper.doStart()
public void dumpUrl()
protected void doStop() throws Exception
doStop
in class ContextHandler
Exception
public String[] getConfigurationClasses()
public Configuration[] getConfigurations()
public String getDefaultsDescriptor()
public String getOverrideDescriptor()
public PermissionCollection getPermissions()
public String[] getServerClasses()
setServerClasses(String[])
public String[] getSystemClasses()
setSystemClasses(String[])
public boolean isServerClass(String name)
public boolean isSystemClass(String name)
public String getWar()
public Resource getWebInf() throws IOException
IOException
public boolean isDistributable()
public boolean isExtractWAR()
public boolean isCopyWebDir()
public boolean isParentLoaderPriority()
protected void loadConfigurations() throws Exception
Exception
protected boolean isProtectedTarget(String target)
ContextHandler
ScopedHandler.handle(String, Request, HttpServletRequest, HttpServletResponse)
when a
target within a context is determined. If the target is protected, 404 is returned.
The default implementation always returns false.
isProtectedTarget
in class ContextHandler
isProtectedTarget(String)
public String toString()
toString
in class ContextHandler
public void setConfigurationClasses(String[] configurations)
configurations
- The configuration class names. If setConfigurations is not called
these classes are used to create a configurations array.public void setConfigurations(Configuration[] configurations)
configurations
- The configurations to set.public void setDefaultsDescriptor(String defaultsDescriptor)
defaultsDescriptor
- The defaultsDescriptor to set.public void setOverrideDescriptor(String overrideDescriptor)
overrideDescriptor
- The overrideDescritpor to set.public String getDescriptor()
public void setDescriptor(String descriptor)
descriptor
- the web.xml descriptor to use. If set to null, WEB-INF/web.xml is used if it exists.public void setDistributable(boolean distributable)
distributable
- The distributable to set.public void setEventListeners(EventListener[] eventListeners)
ContextHandler
setEventListeners
in class ContextHandler
ServletContextListener
,
ServletContextAttributeListener
,
ServletRequestListener
,
ServletRequestAttributeListener
public void addEventListener(EventListener listener)
setEventListeners(EventListener[])
addEventListener
in class ContextHandler
listener
- ServletContextListener
,
ServletContextAttributeListener
,
ServletRequestListener
,
ServletRequestAttributeListener
public void setExtractWAR(boolean extractWAR)
extractWAR
- True if war files are extractedpublic void setCopyWebDir(boolean copy)
copy
- True if the webdir is copied (to allow hot replacement of jars)public void setParentLoaderPriority(boolean java2compliant)
java2compliant
- The java2compliant to set.public void setPermissions(PermissionCollection permissions)
permissions
- The permissions to set.public void setServerClasses(String[] serverClasses)
Server classes/packages are classes used to implement the server and are hidden from the context. If the context needs to load these classes, it must have its own copy of them in WEB-INF/lib or WEB-INF/classes. A class pattern is a string of one of the forms:
serverClasses
- The serverClasses to set.public void setSystemClasses(String[] systemClasses)
System classes/packages are classes provided by the JVM and that
cannot be replaced by classes of the same name from WEB-INF,
regardless of the value of setParentLoaderPriority(boolean)
.
A class pattern is a string of one of the forms:
systemClasses
- The systemClasses to set.public void setTempDirectory(File dir)
dir
- Writable temporary directory.public File getTempDirectory()
public void setWar(String war)
war
- The war to set as a file name or URLpublic String getExtraClasspath()
public void setExtraClasspath(String extraClasspath)
extraClasspath
- Comma or semicolon separated path of filenames or URLs
pointing to directories or jar files. Directories should end
with '/'.public boolean isLogUrlOnStart()
public void setLogUrlOnStart(boolean logOnStart)
logOnStart
- whether or not the log message is createdprotected void startContext() throws Exception
ServletContextHandler
startContext
in class ServletContextHandler
Exception
ContextHandler.startContext()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |