Class AbstractBaseEmbeddedJetty<CONTEXT extends org.eclipse.jetty.server.handler.ContextHandler,CONFIGURATION extends com.github.mjeanroy.junit.servers.jetty.AbstractEmbeddedJettyConfiguration>
java.lang.Object
com.github.mjeanroy.junit.servers.servers.AbstractEmbeddedServer<org.eclipse.jetty.server.Server,CONFIGURATION>
com.github.mjeanroy.junit.servers.jetty.AbstractBaseEmbeddedJetty<CONTEXT,CONFIGURATION>
- Type Parameters:
CONTEXT
- The jetty WebAppContext implementation.CONFIGURATION
- The jetty configuration implementation.
- All Implemented Interfaces:
EmbeddedServer<CONFIGURATION>
- Direct Known Subclasses:
AbstractEmbeddedJetty
public abstract class AbstractBaseEmbeddedJetty<CONTEXT extends org.eclipse.jetty.server.handler.ContextHandler,CONFIGURATION extends com.github.mjeanroy.junit.servers.jetty.AbstractEmbeddedJettyConfiguration>
extends AbstractEmbeddedServer<org.eclipse.jetty.server.Server,CONFIGURATION>
Jetty Embedded Server.
-
Field Summary
Fields inherited from class com.github.mjeanroy.junit.servers.servers.AbstractEmbeddedServer
configuration
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractBaseEmbeddedJetty
(CONFIGURATION configuration) Build embedded jetty server. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
addContainerResources
(CONTEXT context, org.eclipse.jetty.util.resource.Resource containerResources) Configure Jetty container resource.protected abstract void
Initialize Jetty WebAppContext configuration classes.protected abstract String
Attribute name for the container JAR pattern configuration flag.protected final int
Get port once server is started.protected final void
doStart()
Start embedded server.protected final void
doStop()
Stop embedded server.final org.eclipse.jetty.server.Server
Get internal server implementation.Get the protocol scheme ("http"
,"https"
).protected final CONTEXT
Get Jetty WebAppContext.protected abstract org.eclipse.jetty.util.resource.Resource
newResource
(CONTEXT ctx, String resource) Create new JettyResource
for given WebAppContext.protected abstract org.eclipse.jetty.util.resource.Resource
newResource
(CONTEXT ctx, URI resource) Create new JettyResource
for given WebAppContext.protected abstract CONTEXT
Initialize new instance of Jetty WebAppContext.protected abstract void
setAttribute
(CONTEXT context, String name, String value) Set WebAppContext attribute value.protected abstract void
setInitParameter
(CONTEXT ctx, String name, Object value) Set WebAppContext initialization parameter value.protected abstract void
setOverrideDescriptor
(CONTEXT context, String overrideDescriptor) Set WebAppContextoverrideDescriptor
value.protected abstract void
setParentLoaderPriority
(CONTEXT context, boolean parentLoaderPriority) Set WebAppContextparentLoaderPriority
value.protected abstract void
Set WebAppContextwar
value.protected abstract String
Attribute name for the WebInf pattern configuration flag.Methods inherited from class com.github.mjeanroy.junit.servers.servers.AbstractEmbeddedServer
getConfiguration, getHost, getPath, getPort, getUrl, isStarted, restart, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.github.mjeanroy.junit.servers.servers.EmbeddedServer
getServletContext
-
Constructor Details
-
AbstractBaseEmbeddedJetty
Build embedded jetty server.- Parameters:
configuration
- Server configuration.
-
-
Method Details
-
getDelegate
public final org.eclipse.jetty.server.Server getDelegate()Description copied from class:AbstractEmbeddedServer
Get internal server implementation. Note that this method should not be used to start or stop internal server, use dedicated method instead. This method can be used to do some custom configuration on original implementation.- Specified by:
getDelegate
in classAbstractEmbeddedServer<org.eclipse.jetty.server.Server,
CONFIGURATION extends com.github.mjeanroy.junit.servers.jetty.AbstractEmbeddedJettyConfiguration> - Returns:
- Original server implementation.
-
doStart
protected final void doStart()Description copied from class:AbstractEmbeddedServer
Start embedded server. Must block until server is fully started.- Specified by:
doStart
in classAbstractEmbeddedServer<org.eclipse.jetty.server.Server,
CONFIGURATION extends com.github.mjeanroy.junit.servers.jetty.AbstractEmbeddedJettyConfiguration>
-
doStop
protected final void doStop()Description copied from class:AbstractEmbeddedServer
Stop embedded server. Must block until server is fully stopped.- Specified by:
doStop
in classAbstractEmbeddedServer<org.eclipse.jetty.server.Server,
CONFIGURATION extends com.github.mjeanroy.junit.servers.jetty.AbstractEmbeddedJettyConfiguration>
-
getScheme
Description copied from interface:EmbeddedServer
Get the protocol scheme ("http"
,"https"
).- Specified by:
getScheme
in interfaceEmbeddedServer<CONTEXT extends org.eclipse.jetty.server.handler.ContextHandler>
- Overrides:
getScheme
in classAbstractEmbeddedServer<org.eclipse.jetty.server.Server,
CONFIGURATION extends com.github.mjeanroy.junit.servers.jetty.AbstractEmbeddedJettyConfiguration> - Returns:
- Protocol scheme.
-
doGetPort
protected final int doGetPort()Description copied from class:AbstractEmbeddedServer
Get port once server is started.- Specified by:
doGetPort
in classAbstractEmbeddedServer<org.eclipse.jetty.server.Server,
CONFIGURATION extends com.github.mjeanroy.junit.servers.jetty.AbstractEmbeddedJettyConfiguration> - Returns:
- The port.
-
getWebAppContext
Get Jetty WebAppContext.- Returns:
- WebAppContext, may be
null
if Jetty has not been started yet.
-
newWebAppContext
Initialize new instance of Jetty WebAppContext.- Returns:
- New WebAppContext instance.
-
containerJarPatternPropertyName
Attribute name for the container JAR pattern configuration flag.- Returns:
- Attribute name.
-
webInfJarPatternPropertyName
Attribute name for the WebInf pattern configuration flag.- Returns:
- Attribute name.
-
setOverrideDescriptor
Set WebAppContextoverrideDescriptor
value.- Parameters:
context
- Jetty WebAppContext.overrideDescriptor
- TheoverrideDescriptor
value.
-
configure
Initialize Jetty WebAppContext configuration classes.- Parameters:
context
- Jetty WebAppContext.
-
setParentLoaderPriority
Set WebAppContextparentLoaderPriority
value.- Parameters:
context
- Jetty WebAppContext.parentLoaderPriority
- TheparentLoaderPriority
value.
-
setWar
Set WebAppContextwar
value.- Parameters:
context
- Jetty WebAppContext.war
- Thewar
value.
-
addContainerResources
protected abstract void addContainerResources(CONTEXT context, org.eclipse.jetty.util.resource.Resource containerResources) Configure Jetty container resource.- Parameters:
context
- Jetty WebAppContext.containerResources
- Container resource.
-
setAttribute
Set WebAppContext attribute value.- Parameters:
context
- Jetty WebAppContext.name
- Attribute name.value
- Attribute value.
-
newResource
protected abstract org.eclipse.jetty.util.resource.Resource newResource(CONTEXT ctx, String resource) throws IOException Create new JettyResource
for given WebAppContext.- Parameters:
ctx
- Jetty WebAppContext.resource
- The resource path.- Returns:
- Create
Resource
. - Throws:
IOException
- In case the resource cannot be created.
-
newResource
protected abstract org.eclipse.jetty.util.resource.Resource newResource(CONTEXT ctx, URI resource) throws IOException Create new JettyResource
for given WebAppContext.- Parameters:
ctx
- Jetty WebAppContext.resource
- The resource URI.- Returns:
- Create
Resource
. - Throws:
IOException
- In case the resource cannot be created.
-
setInitParameter
Set WebAppContext initialization parameter value.- Parameters:
ctx
- Jetty WebAppContext.name
- Parameter name.value
- Parameter value.
-