Details
-
Feature Request
-
Resolution: Obsolete
-
Major
-
None
-
None
-
0
-
0%
Description
The documentation about the context configuration in Tomcat does not work in JbossAS deployments.
I have just spend some time looking at the related code at
http://anonsvn.jboss.org/repos/jbossas/branches/JBPAPP_4_2/tomcat/src/main/org/jboss/web/tomcat/service/TomcatDeployer.java
Here is the code snippet
****************************************************************
private String findConfig(URL warURL) throws IOException
{
String result = null;
// See if the warUrl is a dir or a file
File warFile = new File(warURL.getFile());
if (warURL.getProtocol().equals("file") && warFile.isDirectory() == true)
else
{
ZipFile zipFile = new ZipFile(warFile);
ZipEntry entry = zipFile.getEntry(CONTEXT_CONFIG_FILE);
if (entry != null)
{
InputStream zipIS = zipFile.getInputStream(entry);
byte[] buffer = new byte[512];
int bytes;
result = warFile.getAbsolutePath() + "-context.xml";
FileOutputStream fos = new FileOutputStream(result);
while ((bytes = zipIS.read(buffer)) > 0)
zipIS.close();
fos.close();
}
zipFile.close();
}
return result;
}
****************************************************************
This code needs to be modified in such a way that it uses these configurations
**************************************************************************************
1. in the $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file: the Context element information will be loaded by all webapps of that host
2. in individual files (with a ".xml" extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. The name of the file (less the .xml) extension will be used as the context path. Multi-level context paths may be defined using #, e.g. context#path.xml. The default web application may be defined by using a file called ROOT.xml.
3. if the previous file was not found for this application, in an individual file at /META-INF/context.xml inside the application files
inside a Host element in the main conf/server.xml
**************************************************************************************
The point[3] is already rejected earlier by Scott, here is the related jira
https://jira.jboss.org/jira/browse/JBAS-2290