Class Jetty7xEmbeddedLocalContainer
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.container.spi.AbstractContainer
-
- org.codehaus.cargo.container.spi.AbstractLocalContainer
-
- org.codehaus.cargo.container.spi.AbstractEmbeddedLocalContainer
-
- org.codehaus.cargo.container.jetty.internal.AbstractJettyEmbeddedLocalContainer
-
- org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalContainer
-
- org.codehaus.cargo.container.jetty.Jetty7xEmbeddedLocalContainer
-
- All Implemented Interfaces:
Container
,EmbeddedLocalContainer
,RunnableContainer
,LocalContainer
,Loggable
- Direct Known Subclasses:
Jetty8xEmbeddedLocalContainer
public class Jetty7xEmbeddedLocalContainer extends Jetty6xEmbeddedLocalContainer
A Jetty 7.x instance running embedded.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ID
Unique container id.-
Fields inherited from class org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalContainer
addHandlerMethod, contextHandlers, defaultRealm, handlerClass, handlers, removeHandlerMethod
-
Fields inherited from class org.codehaus.cargo.container.jetty.internal.AbstractJettyEmbeddedLocalContainer
server
-
-
Constructor Summary
Constructors Constructor Description Jetty7xEmbeddedLocalContainer(LocalConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addJettyHandlers()
Add Jetty handlers.protected void
configureJettyConnectors()
Configure Jetty connectors.Object
createHandler(String contextPath, String war)
Create a WebAppContext for the webapp given as a string.Object
createHandler(Deployable deployable)
Create a WebAppContext for the Deployable.protected void
createServerObject()
Create a Jetty Server Object.String
getId()
void
setDefaultRealm(Object webapp)
If a default realm is available, set it on the given webapp.protected void
setSecurityRealm()
Defines a security realm and adds defined users to it.-
Methods inherited from class org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalContainer
addDeployables, addHandler, doStart, getName, removeHandler, startJetty
-
Methods inherited from class org.codehaus.cargo.container.jetty.internal.AbstractJettyEmbeddedLocalContainer
doStop, getCapability, getServer, getVersion, waitForCompletion
-
Methods inherited from class org.codehaus.cargo.container.spi.AbstractEmbeddedLocalContainer
getClassLoader, getType, setClassLoader, startInternal, stopInternal
-
Methods inherited from class org.codehaus.cargo.container.spi.AbstractLocalContainer
executePostStartTasks, forceStopInternal, getConfiguration, getFileHandler, getOutput, getState, getTimeout, isAppend, restart, setAppend, setConfiguration, setFileHandler, setOutput, setState, setTimeout, start, stop, verify, waitForPortShutdown, waitForStarting
-
Methods inherited from class org.codehaus.cargo.util.log.LoggedObject
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.codehaus.cargo.container.LocalContainer
getConfiguration, getFileHandler, setConfiguration, setFileHandler
-
Methods inherited from interface org.codehaus.cargo.container.internal.RunnableContainer
getOutput, getTimeout, isAppend, restart, setAppend, setOutput, setTimeout, start, stop
-
-
-
-
Field Detail
-
ID
public static final String ID
Unique container id.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Jetty7xEmbeddedLocalContainer
public Jetty7xEmbeddedLocalContainer(LocalConfiguration configuration)
-
-
Method Detail
-
getId
public String getId()
- Specified by:
getId
in interfaceContainer
- Overrides:
getId
in classJetty6xEmbeddedLocalContainer
- Returns:
- the short name of the container. Note: this is not a unique id. It is simply the name in a computer-usable format.
-
setDefaultRealm
public void setDefaultRealm(Object webapp) throws Exception
If a default realm is available, set it on the given webapp.- Overrides:
setDefaultRealm
in classJetty6xEmbeddedLocalContainer
- Parameters:
webapp
- the webapp to set the realm on- Throws:
Exception
- on invokation error
-
configureJettyConnectors
protected void configureJettyConnectors() throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
Configure Jetty connectors.- Overrides:
configureJettyConnectors
in classJetty6xEmbeddedLocalContainer
- Throws:
ClassNotFoundException
- thrown if the connectors could not be configuredInstantiationException
- thrown if the connectors could not be configuredIllegalAccessException
- thrown if the connectors could not be configuredInvocationTargetException
- thrown if the connectors could not be configuredNoSuchMethodException
- thrown if the connectors could not be configured
-
addJettyHandlers
protected void addJettyHandlers() throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
Add Jetty handlers.- Overrides:
addJettyHandlers
in classJetty6xEmbeddedLocalContainer
- Throws:
ClassNotFoundException
- thrown if the handlers could not be addedInstantiationException
- thrown if the handlers could not be addedIllegalAccessException
- thrown if the handlers could not be addedInvocationTargetException
- thrown if the handlers could not be addedNoSuchMethodException
- thrown if the handlers could not be added
-
createHandler
public Object createHandler(Deployable deployable) throws Exception
Create a WebAppContext for the Deployable. NB also force the defaultRealm to be set on it if one is present.- Overrides:
createHandler
in classJetty6xEmbeddedLocalContainer
- Parameters:
deployable
- the cargo webapp to deploy- Returns:
- a jetty webapp
- Throws:
Exception
- on invokation exception
-
createHandler
public Object createHandler(String contextPath, String war) throws Exception
Create a WebAppContext for the webapp given as a string. NB Also force the defaultRealm to be set if one is present.- Overrides:
createHandler
in classJetty6xEmbeddedLocalContainer
- Parameters:
contextPath
- the context path for the webappwar
- the webapp- Returns:
- a jetty webapp
- Throws:
Exception
- on invokation exception
-
setSecurityRealm
protected void setSecurityRealm() throws Exception
Defines a security realm and adds defined users to it. If a user has specified the standard ServletPropertySet.USERS property, then we try and turn these into an in-memory default realm, and then set that realm on all of the webapps. TODO: this is not ideal. We need a way to specify N named realms to the server so that individual webapps can find their appropriate realms by name.- Overrides:
setSecurityRealm
in classJetty6xEmbeddedLocalContainer
- Throws:
Exception
- in case of error
-
createServerObject
protected void createServerObject() throws Exception
Create a Jetty Server Object.- Overrides:
createServerObject
in classJetty6xEmbeddedLocalContainer
- Throws:
Exception
- in case of error
-
-