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.
  • Constructor Details

    • AbstractBaseEmbeddedJetty

      protected AbstractBaseEmbeddedJetty(CONFIGURATION configuration)
      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 class AbstractEmbeddedServer<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 class AbstractEmbeddedServer<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 class AbstractEmbeddedServer<org.eclipse.jetty.server.Server,CONFIGURATION extends com.github.mjeanroy.junit.servers.jetty.AbstractEmbeddedJettyConfiguration>
    • getScheme

      public String getScheme()
      Description copied from interface: EmbeddedServer
      Get the protocol scheme ("http", "https").
      Specified by:
      getScheme in interface EmbeddedServer<CONTEXT extends org.eclipse.jetty.server.handler.ContextHandler>
      Overrides:
      getScheme in class AbstractEmbeddedServer<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 class AbstractEmbeddedServer<org.eclipse.jetty.server.Server,CONFIGURATION extends com.github.mjeanroy.junit.servers.jetty.AbstractEmbeddedJettyConfiguration>
      Returns:
      The port.
    • getWebAppContext

      protected final CONTEXT getWebAppContext()
      Get Jetty WebAppContext.
      Returns:
      WebAppContext, may be null if Jetty has not been started yet.
    • newWebAppContext

      protected abstract CONTEXT newWebAppContext()
      Initialize new instance of Jetty WebAppContext.
      Returns:
      New WebAppContext instance.
    • containerJarPatternPropertyName

      protected abstract String containerJarPatternPropertyName()
      Attribute name for the container JAR pattern configuration flag.
      Returns:
      Attribute name.
    • webInfJarPatternPropertyName

      protected abstract String webInfJarPatternPropertyName()
      Attribute name for the WebInf pattern configuration flag.
      Returns:
      Attribute name.
    • setOverrideDescriptor

      protected abstract void setOverrideDescriptor(CONTEXT context, String overrideDescriptor)
      Set WebAppContext overrideDescriptor value.
      Parameters:
      context - Jetty WebAppContext.
      overrideDescriptor - The overrideDescriptor value.
    • configure

      protected abstract void configure(CONTEXT context)
      Initialize Jetty WebAppContext configuration classes.
      Parameters:
      context - Jetty WebAppContext.
    • setParentLoaderPriority

      protected abstract void setParentLoaderPriority(CONTEXT context, boolean parentLoaderPriority)
      Set WebAppContext parentLoaderPriority value.
      Parameters:
      context - Jetty WebAppContext.
      parentLoaderPriority - The parentLoaderPriority value.
    • setWar

      protected abstract void setWar(CONTEXT context, org.eclipse.jetty.util.resource.Resource war)
      Set WebAppContext war value.
      Parameters:
      context - Jetty WebAppContext.
      war - The war 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

      protected abstract void setAttribute(CONTEXT context, String name, String value)
      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 Jetty Resource 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 Jetty Resource for given WebAppContext.
      Parameters:
      ctx - Jetty WebAppContext.
      resource - The resource URI.
      Returns:
      Create Resource.
      Throws:
      IOException - In case the resource cannot be created.
    • setInitParameter

      protected abstract void setInitParameter(CONTEXT ctx, String name, Object value)
      Set WebAppContext initialization parameter value.
      Parameters:
      ctx - Jetty WebAppContext.
      name - Parameter name.
      value - Parameter value.