Class MavenWebAppContext

All Implemented Interfaces:
Handler, HandlerContainer, Attributes, ClassVisibilityChecker, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, Graceful, LifeCycle, WebAppClassLoader.Context

public class MavenWebAppContext extends WebAppContext
MavenWebAppContext Extends the WebAppContext to specialize for the maven environment. We pass in the list of files that should form the classpath for the webapp when executing in the plugin, and any jetty-env.xml file that may have been configured.
  • Constructor Details

  • Method Details

    • setContainerIncludeJarPattern

      public void setContainerIncludeJarPattern(String pattern)
    • getContainerIncludeJarPattern

      public String getContainerIncludeJarPattern()
    • getWebInfIncludeJarPattern

      public String getWebInfIncludeJarPattern()
    • setWebInfIncludeJarPattern

      public void setWebInfIncludeJarPattern(String pattern)
    • getClassPathFiles

      public List<File> getClassPathFiles()
    • setJettyEnvXml

      public void setJettyEnvXml(String jettyEnvXml)
    • getJettyEnvXml

      public String getJettyEnvXml()
    • setClasses

      public void setClasses(File dir)
    • getClasses

      public File getClasses()
    • setWebInfLib

      public void setWebInfLib(List<File> jars)
    • setTestClasses

      public void setTestClasses(File dir)
    • getTestClasses

      public File getTestClasses()
    • setOverlays

      public void setOverlays(List<Overlay> overlays)
      Ordered list of wars to overlay on top of the current project. The list may contain an overlay that represents the current project.
      Parameters:
      overlays - the list of overlays
    • setOriginAttribute

      public void setOriginAttribute(String name)
      Set the name of the attribute that is used in each generated xml element to indicate the source of the xml element (eg annotation, web.xml etc).
      Parameters:
      name - the name of the attribute to use.
    • getOriginAttribute

      public String getOriginAttribute()
      Returns:
      the originAttribute
    • getOverlays

      public List<Overlay> getOverlays()
    • setBaseAppFirst

      public void setBaseAppFirst(boolean value)
    • getBaseAppFirst

      public boolean getBaseAppFirst()
    • setResourceBases

      public void setResourceBases(String[] resourceBases)
      This method is provided as a convenience for jetty maven plugin configuration
      Parameters:
      resourceBases - Array of resources strings to set as a ResourceCollection. Each resource string may be a comma separated list of resources
    • getWebInfLib

      public List<File> getWebInfLib()
    • getWebInfClasses

      public List<File> getWebInfClasses()
    • doStart

      public void doStart() throws Exception
      Description copied from class: ContainerLifeCycle
      Starts the managed lifecycle beans in the order they were added.
      Overrides:
      doStart in class WebAppContext
      Throws:
      AbstractLifeCycle.StopException - If thrown, the lifecycle will immediately be stopped.
      Exception - If there was a problem starting. Will cause a transition to FAILED state
    • newConfigurations

      protected Configurations newConfigurations()
      Overrides:
      newConfigurations in class WebAppContext
    • doStop

      public void doStop() throws Exception
      Description copied from class: ContainerLifeCycle
      Stops the managed lifecycle beans in the reverse order they were added.
      Overrides:
      doStop in class ServletContextHandler
      Throws:
      Exception - If there was a problem stopping. Will cause a transition to FAILED state
    • getResource

      public Resource getResource(String pathInContext) throws MalformedURLException
      Description copied from class: ContextHandler
      Attempt to get a Resource from the Context.
      Overrides:
      getResource in class WebAppContext
      Parameters:
      pathInContext - the path within the base resource to attempt to get
      Returns:
      the resource, or null if not available.
      Throws:
      MalformedURLException - if unable to form a Resource from the provided path
    • getResourcePaths

      public Set<String> getResourcePaths(String path)
      Overrides:
      getResourcePaths in class ContextHandler
    • addPattern

      public String addPattern(String s, String pattern)
    • initCDI

      public void initCDI()
    • setExtraClasspath

      public void setExtraClasspath(String extraClasspath) throws IOException
      Description copied from class: WebAppContext
      Set the Extra ClassPath via delimited String.

      This is a convenience method for WebAppContext.setExtraClasspath(List)

      Overrides:
      setExtraClasspath in class WebAppContext
      Parameters:
      extraClasspath - Comma or semicolon separated path of filenames or URLs pointing to directories or jar files. Directories should end with '/'.
      Throws:
      IOException - if unable to resolve the resources referenced
      See Also: