[jboss-cvs] JBossAS SVN: r59027 - trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 13 19:44:53 EST 2006
Author: remy.maucherat at jboss.com
Date: 2006-12-13 19:44:50 -0500 (Wed, 13 Dec 2006)
New Revision: 59027
Modified:
trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/DeployerConfig.java
trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/JBossContextConfig.java
trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployer.java
trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment2.java
Log:
- Use a shared WebMetaData object for parsing the shared web.xml configuration.
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/DeployerConfig.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/DeployerConfig.java 2006-12-14 00:15:36 UTC (rev 59026)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/DeployerConfig.java 2006-12-14 00:44:50 UTC (rev 59027)
@@ -25,6 +25,7 @@
import javax.management.ObjectName;
+import org.jboss.metadata.WebMetaData;
import org.jboss.security.plugins.JaasSecurityManagerServiceMBean;
/**
@@ -123,6 +124,11 @@
private String[] filteredPackages;
/**
+ * Shared WebMetaData.
+ */
+ private WebMetaData sharedMetaData = null;
+
+ /**
* Flag indicating whether web-app specific context xmls may set the privileged flag.
*/
private boolean allowSelfPrivilegedWebApps = false;
@@ -362,5 +368,15 @@
public void setXacmlPolicyURL(URL xacmlPolicyURL)
{
this.xacmlPolicyURL = xacmlPolicyURL;
+ }
+
+ public WebMetaData getSharedMetaData()
+ {
+ return sharedMetaData;
+ }
+
+ public void setSharedMetaData(WebMetaData sharedMetaData)
+ {
+ this.sharedMetaData = sharedMetaData;
}
}
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/JBossContextConfig.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/JBossContextConfig.java 2006-12-14 00:15:36 UTC (rev 59026)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/JBossContextConfig.java 2006-12-14 00:44:50 UTC (rev 59027)
@@ -46,17 +46,28 @@
public class JBossContextConfig extends ContextConfig {
public static ThreadLocal<WebMetaData> metaDataLocal = new ThreadLocal<WebMetaData>();
+ public static ThreadLocal<WebMetaData> metaDataShared = new ThreadLocal<WebMetaData>();
@Override
protected void applicationWebConfig() {
-
+ processWebMetaData(metaDataLocal.get());
+ }
+
+
+ @Override
+ protected void defaultWebConfig()
+ {
+ processWebMetaData(metaDataShared.get());
+ }
+
+
+ protected void processWebMetaData(WebMetaData metaData) {
+
if (context instanceof StandardContext) {
((StandardContext) context).setReplaceWelcomeFiles(true);
}
- WebMetaData metaData = metaDataLocal.get();
-
- // Metadata complete
+ // Metadata complete
context.setIgnoreAnnotations(metaData.isMetadataComplete());
// Context params
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployer.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployer.java 2006-12-14 00:15:36 UTC (rev 59026)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployer.java 2006-12-14 00:44:50 UTC (rev 59027)
@@ -43,6 +43,7 @@
import org.apache.tomcat.util.modeler.Registry;
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.metadata.WebMetaData;
+import org.jboss.metadata.web.WebMetaDataObjectFactory;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.security.plugins.JaasSecurityManagerServiceMBean;
import org.jboss.system.server.Server;
@@ -52,6 +53,8 @@
import org.jboss.web.deployers.AbstractWarDeployment;
import org.jboss.web.tomcat.security.HttpServletRequestPolicyContextHandler;
import org.jboss.web.tomcat.tc6.session.SessionIDGenerator;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
/**
@@ -86,6 +89,11 @@
"org.apache.catalina.core.StandardContext";
/**
+ * Unmarshall factory used for parsing shared web.xml.
+ */
+ private static final UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
+
+ /**
* Configurable map of tomcat authenticators
* Keyed in by the http auth method that gets
* plugged into the Context Config and then into the StandardContext
@@ -146,6 +154,11 @@
*/
private String httpHeaderForSSOAuth = null;
private String sessionCookieForSSOAuth = null;
+
+ /**
+ * Shared metaData.
+ */
+ private WebMetaData sharedMetaData = null;
/**
@@ -529,6 +542,15 @@
PolicyContext.registerHandler(HttpServletRequestPolicyContextHandler.WEB_REQUEST_KEY,
handler, true);
+ // Parse shared web.xml
+ Unmarshaller unmarshaller = factory.newUnmarshaller();
+ URL webXml = this.getClass().getClassLoader().getResource("web.xml");
+ if (webXml == null) {
+ webXml = this.getClass().getClassLoader().getResource("conf/web.xml");;
+ }
+ sharedMetaData = (WebMetaData)
+ unmarshaller.unmarshal(webXml.toString(), new WebMetaDataObjectFactory(), null);
+
// If we are hot-deployed *after* the overall server is started
// we'll never receive Server.START_NOTIFICATION_TYPE, so check
// with the Server and start the connectors immediately, if this is the case.
@@ -754,6 +776,7 @@
config.setAllowSelfPrivilegedWebApps(this.allowSelfPrivilegedWebApps);
config.setSecurityManagerService(this.secMgrService);
config.setFilteredPackages(filteredPackages);
+ config.setSharedMetaData(sharedMetaData);
//Check if there are any xacml policy files
VirtualFile vf = unit.getMetaDataFile("jboss-xacml-policy.xml");
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment2.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment2.java 2006-12-14 00:15:36 UTC (rev 59026)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/deployers/TomcatDeployment2.java 2006-12-14 00:44:50 UTC (rev 59027)
@@ -292,6 +292,7 @@
// Pass the metadata to the RunAsListener via a thread local
RunAsListener.metaDataLocal.set(metaData);
JBossContextConfig.metaDataLocal.set(metaData);
+ JBossContextConfig.metaDataShared.set(config.getSharedMetaData());
try
{
// Init the container; this will also start it
@@ -311,6 +312,7 @@
{
RunAsListener.metaDataLocal.set(null);
JBossContextConfig.metaDataLocal.set(null);
+ JBossContextConfig.metaDataShared.set(null);
}
if (injectionContainer == null)
More information about the jboss-cvs-commits
mailing list