Class WAR
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.container.spi.deployable.AbstractDeployable
-
- org.codehaus.cargo.container.deployable.WAR
-
- All Implemented Interfaces:
Deployable
,Loggable
- Direct Known Subclasses:
GeronimoWAR
,JBossWAR
,TomcatWAR
public class WAR extends AbstractDeployable
Wraps a WAR file that will be deployed in the container. The root context for this WAR is taken from the name of the WAR file (without the extension).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getBaseFilename()
Similar togetFilename()
, without the.war
extension.String
getContext()
String[]
getExtraClasspath()
Gets additional classpath entries for the web application that usually reside outside of the WAR file to facilitate rapid development without fully assembling the WAR file.String
getFilename()
Deployable file name, taking into account theDeployable.getName()
, including any deployable-specific aspects of it, and the escaping in order to avoid unwanted file system actions (for example, ensuring the file name contains no slashes).String
getName()
Returns the name of this deployable.DeployableType
getType()
void
setContext(String context)
void
setExtraClasspath(String[] classpath)
Sets additional classpath entries for the web application that usually reside outside of the WAR file to facilitate rapid development without fully assembling the WAR file.-
Methods inherited from class org.codehaus.cargo.container.spi.deployable.AbstractDeployable
equals, getFile, getFileHandler, getVersion, hashCode, isExpanded, setFileHandler, setLogger, setVersion, toString
-
Methods inherited from class org.codehaus.cargo.util.log.LoggedObject
getLogger
-
-
-
-
Constructor Detail
-
WAR
public WAR(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
-
setContext
public void setContext(String context)
- Parameters:
context
- the context name to use when deploying this WAR. If not specified by the user, then the default context name is computed from the name of WAR itself (without the file extension).
-
getContext
public String getContext()
- Returns:
- the context name, either the computed name derived from the WAR file name or the name defined by the user. Note that this method doesn't return any leading "/" before the context name.
-
getType
public DeployableType getType()
- Returns:
- the deployable's type (war, ear, etc)
-
setExtraClasspath
public void setExtraClasspath(String[] classpath)
Sets additional classpath entries for the web application that usually reside outside of the WAR file to facilitate rapid development without fully assembling the WAR file. In general, this feature is meant for use with exploded WARs and as such is usually not supported for non-expanded WARs. If this method is use with tomcat container, the configuration must set TomcatPropertySet#COPY_WARS to false- Parameters:
classpath
- The additional classpath entries for the web application, may benull
.
-
getExtraClasspath
public String[] getExtraClasspath()
Gets additional classpath entries for the web application that usually reside outside of the WAR file to facilitate rapid development without fully assembling the WAR file.- Returns:
- The additional classpath entries for the web application, never
null
.
-
getName
public String getName()
Returns the name of this deployable. For WAR file it is its context.- Specified by:
getName
in interfaceDeployable
- Overrides:
getName
in classAbstractDeployable
- Returns:
- the name of this deployable
-
getBaseFilename
public String getBaseFilename()
Similar togetFilename()
, without the.war
extension.- Returns:
- The file or directory name for this WAR, taking into account the context.
-
getFilename
public String getFilename()
Deployable file name, taking into account theDeployable.getName()
, including any deployable-specific aspects of it, and the escaping in order to avoid unwanted file system actions (for example, ensuring the file name contains no slashes).
Default value is the Deployable file name.
Value is calculated based on the WAR context and whether it is expanded or not.- Specified by:
getFilename
in interfaceDeployable
- Overrides:
getFilename
in classAbstractDeployable
- Returns:
- The file or directory name for this deployable.
-
-