Class TomcatWAR

  • All Implemented Interfaces:
    Deployable, Loggable

    public class TomcatWAR
    extends WAR
    Extension that supports custom Tomcat context.xml files located in the META-INF/ directory of your WAR. For example, this allows returning the right web context even if it has been defined in the context.xml file.
    • Constructor Detail

      • TomcatWAR

        public TomcatWAR​(String war)
        Parameters:
        war - the location of the WAR being wrapped. This must point to either a WAR file or an expanded WAR directory.
    • Method Detail

      • getContext

        public String getContext()
        Overrides:
        getContext in class WAR
        Returns:
        the context defined in context.xml if any. If there is no context.xml or if it doesn't define any root context, then return WAR.getContext().
      • parseTomcatContextXml

        public String parseTomcatContextXml()
        Returns:
        the context from Tomcat's context.xml if it is defined or null otherwise.
      • containsContextFile

        public boolean containsContextFile()
        Returns:
        true if the WAR contains a META-INF/context.xml file