User: jules_gosnell
Date: 02/02/15 17:01:59
Modified: jetty/src/main/org/jboss/jetty
JBossWebApplicationContext.java
Log:
try harder to put together a complete classpath for Jasper to compile JSPs
Revision Changes Path
1.21 +21 -90
contrib/jetty/src/main/org/jboss/jetty/JBossWebApplicationContext.java
Index: JBossWebApplicationContext.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/JBossWebApplicationContext.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- JBossWebApplicationContext.java 12 Feb 2002 22:42:28 -0000 1.20
+++ JBossWebApplicationContext.java 16 Feb 2002 01:01:59 -0000 1.21
@@ -5,7 +5,7 @@
* See terms of license at gnu.org.
*/
-// $Id: JBossWebApplicationContext.java,v 1.20 2002/02/12 22:42:28 jules_gosnell
Exp $
+// $Id: JBossWebApplicationContext.java,v 1.21 2002/02/16 01:01:59 jules_gosnell
Exp $
// A Jetty HttpServer with the interface expected by JBoss'
// J2EEDeployer...
@@ -23,6 +23,7 @@
import org.jboss.jetty.security.JBossUserRealm;
import org.jboss.jetty.session.DistributedHttpSessionManager;
import org.jboss.logging.Logger;
+import org.jboss.system.MBeanClassLoader;
import org.jboss.web.AbstractWebContainer.WebDescriptorParser;
import org.jboss.web.WebApplication;
import org.mortbay.http.ContextLoader;
@@ -158,113 +159,43 @@
((org.mortbay.http.ContextLoader)_loader).setJava2Compliant(true);
}
- // copy our superclass' version of this, but ensure that servlet
- // api and jasper jars are appended to it...
+ String _separator=System.getProperty("path.separator");
+ protected String
+ URLArrayToClassPath(URL[] urls, String classpath)
+ {
+ for (int i=urls.length-1; urls!=null && i>-1; i--)
+ {
+ URL url=urls[i];
+ if (url.getProtocol().equals("file"))
+ classpath+=(classpath.length()==0?"":_separator)+url.getPath();
+ else
+ _log.warn("non-file URL encountered in ClassPath URLs");
+ }
+
+ return classpath;
+ }
public String
getFileClassPath()
{
- String separator=System.getProperty("path.separator");
-
String classpath="";
for (ClassLoader cl=getClassLoader();
cl.getParent()!=null;
cl=cl.getParent())
{
if (cl instanceof URLClassLoader)
- {
- URL[] urls=((URLClassLoader)cl).getURLs();
- for (int i=0; urls!=null && i<urls.length; i++)
- {
- URL url=urls[i];
- if (url.getProtocol().equals("file"))
- classpath+=(classpath.length()==0?"":separator)+url.getPath();
- else
- _log.warn("non-file URL encountered in ClassLoader - jsp compilation may
fail");
- }
- }
+ classpath+=URLArrayToClassPath(((URLClassLoader)cl).getURLs(), classpath);
+ else if (cl instanceof MBeanClassLoader)
+ classpath+=URLArrayToClassPath(((MBeanClassLoader)cl).getURLs(), classpath);
else
- {
- _log.warn("non URLClassLoader("+cl+") encountered - jsp compilation may
fail");
- }
- }
-
- // we should report non-file urls and non URLClassLoader
- // ClassLoaders here...
-
- // and now - let's hack a bit...
- try
- {
- String jar=findJarByResource("javax/servlet/resources/web-app_2_3.dtd");
- classpath+=separator+jar;
- }
- catch (Exception e)
- {
- _log.warn("could not find Servlet API jar", e);
- }
-
- try
- {
- String jar=findJarByResource("org/apache/jasper/resources/jsp12.dtd");
- classpath+=separator+jar;
- }
- catch (Exception e)
- {
- _log.warn("could not find Jasper jar", e);
+ _log.warn("unknown ClassLoader type ("+cl.getClass().getName()+") - jsp
classpath may be incomplete");
}
- try
- {
- String jar=findJarByResource("javax/ejb/EJBHome.class");
- classpath+=separator+jar;
- }
- catch (Exception e)
- {
- _log.warn("could not find J2EE jar", e);
- }
_log.info("default JSP CLASSPATH: "+classpath);
return classpath;
}
-
- // public String getFileClassPath()
- // throws IllegalStateException
- // {
- // ClassLoader loader = getClassLoader();
- // if (loader==null)
- // throw new IllegalStateException("Context classloader not initialized");
- //
- // String separator=System.getProperty("path.separator");
- //
- // String fileClassPath =
- // ((loader instanceof ContextLoader)
- // ? ((ContextLoader)loader).getFileClassPath()
- // : getClassPath())+separator+System.getProperty("java.class.path");
- //
- // try
- // {
- // String
jar=findJarByResource("javax/servlet/resources/web-app_2_3.dtd");
- // fileClassPath+=separator+jar;
- // }
- // catch (Exception e)
- // {
- // _log.warn("could not find Servlet API jar", e);
- // }
- //
- // try
- // {
- // String jar=findJarByResource("org/apache/jasper/resources/jsp12.dtd");
- // fileClassPath+=separator+jar;
- // }
- // catch (Exception e)
- // {
- // _log.warn("could not find Jasper jar", e);
- // }
- //
- // _log.info("default JSP CLASSPATH:"+fileClassPath);
- // return fileClassPath;
- // }
// given a resource name, find the jar file that contains that resource...
protected String
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development