Author: remy.maucherat(a)jboss.com
Date: 2009-05-27 21:43:40 -0400 (Wed, 27 May 2009)
New Revision: 1070
Modified:
trunk/java/org/apache/catalina/Globals.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/startup/TldRuleSet.java
Log:
- Add a single function for the context attributes.
Modified: trunk/java/org/apache/catalina/Globals.java
===================================================================
--- trunk/java/org/apache/catalina/Globals.java 2009-05-27 23:00:30 UTC (rev 1069)
+++ trunk/java/org/apache/catalina/Globals.java 2009-05-28 01:43:40 UTC (rev 1070)
@@ -139,6 +139,33 @@
/**
+ * The servlet context attribute under which we record the set of
+ * JSP property groups (as an object of type HashMap<String,
JspPropertyGroup>)
+ * for this application.
+ */
+ public static final String JSP_PROPERTY_GROUPS =
+ "org.apache.catalina.JSP_PROPERTY_GROUPS";
+
+
+ /**
+ * The servlet context attribute under which we record the set of
+ * JSP tag libraries (as an object of type HashMap<String, TagLibraryInfo>)
+ * for this application.
+ */
+ public static final String JSP_TAG_LIBRARIES =
+ "org.apache.catalina.JSP_TAG_LIBRARIES";
+
+
+ /**
+ * The servlet context attribute under which we record the set of
+ * JSP tag libraries locations (as an object of type HashMap<String, String>)
+ * for this application.
+ */
+ public static final String JSP_TAG_LIBRARIES_LOCATION =
+ "org.apache.catalina.JSP_TAG_LIBRARIES_LOCATION";
+
+
+ /**
* The request attribute under which we store the key size being used for
* this SSL connection (as an object of type java.lang.Integer).
*/
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-27 23:00:30 UTC (rev
1069)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-28 01:43:40 UTC (rev
1070)
@@ -2507,7 +2507,8 @@
results[welcomeFiles.length] = name;
welcomeFiles = results;
- postContextAttributes();
+ if (started)
+ postContextAttributes();
fireContainerEvent("addWelcomeFile", name);
}
@@ -3430,7 +3431,8 @@
welcomeFiles = results;
// Inform interested listeners
- postContextAttributes();
+ if (started)
+ postContextAttributes();
fireContainerEvent("removeWelcomeFile", name);
}
@@ -4120,11 +4122,6 @@
ok = false;
}
- // We put the resources into the servlet context
- if (ok)
- getServletContext().setAttribute
- (Globals.RESOURCES_ATTR, getResources());
-
// Initialize associated mapper
mapper.setContext(getPath(), welcomeFiles, resources);
@@ -4132,7 +4129,7 @@
oldCCL = bindThread();
// Annotation processor setup
- if (ok ) {
+ if (ok) {
if (instanceManager == null) {
javax.naming.Context context = null;
if (isUseNaming() && namingContextListener != null) {
@@ -4142,9 +4139,6 @@
buildInjectionMap(getIgnoreAnnotations() ? new NamingResources():
getNamingResources());
instanceManager = new DefaultInstanceManager
(context, injectionMap, this, this.getClass().getClassLoader());
- getServletContext().setAttribute(InstanceManager.class.getName(),
instanceManager);
- } else {
- getServletContext().setAttribute(InstanceManager.class.getName(),
instanceManager);
}
}
@@ -4792,31 +4786,21 @@
/**
- * Post a copy of our web application resources as a servlet context
- * attribute.
- */
- protected void postResources() {
-
- getServletContext().setAttribute
- (Globals.RESOURCES_ATTR, getResources());
-
- }
-
-
- /**
* Create mandatory servlet context attributes.
*/
protected void postContextAttributes() {
-
- getServletContext().setAttribute("org.apache.catalina.WELCOME_FILES",
- welcomeFiles);
-
getServletContext().setAttribute("org.apache.catalina.jsp.PROPERTY_GROUPS",
- jspPropertyGroups);
-
getServletContext().setAttribute("org.apache.catalina.jsp.TAG_LIBRARIES",
- jspTagLibraries);
-
+ ServletContext context = getServletContext();
+ context.setAttribute(Globals.RESOURCES_ATTR, getResources());
+ context.setAttribute(Globals.WELCOME_FILES_ATTR, welcomeFiles);
+ // Jasper attributes
+ context.setAttribute(Globals.JSP_PROPERTY_GROUPS, jspPropertyGroups);
+ context.setAttribute(Globals.JSP_TAG_LIBRARIES, jspTagLibraries);
+ context.setAttribute(Globals.JSP_TAG_LIBRARIES_LOCATION, taglibs);
+ // Instance manager (also used by Jasper)
+ context.setAttribute(InstanceManager.class.getName(), instanceManager);
}
+
public String getHostname() {
Container parentHost = getParent();
if (parentHost != null) {
@@ -4869,7 +4853,7 @@
workDir = "work" + File.separator + engineName +
File.separator + hostName + File.separator + temp;
}
- setWorkDir(workDir);
+ this.workDir = workDir;
}
// Create this directory if necessary
Modified: trunk/java/org/apache/catalina/startup/TldRuleSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/TldRuleSet.java 2009-05-27 23:00:30 UTC (rev
1069)
+++ trunk/java/org/apache/catalina/startup/TldRuleSet.java 2009-05-28 01:43:40 UTC (rev
1070)
@@ -87,7 +87,7 @@
*/
public void addRuleInstances(Digester digester) {
- // Parse uri and prefix attributes
+ // uri and prefix attributes
digester.addSetProperties(prefix + "taglib");
digester.addCallMethod(prefix + "taglib/tlibversion",
@@ -108,6 +108,8 @@
"setInfo", 0);
digester.addCallMethod(prefix + "taglib/description",
"setInfo", 0);
+ digester.addCallMethod(prefix + "taglib/listener/listener-class",
+ "addListener", 0);
// validator element
digester.addObjectCreate(prefix + "taglib/validator",
@@ -205,9 +207,6 @@
digester.addCallMethod(prefix +
"taglib/tag/attribute/deferred-value/method-signature",
"setMethodSignature", 0);
- digester.addCallMethod(prefix + "taglib/listener/listener-class",
- "addApplicationListener", 0);
-
}