User: jules_gosnell
Date: 01/11/22 18:01:29
Modified: jetty/src/main/org/jboss/jetty
JBossWebApplicationContext.java
Log:
tidy up a little
Revision Changes Path
1.2 +37 -31
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JBossWebApplicationContext.java 2001/11/21 23:13:01 1.1
+++ JBossWebApplicationContext.java 2001/11/23 02:01:29 1.2
@@ -5,7 +5,7 @@
* See terms of license at gnu.org.
*/
-// $Id: JBossWebApplicationContext.java,v 1.1 2001/11/21 23:13:01 jules_gosnell Exp
$
+// $Id: JBossWebApplicationContext.java,v 1.2 2001/11/23 02:01:29 jules_gosnell Exp
$
// A Jetty HttpServer with the interface expected by JBoss'
// J2EEDeployer...
@@ -112,22 +112,20 @@
if (cl==null)
_log.warn("WARNING: WebApp Context's ClassLoader is of incorrect
descent:"+loader);
- else
- _log.info("WebApp Context's ClassLoader is of correct descent:"+loader);
+ // else
+ // _log.info("WebApp Context's ClassLoader is of correct
descent:"+loader);
}
// Parse descriptors and set up the JNDI environment
Element webAppDD = _webApp.getWebApp();
Element jbossDD = _webApp.getJbossWeb();
_descriptorParser.parseWebAppDescriptors(loader, webAppDD, jbossDD);
- _log.info("WebApp Descriptors parsed");
// Add the JBoss security realm
String realmName = getRealm();
if (realmName!=null)
{
- _log.info("WebApp Realm initialised");
- // these need to be cached and reused by name... - TODO
+ // these need to be cached and reused by name...MAYBE - TODO
getHttpContext().getHttpServer().addRealm(new JBossUserRealm(realmName));
}
@@ -157,7 +155,7 @@
return securityHandler;
}
- // avoid Jetty maoning about things that it doesn't bu AbstractWebContainer does
do...
+ // avoid Jetty maoning about things that it doesn't but AbstractWebContainer does
do...
protected void
initWebXmlElement(String element, org.mortbay.xml.XmlParser.Node node)
@@ -175,16 +173,19 @@
super.initWebXmlElement(element, node);
}
- //--debugging
+// public boolean
+// handle(org.mortbay.http.HttpRequest request, org.mortbay.http.HttpResponse
response)
+// throws org.mortbay.http.HttpException, java.io.IOException
+// {
+// Thread.currentThread().setContextClassLoader(getClassLoader());
+// return super.handle(request, response);
+// }
+
+ // hack our class loader to be Java2 compliant - i.e. always
+ // delegate upwards before looking locally. This will be changed to
+ // a non-compliant strategy later when JBoss' new ClassLoader is
+ // ready.
- public boolean
- handle(org.mortbay.http.HttpRequest request, org.mortbay.http.HttpResponse
response)
- throws org.mortbay.http.HttpException, java.io.IOException
- {
- Thread.currentThread().setContextClassLoader(getClassLoader());
- return super.handle(request, response);
- }
-
protected void initClassLoader()
throws java.net.MalformedURLException, java.io.IOException
{
@@ -195,6 +196,9 @@
((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...
+
public String getFileClassPath()
throws IllegalStateException
{
@@ -210,11 +214,9 @@
try
{
- String dtd="javax/servlet/resources/web-app_2_3.dtd";
- String path=getClass().getClassLoader().getResource(dtd).toString();
- String jarPath=path.substring(0,path.length()-(dtd.length()+2)); // lose final
'!/class...'
- jarPath=jarPath.substring("jar:file:".length(),jarPath.length());
- fileClassPath+=jarPath;
+ String jar=findJarByResource("javax/servlet/resources/web-app_2_3.dtd");
+ //
jar="/home/jules/cvs/JBoss/3.0/thirdparty/mortbay/jetty/lib/javax.servlet.jar";
+ fileClassPath+=jar;
}
catch (Exception e)
{
@@ -223,22 +225,26 @@
try
{
- String dtd="org/apache/jasper/resources/jsp12.dtd";
- String path=getClass().getClassLoader().getResource(dtd).toString();
- String jarPath=path.substring(0,path.length()-(dtd.length()+2)); // lose final
'!/class...'
- jarPath=jarPath.substring("jar:file:".length(),jarPath.length());
- fileClassPath+=":"+jarPath;
+ String jar=findJarByResource("org/apache/jasper/resources/jsp12.dtd");
+ //
jar="/home/jules/cvs/JBoss/3.0/thirdparty/mortbay/jetty/lib/org.apache.jasper.jar";
+ fileClassPath+=":"+jar;
}
catch (Exception e)
{
- _log.warn("WARNING: could not find Servlet API jar", e);
+ _log.warn("WARNING: 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
+ findJarByResource(String resource)
+ throws Exception
+ {
+ String path=getClass().getClassLoader().getResource(resource).toString();
+ // lose initial "jar:file:" and final "!/..."
+ return
path.substring("jar:file:".length(),path.length()-(resource.length()+2));
+ }
+}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development