Package org.apache.catalina.util
Class ContextName
java.lang.Object
org.apache.catalina.util.ContextName
Utility class to manage context names so there is one place where the conversions between baseName, path and version
take place.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionContextName(String name, boolean stripFileExtension) Creates an instance from a context name, display name, base name, directory name, WAR name or context.xml name.ContextName(String path, String version) Construct an instance from a path and version. -
Method Summary
Modifier and TypeMethodDescriptionstatic ContextNameextractFromPath(String path) Extract the final component of the given path which is assumed to be a base name and generate aContextNamefrom that base name.Returns the base name of this context.Returns the display name of this context.getName()Returns the name of this context.getPath()Returns the path of this context.Returns the version of this context.booleanChecks if the path for this instance is valid.toString()
-
Field Details
-
ROOT_NAME
The name used for the root context.- See Also:
-
-
Constructor Details
-
ContextName
Creates an instance from a context name, display name, base name, directory name, WAR name or context.xml name.- Parameters:
name- The name to use as the basis for this objectstripFileExtension- If a .war or .xml file extension is present at the end of the provided name should it be removed?
-
ContextName
Construct an instance from a path and version.- Parameters:
path- Context path to useversion- Context version to use
-
-
Method Details
-
getBaseName
Returns the base name of this context.- Returns:
- the base name
-
getPath
Returns the path of this context.- Returns:
- the context path
-
getVersion
Returns the version of this context.- Returns:
- the context version
-
getName
Returns the name of this context.- Returns:
- the context name
-
getDisplayName
Returns the display name of this context.- Returns:
- the display name
-
toString
-
isPathValid
public boolean isPathValid()Checks if the path for this instance is valid.- Returns:
trueif the path given/calculated for this instance is valid, otherwisefalse
-
extractFromPath
Extract the final component of the given path which is assumed to be a base name and generate aContextNamefrom that base name.- Parameters:
path- The path that ends in a base name- Returns:
- the
ContextNamegenerated from the given base name
-