[jboss-cvs] JBossAS SVN: r67602 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Nov 29 08:01:07 EST 2007
Author: remy.maucherat at jboss.com
Date: 2007-11-29 08:01:07 -0500 (Thu, 29 Nov 2007)
New Revision: 67602
Modified:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
Log:
- Replace with VFS friendly code.
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java 2007-11-29 11:00:10 UTC (rev 67601)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java 2007-11-29 13:01:07 UTC (rev 67602)
@@ -191,7 +191,7 @@
try
{
// TODO: this should be input metadata
- ctxConfig = findConfig(url);
+ ctxConfig = findConfig(webApp, url);
}
catch (IOException e)
{
@@ -228,6 +228,7 @@
}
context.setDelegate(webApp.getJava2ClassLoadingCompliance());
+ // Javac compatibility whenever possible
String[] jspCP = getCompileClasspath(loader);
StringBuffer classpath = new StringBuffer();
for (int u = 0; u < jspCP.length; u++)
@@ -266,7 +267,6 @@
classpath.append(File.pathSeparator);
classpath.append(repository);
}
-
context.setCompilerClasspath(classpath.toString());
// Set the session cookies flag according to metadata
@@ -677,7 +677,7 @@
return hosts.iterator();
}
- private String findConfig(URL warURL) throws IOException
+ protected String findConfig(WebApplication webApp, URL warURL) throws IOException
{
String result = null;
// See if the warUrl is a dir or a file
@@ -686,27 +686,40 @@
{
File webDD = new File(warFile, CONTEXT_CONFIG_FILE);
if (webDD.exists() == true)
+ {
result = webDD.getAbsolutePath();
+ }
}
else
{
- ZipFile zipFile = new ZipFile(warFile);
- ZipEntry entry = zipFile.getEntry(CONTEXT_CONFIG_FILE);
- if (entry != null)
+ VirtualFile file = webApp.getDeploymentUnit().getFile(CONTEXT_CONFIG_FILE);
+ if (file != 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)
+ // Copy the file to the temp folder
+ InputStream is = file.openStream();
+ FileOutputStream fos = null;
+ try
{
- fos.write(buffer, 0, bytes);
+ byte[] buffer = new byte[512];
+ int bytes;
+ // FIXME: use JBoss'temp folder instead
+ File tempFile = File.createTempFile("context-", ".xml");
+ fos = new FileOutputStream(tempFile);
+ while ((bytes = is.read(buffer)) > 0)
+ {
+ fos.write(buffer, 0, bytes);
+ }
+ result = tempFile.getAbsolutePath();
}
- zipIS.close();
- fos.close();
+ finally
+ {
+ is.close();
+ if (fos != null)
+ {
+ fos.close();
+ }
+ }
}
- zipFile.close();
}
return result;
}
More information about the jboss-cvs-commits
mailing list