Top Description Fields Constructors Methods
org.apache.catalina.startup

public Class ExpandWar

extends Object
Class Inheritance
Imports
java.io.BufferedOutputStream, .EOFException, .File, .FileInputStream, .FileOutputStream, .IOException, .InputStream, java.net.JarURLConnection, .URL, .URLConnection, java.nio.channels.FileChannel, java.nio.file.Path, java.util.Enumeration, java.util.jar.JarEntry, .JarFile, java.util.zip.ZipException, org.apache.catalina.Host, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.util.res.StringManager

Expand out a WAR in a Host's appBase.
Authors
Craig R. McClanahan, Remy Maucherat, Glenn L. Nielsen

Field Summary

Modifier and TypeField and Description
private static final Log
protected static final StringManager
sm

The string resources for this package.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if the copy was successful
copy
(File
File object representing the source
src
,
File
File object representing the destination
dest
)

Copy the specified file or directory to the destination.

public static boolean

Returns:

true if the deletion was successful
delete
(File
File object representing the directory to be deleted
dir
)

Delete the specified directory, including all of its contents and sub-directories recursively.

public static boolean

Returns:

true if the deletion was successful
delete
(File
File object representing the directory to be deleted
dir
,
boolean
true if failure to delete the resource should be logged
logFailure
)

Delete the specified directory, including all of its contents and sub-directories recursively.

public static boolean

Returns:

true if the deletion was successful
deleteDir
(File
File object representing the directory to be deleted
dir
)

Delete the specified directory, including all of its contents and sub-directories recursively.

public static boolean

Returns:

true if the deletion was successful
deleteDir
(File
File object representing the directory to be deleted
dir
,
boolean
true if failure to delete the resource should be logged
logFailure
)

Delete the specified directory, including all of its contents and sub-directories recursively.

public static String

Returns:

The absolute path to the expanded directory for the given WAR
expand
(Host
Host war is being installed for
host
,
URL
URL of the web application archive to be expanded (must start with "jar:")
war
,
String
Context path name for web application
pathname
)

Expand the WAR file found at the specified URL into an unpacked directory structure.

private static void
expand(InputStream
InputStream to be copied
input
,
File
The file to be created
file
)

Expand the specified input stream into the specified file.

public static void
validate(Host
Host war is being installed for
host
,
URL
URL of the web application archive to be validated (must start with "jar:")
war
,
String
Context path name for web application
pathname
)

Validate the WAR file found at the specified URL.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

logback to summary
private static final Log log
smback to summary
protected static final StringManager sm

The string resources for this package.

Constructor Detail

ExpandWarback to summary
public ExpandWar()

Method Detail

copyback to summary
public static boolean copy(File src, File dest)

Copy the specified file or directory to the destination.

Parameters
src:File

File object representing the source

dest:File

File object representing the destination

Returns:boolean

true if the copy was successful

deleteback to summary
public static boolean delete(File dir)

Delete the specified directory, including all of its contents and sub-directories recursively. Any failure will be logged.

Parameters
dir:File

File object representing the directory to be deleted

Returns:boolean

true if the deletion was successful

deleteback to summary
public static boolean delete(File dir, boolean logFailure)

Delete the specified directory, including all of its contents and sub-directories recursively.

Parameters
dir:File

File object representing the directory to be deleted

logFailure:boolean

true if failure to delete the resource should be logged

Returns:boolean

true if the deletion was successful

deleteDirback to summary
public static boolean deleteDir(File dir)

Delete the specified directory, including all of its contents and sub-directories recursively. Any failure will be logged.

Parameters
dir:File

File object representing the directory to be deleted

Returns:boolean

true if the deletion was successful

deleteDirback to summary
public static boolean deleteDir(File dir, boolean logFailure)

Delete the specified directory, including all of its contents and sub-directories recursively.

Parameters
dir:File

File object representing the directory to be deleted

logFailure:boolean

true if failure to delete the resource should be logged

Returns:boolean

true if the deletion was successful

expandback to summary
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

Host war is being installed for

war:URL

URL of the web application archive to be expanded (must start with "jar:")

pathname:String

Context path name for web application

Returns:String

The absolute path to the expanded directory for the given WAR

Exceptions
IOException:
if an input/output error was encountered during expansion
IllegalArgumentException:
if this is not a "jar:" URL or if the WAR file is invalid
expandback to summary
private static void expand(InputStream input, File file) throws IOException

Expand the specified input stream into the specified file.

Parameters
input:InputStream

InputStream to be copied

file:File

The file to be created

Exceptions
IOException:
if an input/output error occurs
validateback to summary
public static void validate(Host host, URL war, String pathname) throws IOException

Validate the WAR file found at the specified URL.

Parameters
host:Host

Host war is being installed for

war:URL

URL of the web application archive to be validated (must start with "jar:")

pathname:String

Context path name for web application

Exceptions
IOException:
if an input/output error was encountered during validation
IllegalArgumentException:
if this is not a "jar:" URL or if the WAR file is invalid