[jboss-cvs] JBossAS SVN: r104333 - in trunk: component-matrix and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 29 16:24:32 EDT 2010
Author: remy.maucherat at jboss.com
Date: 2010-04-29 16:24:30 -0400 (Thu, 29 Apr 2010)
New Revision: 104333
Added:
trunk/tomcat/src/resources/catalina.properties
trunk/tomcat/src/resources/standalone/catalina.properties
trunk/tomcat/src/resources/standalone/context.xml
Modified:
trunk/build/build.xml
trunk/component-matrix/pom.xml
trunk/server/src/main/java/org/jboss/web/deployers/MergedJBossWebMetaDataDeployer.java
trunk/tomcat/pom.xml
trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/HttpServletRequestPolicyContextHandler.java
trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/JaccContextValve.java
trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/SecurityAssociationValve.java
trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/SecurityContextEstablishmentValve.java
trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/WebCtxLoader.java
trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/DeployerConfig.java
trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java
trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java
trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatService.java
trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/request/ActiveRequestResponseCacheValve.java
trunk/tomcat/src/resources/standalone/war-deployers-jboss-beans.xml
Log:
- General optimisation of the web configuration, valves, etc.
- In particular, standalone is Servlet centric, and likely does not need a number of features.
- Align standalone container configuration on JBW 2.1.
- New JBW build.
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/build/build.xml 2010-04-29 20:24:30 UTC (rev 104333)
@@ -340,6 +340,8 @@
<exclude name="jbossweb.sar/jsf-libs/**"/>
<exclude name="jbossweb.sar/META-INF/jboss-structure.xml"/>
<exclude name="jbossweb.sar/META-INF/jboss-beans.xml"/>
+ <exclude name="jbossweb.sar/catalina.properties"/>
+ <exclude name="jbossweb.sar/context.xml"/>
<exclude name="jbossweb.sar/server.xml"/>
<exclude name="jbossweb.sar/web.xml"/>
</fileset>
@@ -357,6 +359,8 @@
</copy>
<copy todir="${install.jbossweb.deploy}/jbossweb.sar">
<fileset dir="${tomcat.module.output}/resources/standalone">
+ <include name="catalina.properties"/>
+ <include name="context.xml"/>
<include name="server.xml"/>
<include name="web.xml"/>
</fileset>
Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/component-matrix/pom.xml 2010-04-29 20:24:30 UTC (rev 104333)
@@ -72,7 +72,7 @@
<version.jboss.osgi.webapp>0.7.2.SP2</version.jboss.osgi.webapp>
<version.jboss.osgi.webconsole>1.0.3</version.jboss.osgi.webconsole>
<version.jboss.osgi.xml.binding>2.0.2.Beta4.SP1</version.jboss.osgi.xml.binding>
- <version.jboss.web>3.0.0-beta-4</version.jboss.web>
+ <version.jboss.web>3.0.0-beta-5</version.jboss.web>
<version.jgroups>2.10.0.Alpha3</version.jgroups>
<version.jsr181.api>1.0-MR1</version.jsr181.api>
<version.junit>4.6</version.junit>
Modified: trunk/server/src/main/java/org/jboss/web/deployers/MergedJBossWebMetaDataDeployer.java
===================================================================
--- trunk/server/src/main/java/org/jboss/web/deployers/MergedJBossWebMetaDataDeployer.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/server/src/main/java/org/jboss/web/deployers/MergedJBossWebMetaDataDeployer.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -63,6 +63,7 @@
public class MergedJBossWebMetaDataDeployer extends AbstractDeployer
{
public static final String WEB_ORDER_ATTACHMENT_NAME = "order."+WebMetaData.class.getName();
+ public static final String WEB_NOORDER_ATTACHMENT_NAME = "noOrder."+WebMetaData.class.getName();
public static final String WEB_OVERLAYS_ATTACHMENT_NAME = "overlays."+WebMetaData.class.getName();
public static final String WEB_SCIS_ATTACHMENT_NAME = "localscis."+WebMetaData.class.getName();
@@ -315,6 +316,7 @@
// No order specified
order.addAll(jarsSet);
jarsSet.clear();
+ unit.addAttachment(WEB_NOORDER_ATTACHMENT_NAME, Boolean.TRUE);
}
if (log.isDebugEnabled())
Modified: trunk/tomcat/pom.xml
===================================================================
--- trunk/tomcat/pom.xml 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/pom.xml 2010-04-29 20:24:30 UTC (rev 104333)
@@ -106,6 +106,8 @@
<copy file="${output.resources}/context.xml"
todir="${output.deploy}/jbossweb.sar"/>
+ <copy file="${output.resources}/catalina.properties"
+ todir="${output.deploy}/jbossweb.sar"/>
<copy file="${output.resources}/web.xml"
tofile="${output.deploy}/jbossweb.sar/web.xml"/>
<copy file="${output.resources}/server.xml"
Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/HttpServletRequestPolicyContextHandler.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/HttpServletRequestPolicyContextHandler.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/HttpServletRequestPolicyContextHandler.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -23,8 +23,9 @@
import javax.security.jacc.PolicyContextException;
import javax.security.jacc.PolicyContextHandler;
-import javax.servlet.http.HttpServletRequest;
+import org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve;
+
/** A PolicyContextHandler for the active HttpServletRequest
* @author Scott.Stark at jboss.org
* @version $Revison:$
@@ -32,13 +33,7 @@
public class HttpServletRequestPolicyContextHandler implements PolicyContextHandler
{
public static final String WEB_REQUEST_KEY = "javax.servlet.http.HttpServletRequest";
- private static ThreadLocal requestContext = new ThreadLocal();
- static void setRequest(HttpServletRequest bean)
- {
- requestContext.set(bean);
- }
-
/** Access the Servlet request policy context data.
* @param key - "javax.servlet.http.HttpServletRequest"
* @param data currently unused
@@ -50,7 +45,7 @@
{
Object context = null;
if( key.equalsIgnoreCase(WEB_REQUEST_KEY) == true )
- context = requestContext.get();
+ context = ActiveRequestResponseCacheValve.activeRequest.get();
return context;
}
Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/JaccContextValve.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/JaccContextValve.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/JaccContextValve.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -73,7 +73,6 @@
{
SecurityAssociationValve.activeWebMetaData.set(metaData);
activeCS.set(warCS);
- HttpServletRequest httpRequest = (HttpServletRequest) request.getRequest();
//Set the customized rolename-principalset mapping in jboss-app.xml
Map<String, Set<String>> principalToRoleSetMap = metaData.getPrincipalVersusRolesMap();
@@ -85,24 +84,15 @@
{
// Set the JACC context id
PolicyContext.setContextID(contextID);
- // Set the JACC HttpServletRequest PolicyContextHandler data
- HttpServletRequestPolicyContextHandler.setRequest(httpRequest);
- if(ActiveRequestResponseCacheValve.activeRequest.get() == null)
- ActiveRequestResponseCacheValve.activeRequest.set(request);
- if(ActiveRequestResponseCacheValve.activeResponse.get() == null)
- ActiveRequestResponseCacheValve.activeResponse.set(response);
// Perform the request
getNext().invoke(request, response);
}
finally
{
SecurityAssociationValve.activeWebMetaData.set(null);
- ActiveRequestResponseCacheValve.activeRequest.set(null);
- ActiveRequestResponseCacheValve.activeResponse.set(null);
SecurityAssociationActions.clear();
activeCS.set(null);
SecurityRolesAssociation.setSecurityRoles(null);
- HttpServletRequestPolicyContextHandler.setRequest(null);
}
}
@@ -111,7 +101,6 @@
{
SecurityAssociationValve.activeWebMetaData.set(metaData);
activeCS.set(warCS);
- HttpServletRequest httpRequest = (HttpServletRequest) request.getRequest();
//Set the customized rolename-principalset mapping in jboss-app.xml
Map<String, Set<String>> principalToRoleSetMap = metaData.getPrincipalVersusRolesMap();
@@ -123,24 +112,15 @@
{
// Set the JACC context id
PolicyContext.setContextID(contextID);
- // Set the JACC HttpServletRequest PolicyContextHandler data
- HttpServletRequestPolicyContextHandler.setRequest(httpRequest);
- if(ActiveRequestResponseCacheValve.activeRequest.get() == null)
- ActiveRequestResponseCacheValve.activeRequest.set(request);
- if(ActiveRequestResponseCacheValve.activeResponse.get() == null)
- ActiveRequestResponseCacheValve.activeResponse.set(response);
// Perform the request
getNext().event(request, response, event);
}
finally
{
SecurityAssociationValve.activeWebMetaData.set(null);
- ActiveRequestResponseCacheValve.activeRequest.set(null);
- ActiveRequestResponseCacheValve.activeResponse.set(null);
SecurityAssociationActions.clear();
activeCS.set(null);
SecurityRolesAssociation.setSecurityRoles(null);
- HttpServletRequestPolicyContextHandler.setRequest(null);
}
}
Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/SecurityAssociationValve.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/SecurityAssociationValve.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/SecurityAssociationValve.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -100,8 +100,6 @@
if( trace )
log.trace("Begin invoke, caller="+caller);
- // Set the active meta data
- activeWebMetaData.set(metaData);
try
{
@@ -217,7 +215,6 @@
{
if( trace )
log.trace("End invoke, caller="+caller);
- activeWebMetaData.set(null);
userPrincipal.set(null);
}
}
@@ -250,8 +247,6 @@
if( trace )
log.trace("Begin invoke, caller="+caller);
- // Set the active meta data
- activeWebMetaData.set(metaData);
try
{
@@ -367,7 +362,6 @@
{
if( trace )
log.trace("End invoke, caller="+caller);
- activeWebMetaData.set(null);
userPrincipal.set(null);
}
}
Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/SecurityContextEstablishmentValve.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/SecurityContextEstablishmentValve.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/security/SecurityContextEstablishmentValve.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -31,7 +31,6 @@
import org.apache.catalina.valves.ValveBase;
import org.jboss.security.ISecurityManagement;
import org.jboss.security.SecurityContext;
-import org.jboss.security.SecurityRolesAssociation;
import org.jboss.security.SecurityUtil;
import org.jboss.servlet.http.HttpEvent;
@@ -67,7 +66,41 @@
public void invoke(Request request, Response response)
throws IOException, ServletException
{
- this.process(request, response, null);
+ SecurityContext cachedContext = null;
+
+ boolean createdSecurityContext = false;
+ //Set the security context if one is unavailable
+ SecurityContext sc = SecurityAssociationActions.getSecurityContext();
+ if(sc != null &&
+ sc.getSecurityDomain().equals(configuredSecurityDomainName) == false)
+ {
+ cachedContext = sc;
+ SecurityContext newSC = createSecurityContext();
+ SecurityAssociationActions.setSecurityContext(newSC);
+ createdSecurityContext = true;
+ }
+
+ if(sc == null)
+ {
+ sc = createSecurityContext();
+ SecurityAssociationActions.setSecurityContext(sc);
+ createdSecurityContext = true;
+ }
+
+ try
+ {
+ // Perform the request
+ getNext().invoke(request, response);
+ }
+ finally
+ {
+ if(createdSecurityContext)
+ {
+ SecurityAssociationActions.clearSecurityContext();
+ }
+ if(cachedContext != null)
+ SecurityAssociationActions.setSecurityContext(cachedContext);
+ }
}
private SecurityContext createSecurityContext()
@@ -92,12 +125,6 @@
public void event(Request request, Response response, HttpEvent event)
throws IOException, ServletException
{
- process(request,response,event);
- }
-
- private void process(Request request, Response response, HttpEvent event)
- throws IOException, ServletException
- {
SecurityContext cachedContext = null;
boolean createdSecurityContext = false;
@@ -122,14 +149,10 @@
try
{
// Perform the request
- if(event == null)
- getNext().invoke(request, response);
- else
- getNext().event(request, response, event);
+ getNext().event(request, response, event);
}
finally
{
- SecurityRolesAssociation.setSecurityRoles(null);
if(createdSecurityContext)
{
SecurityAssociationActions.clearSecurityContext();
@@ -138,4 +161,5 @@
SecurityAssociationActions.setSecurityContext(cachedContext);
}
}
-}
\ No newline at end of file
+
+}
Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/WebCtxLoader.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/WebCtxLoader.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/WebCtxLoader.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -148,7 +148,6 @@
if (this.ctxLoader == null)
throw new LifecycleException("WebCtxLoader cannot be restarted");
- setClassPath();
if (injectionContainer != null)
{
log.debug("injectionContainer enabled and processing beginning with JBoss WebCtxLoader");
@@ -237,7 +236,6 @@
if (repositories.contains(repository) == true)
return;
repositories.add(repository);
- setClassPath();
}
public String[] findLoaderRepositories() {
@@ -261,64 +259,6 @@
}
/**
- * Set the appropriate context attribute for our class path. This
- * is required only because Jasper depends on it.
- */
- private void setClassPath()
- {
- // Validate our current state information
- if (!(webContainer instanceof Context))
- return;
- ServletContext servletContext = ((Context) webContainer).getServletContext();
- if (servletContext == null)
- return;
-
- try
- {
- Method method =
- webContainer.getClass().getMethod("getCompilerClasspath", (Class[])null);
- Object baseClasspath = method.invoke(webContainer, (Object[])null);
- if (baseClasspath != null)
- {
- servletContext.setAttribute(Globals.CLASS_PATH_ATTR,
- baseClasspath.toString());
- return;
- }
- }
- catch (Exception e)
- {
- // Ignore
- e.printStackTrace();
- }
-
- StringBuffer classpath = new StringBuffer();
-
- // Assemble the class path information from our repositories
- for (int i = 0; i < repositories.size(); i++)
- {
- String repository = repositories.get(i).toString();
- if (repository.startsWith("file://"))
- repository = repository.substring(7);
- else if (repository.startsWith("file:"))
- repository = repository.substring(5);
- else if (repository.startsWith("jndi:"))
- repository = servletContext.getRealPath(repository.substring(5));
- else
- continue;
- if (repository == null)
- continue;
- if (i > 0)
- classpath.append(File.pathSeparator);
- classpath.append(repository);
- }
-
- // Store the assembled class path as a servlet context attribute
- servletContext.setAttribute(Globals.CLASS_PATH_ATTR,
- classpath.toString());
-
- }
-
- /**
* A trival extension of URLClassLoader that uses an empty URL[] as its
* classpath so that all work is delegated to its parent.
*/
Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/DeployerConfig.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/DeployerConfig.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/DeployerConfig.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -103,6 +103,11 @@
/** Dynamic classloaders */
private Set<String> dynamicClassloaders;
+ /**
+ * Standalone flag: Servlet + JSP only, no EE.
+ */
+ private boolean standalone = false;
+
public ClassLoader getServiceClassLoader()
{
return serviceClassLoader;
@@ -193,6 +198,16 @@
this.subjectAttributeName = subjectAttributeName;
}
+ public boolean isStandalone()
+ {
+ return standalone;
+ }
+
+ public void setStandalone(boolean standalone)
+ {
+ this.standalone = standalone;
+ }
+
/**
* Get the default security domain implementation to use if a war does not declare a security-domain.
*
Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -30,6 +30,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -194,6 +195,13 @@
}
}
}
+ // Post order
+ List<String> order = (List<String>)
+ deploymentUnitLocal.get().getAttachment(MergedJBossWebMetaDataDeployer.WEB_ORDER_ATTACHMENT_NAME);
+ if (deploymentUnitLocal.get().getAttachment(MergedJBossWebMetaDataDeployer.WEB_NOORDER_ATTACHMENT_NAME) != Boolean.TRUE)
+ {
+ context.getServletContext().setAttribute("javax.servlet.context.orderedLibs", order);
+ }
}
super.lifecycleEvent(event);
}
@@ -228,8 +236,6 @@
((StandardContext)context).setReplaceWelcomeFiles(true);
}
- // Metadata complete
- context.setIgnoreAnnotations(metaData.isMetadataComplete());
// Version
context.setVersion(metaData.getVersion());
@@ -692,7 +698,7 @@
processContextConfig(getHostConfigPath(org.apache.catalina.startup.Constants.HostContextXml), false);
}
// This should come from the deployment unit
- processContextConfig(context.getConfigFile(), true);
+ processContextConfig("WEB-INF/context.xml", true);
}
@@ -1281,7 +1287,7 @@
JBossWebMetaData metaData = metaDataLocal.get();
// Process Servlet API related annotations that were dependent on Servlet declarations
- if (ok && !context.getIgnoreAnnotations() && (metaData != null))
+ if (ok && (metaData != null))
{
// Resolve type specific annotations to their corresponding Servlet components
metaData.resolveAnnotations();
Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -140,7 +140,9 @@
private String policyRegistrationName;
private String tldJars = null;
-
+
+ private boolean standalone = false;
+
public TomcatDeployer()
{
}
@@ -339,6 +341,16 @@
this.deploymentClass = deploymentClass;
}
+ public boolean isStandalone()
+ {
+ return standalone;
+ }
+
+ public void setStandalone(boolean standalone)
+ {
+ this.standalone = standalone;
+ }
+
/**
* Gets whether this object should start/stop the JBoss Web runtime during execution of its own start/stop lifecycle
* callbacks.
@@ -399,6 +411,7 @@
config.setSecurityManagerService(this.secMgrService);
config.setDeleteWorkDirs(deleteWorkDirOnContextDestroy);
config.setDynamicClassloaders(dynamicClassloaders);
+ config.setStandalone(standalone);
config.setSecurityContextClassName(securityContextClassName);
deployment.setSecurityManagementName(securityManagement);
Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -86,11 +86,6 @@
{
private static final Logger log = Logger.getLogger(TomcatDeployment.class);
- /**
- * The name of the war level context configuration descriptor
- */
- private static final String CONTEXT_CONFIG_FILE = "WEB-INF/context.xml";
-
private DeployerConfig config;
private final String[] javaVMs = { " jboss.management.local:J2EEServer=Local,j2eeType=JVM,name=localhost" };
@@ -236,10 +231,7 @@
Registry.getRegistry(null, null).registerComponent(context, objectName, config.getContextClassName());
- context.setConfigFile(CONTEXT_CONFIG_FILE);
context.setInstanceManager(injectionContainer);
- context.setDefaultContextXml("context.xml");
- context.setDefaultWebXml("conf/web.xml");
context.setPublicId(metaData.getPublicID());
String docBase = depUnit.getAttachment("org.jboss.web.explicitDocBase", String.class);
@@ -265,7 +257,6 @@
{
context.setParentClassLoader(loader);
}
- context.setDelegate(webApp.getJava2ClassLoadingCompliance());
// Set the session cookies flag according to metadata
switch (metaData.getSessionCookies())
@@ -286,14 +277,6 @@
if (metaDataSecurityDomain != null)
metaDataSecurityDomain = metaDataSecurityDomain.trim();
- //Add a valve to cache the active request/response
- Engine engine = this.getCatalinaEngine(context);
- if(engine != null)
- {
- ActiveRequestResponseCacheValve activeReqValve = new ActiveRequestResponseCacheValve();
- engine.getPipeline().addValve(activeReqValve);
- }
-
// Add a valve to establish security context
SecurityContextEstablishmentValve scevalve = new SecurityContextEstablishmentValve(metaDataSecurityDomain, SecurityUtil.unprefixSecurityDomain(config
.getDefaultSecurityDomain()), SecurityActions.loadClass(config.getSecurityContextClassName()), getSecurityManagement());
@@ -348,9 +331,12 @@
* Add security association valve after the authorization valves so that the authenticated user may be associated
* with the request thread/session.
*/
- SecurityAssociationValve valve = new SecurityAssociationValve(metaData, config.getSecurityManagerService());
- valve.setSubjectAttributeName(config.getSubjectAttributeName());
- server.invoke(objectName, "addValve", new Object[] { valve }, new String[] { "org.apache.catalina.Valve" });
+ if (!config.isStandalone())
+ {
+ SecurityAssociationValve securityAssociationValve = new SecurityAssociationValve(metaData, config.getSecurityManagerService());
+ securityAssociationValve.setSubjectAttributeName(config.getSubjectAttributeName());
+ context.addValve(securityAssociationValve);
+ }
/*
* TODO: Retrieve the state, and throw an exception in case of a failure Integer state = (Integer)
Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatService.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatService.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/deployers/TomcatService.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -26,8 +26,10 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
+import java.util.Properties;
import java.util.concurrent.Executor;
import javax.management.MBeanServer;
@@ -66,6 +68,7 @@
import org.jboss.web.tomcat.security.HttpServletRequestPolicyContextHandler;
import org.jboss.web.tomcat.service.ondemand.DefaultOnDemandContextIntegrator;
import org.jboss.web.tomcat.service.ondemand.OnDemandContextIntegrator;
+import org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve;
import org.jboss.web.tomcat.service.session.SessionIDGenerator;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -147,7 +150,30 @@
tomcatDeployer.setServiceClassLoader(getClass().getClassLoader());
// Load Catalina properties
- CatalinaProperties.getProperty("");
+ InputStream propertiesIs = null;
+ try {
+ propertiesIs = getClass().getClassLoader().getResourceAsStream("catalina.properties");
+ Properties properties = new Properties();
+ properties.load(propertiesIs);
+ Enumeration enumeration = properties.propertyNames();
+ while (enumeration.hasMoreElements()) {
+ String name = (String) enumeration.nextElement();
+ String value = properties.getProperty(name);
+ if (value != null && (System.getProperty(name) == null)) {
+ System.setProperty(name, value);
+ }
+ }
+ } catch (IOException e) {
+ log.info("Could not read catalina.properties");
+ } finally {
+ if (propertiesIs != null) {
+ try {
+ propertiesIs.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
+ }
log.debug("Starting tomcat deployer");
MBeanServer server = super.getServer();
@@ -197,10 +223,6 @@
// Create the Catalina instance
Catalina catalina = new Catalina();
catalina.setCatalinaHome(System.getProperty("jboss.server.home.dir"));
- catalina.setUseNaming(false);
- catalina.setUseShutdownHook(false);
- catalina.setAwait(false);
- catalina.setRedirectStreams(false);
// Set the modeler Registry MBeanServer to the that of the tomcat service
Registry.getRegistry(null, null).setMBeanServer(server);
@@ -278,7 +300,7 @@
if (engineMetaData.getJvmRoute() != null) {
engine.setJvmRoute(StringPropertyReplacer.replaceProperties(engineMetaData.getJvmRoute()));
}
- //engine.setJvmRoute(engineMetaData.getJvmRoute());
+ engine.getPipeline().addValve(new ActiveRequestResponseCacheValve());
engine.setDefaultHost(engineMetaData.getDefaultHost());
service.setContainer(engine);
Modified: trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/request/ActiveRequestResponseCacheValve.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/request/ActiveRequestResponseCacheValve.java 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/main/java/org/jboss/web/tomcat/service/request/ActiveRequestResponseCacheValve.java 2010-04-29 20:24:30 UTC (rev 104333)
@@ -30,7 +30,8 @@
import org.apache.catalina.valves.ValveBase;
import org.jboss.servlet.http.HttpEvent;
-/** JBAS-7311: Caches the active Catalina request/response
+/**
+ * JBAS-7311: Caches the active Catalina request/response
* @author Anil.Saldhana at redhat.com
* @since Oct 5, 2009
*/
@@ -40,48 +41,39 @@
public static ThreadLocal<Request> activeRequest = new ThreadLocal<Request>();
/** Maintain the Catalina Response for programmatic web login */
public static ThreadLocal<Response> activeResponse = new ThreadLocal<Response>();
-
+
@Override
public void invoke(Request request, Response response) throws IOException, ServletException
{
- internalProcess(request, response, null);
+ //Set the active request and response objects
+ activeRequest.set(request);
+ activeResponse.set(response);
+ try
+ {
+ getNext().invoke(request, response);
+ }
+ finally
+ {
+ activeRequest.set(null);
+ activeResponse.set(null);
+ }
}
@Override
public void event(Request request, Response response, HttpEvent event) throws IOException, ServletException
{
- internalProcess(request, response, event);
- }
-
- /**
- * Set the active request and response on the threadlocals
- * @param request
- * @param response
- * @param event
- * @throws IOException
- * @throws ServletException
- */
- private void internalProcess(Request request, Response response, HttpEvent event) throws IOException, ServletException
- {
//Set the active request and response objects
activeRequest.set(request);
activeResponse.set(response);
-
try
{
- if(event == null)
- {
- getNext().invoke(request, response);
- }
- else
- {
- getNext().event(request, response, event);
- }
+ getNext().event(request, response, event);
}
finally
{
activeRequest.set(null);
activeResponse.set(null);
- }
+ }
}
-}
\ No newline at end of file
+
+}
Added: trunk/tomcat/src/resources/catalina.properties
===================================================================
--- trunk/tomcat/src/resources/catalina.properties (rev 0)
+++ trunk/tomcat/src/resources/catalina.properties 2010-04-29 20:24:30 UTC (rev 104333)
@@ -0,0 +1,16 @@
+# JBoss AS configuration
+org.apache.catalina.STRICT_SERVLET_COMPLIANCE=true
+org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true
+org.apache.jasper.Constants.INJECT_TAGS=false
+org.apache.jasper.Constants.USE_INSTANCE_MANAGER_FOR_TAGS=false
+org.apache.catalina.connector.Connector.X_POWERED_BY=true
+org.apache.catalina.connector.Request.SESSION_ID_CHECK=true
+org.apache.catalina.connector.CoyoteAdapter.X_POWERED_BY=Servlet/3.0; JBossAS-6
+org.apache.catalina.core.StandardHost.configClass=org.jboss.web.tomcat.service.deployers.JBossContextConfig
+org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR=false
+
+# String cache configuration.
+org.apache.tomcat.util.buf.StringCache.byte.enabled=true
+#org.apache.tomcat.util.buf.StringCache.char.enabled=true
+#org.apache.tomcat.util.buf.StringCache.trainThreshold=500000
+#org.apache.tomcat.util.buf.StringCache.cacheSize=5000
Added: trunk/tomcat/src/resources/standalone/catalina.properties
===================================================================
--- trunk/tomcat/src/resources/standalone/catalina.properties (rev 0)
+++ trunk/tomcat/src/resources/standalone/catalina.properties 2010-04-29 20:24:30 UTC (rev 104333)
@@ -0,0 +1,15 @@
+# JBoss AS configuration
+org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true
+org.apache.jasper.Constants.INJECT_TAGS=false
+org.apache.jasper.Constants.USE_INSTANCE_MANAGER_FOR_TAGS=false
+org.apache.catalina.connector.Connector.X_POWERED_BY=true
+org.apache.catalina.connector.Request.SESSION_ID_CHECK=false
+org.apache.catalina.connector.CoyoteAdapter.X_POWERED_BY=Servlet/3.0; JBossWeb-3
+org.apache.catalina.core.StandardHost.configClass=org.jboss.web.tomcat.service.deployers.JBossContextConfig
+org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR=false
+
+# String cache configuration.
+org.apache.tomcat.util.buf.StringCache.byte.enabled=true
+#org.apache.tomcat.util.buf.StringCache.char.enabled=true
+#org.apache.tomcat.util.buf.StringCache.trainThreshold=500000
+#org.apache.tomcat.util.buf.StringCache.cacheSize=5000
Added: trunk/tomcat/src/resources/standalone/context.xml
===================================================================
--- trunk/tomcat/src/resources/standalone/context.xml (rev 0)
+++ trunk/tomcat/src/resources/standalone/context.xml 2010-04-29 20:24:30 UTC (rev 104333)
@@ -0,0 +1,11 @@
+<!-- The contents of this file will be loaded for each web application -->
+<Context cookies="true" crossContext="true">
+ <!-- Session persistence is disable by default. To enable for all web
+ apps set the pathname to a non-empty value:
+ <Manager pathname="SESSIONS.ser" />
+
+ To enable session persistence for a single web app, add a
+ WEB-INF/context.xml
+ -->
+ <Manager pathname="" />
+</Context>
Property changes on: trunk/tomcat/src/resources/standalone/context.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/tomcat/src/resources/standalone/war-deployers-jboss-beans.xml
===================================================================
--- trunk/tomcat/src/resources/standalone/war-deployers-jboss-beans.xml 2010-04-29 20:17:49 UTC (rev 104332)
+++ trunk/tomcat/src/resources/standalone/war-deployers-jboss-beans.xml 2010-04-29 20:24:30 UTC (rev 104333)
@@ -75,6 +75,8 @@
<!-- Inject the MainDeployer for resolving cross deployment refs -->
<property name="mainDeployer"><inject bean="MainDeployer" /></property>
+ <property name="standalone">true</property>
+
<property name="relativeOrder">3000</property>
<property name="configFile">
More information about the jboss-cvs-commits
mailing list