ExpandWar (Apache Tomcat 10.1.54 API Documentation)
Description: declaration: package: org.apache.catalina.startup, class: ExpandWar

# Class ExpandWar

java.lang.Object
org.apache.catalina.startup.ExpandWar

public class ExpandWar extends Object
Expand out a WAR in a Host's appBase.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final StringManager`
  `sm`
  The string resources for this package.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ExpandWar()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `copy(File src, File dest)`
  Copy the specified file or directory to the destination.
  `static boolean`
  `delete(File dir)`
  Delete the specified directory, including all of its contents and subdirectories recursively.
  `static boolean`
  `delete(File dir, boolean logFailure)`
  Delete the specified directory, including all of its contents and subdirectories recursively.
  `static boolean`
  `deleteDir(File dir)`
  Delete the specified directory, including all of its contents and subdirectories recursively.
  `static boolean`
  `deleteDir(File dir, boolean logFailure)`
  Delete the specified directory, including all of its contents and subdirectories recursively.
  `static String`
  `expand(Host host, URL war, String pathname)`
  Expand the WAR file found at the specified URL into an unpacked directory structure.
  `static void`
  `validate(Host host, URL war, String pathname)`
  Validate the WAR file found at the specified URL.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### sm

    protected static final StringManager sm
    The string resources for this package.

- ## Constructor Details

  - ### ExpandWar

    public ExpandWar()

- ## Method Details

  - ### expand

    public static String expand(Host host, URL war, String pathname) throws IOException
    Expand the WAR file found at the specified URL into an unpacked directory structure.
    Parameters:
      `host` - Host war is being installed for
      `war` - URL of the web application archive to be expanded (must start with "jar:")
      `pathname` - Context path name for web application
    Returns:
      The absolute path to the expanded directory for the given WAR
    Throws:
      `IllegalArgumentException` - if this is not a "jar:" URL or if the WAR file is invalid
      `IOException` - if an input/output error was encountered during expansion

  - ### validate

    public static void validate(Host host, URL war, String pathname) throws IOException
    Validate the WAR file found at the specified URL.
    Parameters:
      `host` - Host war is being installed for
      `war` - URL of the web application archive to be validated (must start with "jar:")
      `pathname` - Context path name for web application
    Throws:
      `IllegalArgumentException` - if this is not a "jar:" URL or if the WAR file is invalid
      `IOException` - if an input/output error was encountered during validation

  - ### copy

    public static boolean copy(File src, File dest)
    Copy the specified file or directory to the destination.
    Parameters:
      `src` - File object representing the source
      `dest` - File object representing the destination
    Returns:
      `true` if the copy was successful

  - ### delete

    public static boolean delete(File dir)
    Delete the specified directory, including all of its contents and subdirectories recursively. Any failure will be logged.
    Parameters:
      `dir` - File object representing the directory to be deleted
    Returns:
      `true` if the deletion was successful

  - ### delete

    public static boolean delete(File dir, boolean logFailure)
    Delete the specified directory, including all of its contents and subdirectories recursively.
    Parameters:
      `dir` - File object representing the directory to be deleted
      `logFailure` - `true` if failure to delete the resource should be logged
    Returns:
      `true` if the deletion was successful

  - ### deleteDir

    public static boolean deleteDir(File dir)
    Delete the specified directory, including all of its contents and subdirectories recursively. Any failure will be logged.
    Parameters:
      `dir` - File object representing the directory to be deleted
    Returns:
      `true` if the deletion was successful

  - ### deleteDir

    public static boolean deleteDir(File dir, boolean logFailure)
    Delete the specified directory, including all of its contents and subdirectories recursively.
    Parameters:
      `dir` - File object representing the directory to be deleted
      `logFailure` - `true` if failure to delete the resource should be logged
    Returns:
      `true` if the deletion was successful