Class JettyWebAppContext<T>
- java.lang.Object
-
- org.codehaus.cargo.deployer.jetty.JettyWebAppContext<T>
-
- Type Parameters:
T- Jetty WebAppContext type
- All Implemented Interfaces:
JettyDeployer.Context
public abstract class JettyWebAppContext<T> extends Object implements JettyDeployer.Context
Common Jetty context operations used by the Cargo Jetty deployer.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJettyWebAppContext(T currentContext)Creates a context adapter.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddeploy(String contextPath, File warFile)Deploys a WAR at the specified context path.protected abstract voiddeployWebApp(String contextPath, File warFile, org.eclipse.jetty.server.handler.ContextHandlerCollection contextCollection)Creates and starts a WebAppContext.ObjectgetContextHandler(String contextPath)Finds a deployed context by its context path.protected abstract StringgetContextPath(org.eclipse.jetty.server.Handler handler)Returns the context path of a WebAppContext.protected TgetCurrentContext()Returns the current WebAppContext.protected abstract org.eclipse.jetty.server.ServergetServer()Returns the Jetty server.protected abstract booleanisWebAppContext(org.eclipse.jetty.server.Handler handler)Returns whether a handler is a WebAppContext.Stringundeploy(Object contextHandler)Stops and removes a deployed context.protected abstract StringundeployWebApp(Object contextHandler, org.eclipse.jetty.server.handler.ContextHandlerCollection contextCollection)Stops and removes a WebAppContext.
-
-
-
Constructor Detail
-
JettyWebAppContext
protected JettyWebAppContext(T currentContext)
Creates a context adapter.- Parameters:
currentContext- current Jetty WebAppContext
-
-
Method Detail
-
getCurrentContext
protected T getCurrentContext()
Returns the current WebAppContext.- Returns:
- current WebAppContext
-
getServer
protected abstract org.eclipse.jetty.server.Server getServer()
Returns the Jetty server.- Returns:
- Jetty server
-
isWebAppContext
protected abstract boolean isWebAppContext(org.eclipse.jetty.server.Handler handler)
Returns whether a handler is a WebAppContext.- Parameters:
handler- Jetty handler- Returns:
trueif the handler is a WebAppContext
-
getContextPath
protected abstract String getContextPath(org.eclipse.jetty.server.Handler handler)
Returns the context path of a WebAppContext.- Parameters:
handler- WebAppContext handler- Returns:
- context path
-
deployWebApp
protected abstract void deployWebApp(String contextPath, File warFile, org.eclipse.jetty.server.handler.ContextHandlerCollection contextCollection) throws Exception
Creates and starts a WebAppContext.- Parameters:
contextPath- context pathwarFile- WAR filecontextCollection- context handler collection- Throws:
Exception- if deployment fails
-
undeployWebApp
protected abstract String undeployWebApp(Object contextHandler, org.eclipse.jetty.server.handler.ContextHandlerCollection contextCollection) throws Exception
Stops and removes a WebAppContext.- Parameters:
contextHandler- context handlercontextCollection- context handler collection- Returns:
- WAR location
- Throws:
Exception- if undeployment fails
-
getContextHandler
public Object getContextHandler(String contextPath)
Finds a deployed context by its context path.- Specified by:
getContextHandlerin interfaceJettyDeployer.Context- Parameters:
contextPath- context path- Returns:
- context handler, or
nullif none exists
-
deploy
public void deploy(String contextPath, File warFile) throws Exception
Deploys a WAR at the specified context path.- Specified by:
deployin interfaceJettyDeployer.Context- Parameters:
contextPath- context pathwarFile- WAR file- Throws:
Exception- if deployment fails
-
-