JBossWeb SVN: r1072 - branches/JBOSSWEB_2_0_0_GA_JBPAPP-2040/src/share/classes/org/apache/jasper/runtime.
by jbossweb-commits@lists.jboss.org
Author: mmillson
Date: 2009-05-28 11:28:37 -0400 (Thu, 28 May 2009)
New Revision: 1072
Modified:
branches/JBOSSWEB_2_0_0_GA_JBPAPP-2040/src/share/classes/org/apache/jasper/runtime/BodyContentImpl.java
Log:
Fix fix LIMIT_BUFFER=true ArrayIndexOutOfBoundsException for [JBPAPP-2040].
Modified: branches/JBOSSWEB_2_0_0_GA_JBPAPP-2040/src/share/classes/org/apache/jasper/runtime/BodyContentImpl.java
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_JBPAPP-2040/src/share/classes/org/apache/jasper/runtime/BodyContentImpl.java 2009-05-28 14:33:59 UTC (rev 1071)
+++ branches/JBOSSWEB_2_0_0_GA_JBPAPP-2040/src/share/classes/org/apache/jasper/runtime/BodyContentImpl.java 2009-05-28 15:28:37 UTC (rev 1072)
@@ -51,9 +51,6 @@
// Enclosed writer to which any output is written
private Writer writer;
- // See comment in setWriter()
- private int bufferSizeSave;
-
/**
* Constructor.
*/
@@ -506,8 +503,21 @@
closed = true;
}
}
-
+
/**
+ * This method returns the size of the buffer used by the JspWriter.
+ *
+ * @return the size of the buffer in bytes, or 0 is unbuffered.
+ */
+ public int getBufferSize() {
+ // According to the spec, the JspWriter returned by
+ // JspContext.pushBody(java.io.Writer writer) must behave as
+ // though it were unbuffered. This means that its getBufferSize()
+ // must always return 0.
+ return (writer == null) ? bufferSize : 0;
+ }
+
+ /**
* @return the number of bytes unused in the buffer
*/
public int getRemaining() {
@@ -558,22 +568,7 @@
void setWriter(Writer writer) {
this.writer = writer;
closed = false;
- if (writer != null) {
- // According to the spec, the JspWriter returned by
- // JspContext.pushBody(java.io.Writer writer) must behave as
- // though it were unbuffered. This means that its getBufferSize()
- // must always return 0. The implementation of
- // JspWriter.getBufferSize() returns the value of JspWriter's
- // 'bufferSize' field, which is inherited by this class.
- // Therefore, we simply save the current 'bufferSize' (so we can
- // later restore it should this BodyContentImpl ever be reused by
- // a call to PageContext.pushBody()) before setting it to 0.
- if (bufferSize != 0) {
- bufferSizeSave = bufferSize;
- bufferSize = 0;
- }
- } else {
- bufferSize = bufferSizeSave;
+ if (writer == null) {
clearBody();
}
}
15 years, 7 months
JBossWeb SVN: r1071 - branches.
by jbossweb-commits@lists.jboss.org
Author: mmillson
Date: 2009-05-28 10:33:59 -0400 (Thu, 28 May 2009)
New Revision: 1071
Added:
branches/JBOSSWEB_2_0_0_GA_JBPAPP-2040/
Log:
Create JBPAPP-2040 patch branch from JBOSSWEB_2_0_0_GA tag
Copied: branches/JBOSSWEB_2_0_0_GA_JBPAPP-2040 (from rev 1070, tags/JBOSSWEB_2_0_0_GA)
15 years, 7 months
JBossWeb SVN: r1070 - in trunk/java/org/apache/catalina: core and 1 other directories.
by jbossweb-commits@lists.jboss.org
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);
-
}
15 years, 7 months
JBossWeb SVN: r1069 - in trunk/java/org/apache/catalina: startup and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-05-27 19:00:30 -0400 (Wed, 27 May 2009)
New Revision: 1069
Modified:
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/startup/ContextConfig.java
trunk/java/org/apache/catalina/startup/TldRuleSet.java
Log:
- Fix some details about taglibs.
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-27 22:27:25 UTC (rev 1068)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-27 23:00:30 UTC (rev 1069)
@@ -421,8 +421,20 @@
*/
protected String instanceListeners[] = new String[0];
+
+ /**
+ * The set of JSP property groups defined for the webapp, keyed by pattern.
+ */
+ protected HashMap<String, JspPropertyGroup> jspPropertyGroups = new HashMap<String, JspPropertyGroup>();
+
/**
+ * The set of taglibs defined for the webapp, keyed by uri.
+ */
+ protected HashMap<String, TagLibraryInfo> jspTagLibraries = new HashMap<String, TagLibraryInfo>();
+
+
+ /**
* The logical name of the webapp, if any which may be used in other descriptors.
*/
protected String logicalName = null;
@@ -2273,7 +2285,7 @@
public void addJspPropertyGroup(JspPropertyGroup propertyGroup) {
// Add any JSP mapping specified, as it needs to be mapped to the JSP Servlet
addJspMapping(propertyGroup.getUrlPattern());
- // FIXME: store locally to pass to the Jasper plugin later on
+ jspPropertyGroups.put(propertyGroup.getUrlPattern(), propertyGroup);
}
@@ -2288,7 +2300,7 @@
for (int i = 0; i < listeners.length; i++) {
addApplicationListener(listeners[i]);
}
- // FIXME: store locally to pass to the Jasper plugin later on
+ jspTagLibraries.put(tagLibraryInfo.getUri(), tagLibraryInfo);
}
@@ -2495,7 +2507,7 @@
results[welcomeFiles.length] = name;
welcomeFiles = results;
- postWelcomeFiles();
+ postContextAttributes();
fireContainerEvent("addWelcomeFile", name);
}
@@ -3418,7 +3430,7 @@
welcomeFiles = results;
// Inform interested listeners
- postWelcomeFiles();
+ postContextAttributes();
fireContainerEvent("removeWelcomeFile", name);
}
@@ -4140,7 +4152,7 @@
// Create context attributes that will be required
if (ok) {
- postWelcomeFiles();
+ postContextAttributes();
}
if (ok) {
@@ -4792,13 +4804,16 @@
/**
- * Post a copy of our current list of welcome files as a servlet context
- * attribute, so that the default servlet can find them.
+ * Create mandatory servlet context attributes.
*/
- protected void postWelcomeFiles() {
+ 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);
}
Modified: trunk/java/org/apache/catalina/startup/ContextConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-05-27 22:27:25 UTC (rev 1068)
+++ trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-05-27 23:00:30 UTC (rev 1069)
@@ -1999,6 +1999,10 @@
context.removeTaglib(taglibs[i]);
}
+ // FIXME: remove JSP property groups
+
+ // FIXME: remove JSP tag libraries
+
// Removing welcome files
String[] welcomeFiles = context.findWelcomeFiles();
for (i = 0; i < welcomeFiles.length; i++) {
Modified: trunk/java/org/apache/catalina/startup/TldRuleSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/TldRuleSet.java 2009-05-27 22:27:25 UTC (rev 1068)
+++ trunk/java/org/apache/catalina/startup/TldRuleSet.java 2009-05-27 23:00:30 UTC (rev 1069)
@@ -87,6 +87,9 @@
*/
public void addRuleInstances(Digester digester) {
+ // Parse uri and prefix attributes
+ digester.addSetProperties(prefix + "taglib");
+
digester.addCallMethod(prefix + "taglib/tlibversion",
"setTlibversion", 0);
digester.addCallMethod(prefix + "taglib/tlib-version",
@@ -100,7 +103,7 @@
digester.addCallMethod(prefix + "taglib/short-name",
"setShortname", 0);
digester.addCallMethod(prefix + "taglib/uri",
- "setUri", 0);
+ "setUrn", 0);
digester.addCallMethod(prefix + "taglib/info",
"setInfo", 0);
digester.addCallMethod(prefix + "taglib/description",
15 years, 7 months
JBossWeb SVN: r1068 - in trunk/java/org/apache/catalina: core and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-05-27 18:27:25 -0400 (Wed, 27 May 2009)
New Revision: 1068
Added:
trunk/java/org/apache/catalina/deploy/jsp/TagLibraryValidatorInfo.java
Modified:
trunk/java/org/apache/catalina/Context.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java
trunk/java/org/apache/catalina/startup/ContextConfig.java
trunk/java/org/apache/catalina/startup/TldRuleSet.java
Log:
- Add the parsing code for TLDs.
Modified: trunk/java/org/apache/catalina/Context.java
===================================================================
--- trunk/java/org/apache/catalina/Context.java 2009-05-27 15:35:26 UTC (rev 1067)
+++ trunk/java/org/apache/catalina/Context.java 2009-05-27 22:27:25 UTC (rev 1068)
@@ -31,6 +31,7 @@
import org.apache.catalina.deploy.SecurityConstraint;
import org.apache.catalina.deploy.SessionCookie;
import org.apache.catalina.deploy.WebAbsoluteOrdering;
+import org.apache.catalina.deploy.jsp.TagLibraryInfo;
import org.apache.catalina.util.CharsetMapper;
import org.apache.tomcat.util.http.mapper.Mapper;
@@ -589,6 +590,14 @@
/**
+ * Add the given JSP tag library metadata.
+ *
+ * @param tagLibraryInfo the tag library info that will be added
+ */
+ public void addJspTagLibrary(TagLibraryInfo tagLibraryInfo);
+
+
+ /**
* Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
*
* @param locale locale to map an encoding for
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-27 15:35:26 UTC (rev 1067)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-27 22:27:25 UTC (rev 1068)
@@ -92,6 +92,7 @@
import org.apache.catalina.deploy.SecurityConstraint;
import org.apache.catalina.deploy.SessionCookie;
import org.apache.catalina.deploy.WebAbsoluteOrdering;
+import org.apache.catalina.deploy.jsp.TagLibraryInfo;
import org.apache.catalina.loader.WebappLoader;
import org.apache.catalina.session.StandardManager;
import org.apache.catalina.startup.ContextConfig;
@@ -2270,12 +2271,28 @@
* @param pattern URL pattern to be mapped
*/
public void addJspPropertyGroup(JspPropertyGroup propertyGroup) {
+ // Add any JSP mapping specified, as it needs to be mapped to the JSP Servlet
addJspMapping(propertyGroup.getUrlPattern());
// FIXME: store locally to pass to the Jasper plugin later on
}
/**
+ * Add the given JSP tag library metadata.
+ *
+ * @param tagLibrayInfo the tag library info that will be added
+ */
+ public void addJspTagLibrary(TagLibraryInfo tagLibraryInfo) {
+ // Add listeners specified by the taglib
+ String[] listeners = tagLibraryInfo.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ addApplicationListener(listeners[i]);
+ }
+ // FIXME: store locally to pass to the Jasper plugin later on
+ }
+
+
+ /**
* Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
*
* @param locale locale to map an encoding for
Modified: trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java 2009-05-27 15:35:26 UTC (rev 1067)
+++ trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java 2009-05-27 22:27:25 UTC (rev 1068)
@@ -38,6 +38,8 @@
protected String uri;
protected ArrayList<String> listeners = new ArrayList<String>();
+
+ protected TagLibraryValidatorInfo validator;
/**
* An array describing the tags that are defined in this tag library.
@@ -173,4 +175,12 @@
return listeners.toArray(new String[0]);
}
+ public TagLibraryValidatorInfo getValidator() {
+ return validator;
+ }
+
+ public void setValidator(TagLibraryValidatorInfo validator) {
+ this.validator = validator;
+ }
+
}
Added: trunk/java/org/apache/catalina/deploy/jsp/TagLibraryValidatorInfo.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/jsp/TagLibraryValidatorInfo.java (rev 0)
+++ trunk/java/org/apache/catalina/deploy/jsp/TagLibraryValidatorInfo.java 2009-05-27 22:27:25 UTC (rev 1068)
@@ -0,0 +1,41 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.catalina.deploy.jsp;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TagLibraryValidatorInfo {
+
+ protected String validatorClass;
+ protected Map<String, String> initParams = new HashMap<String, String>();
+
+ public String getValidatorClass() {
+ return validatorClass;
+ }
+ public void setValidatorClass(String validatorClass) {
+ this.validatorClass = validatorClass;
+ }
+ public void addInitParam(String name, String value) {
+ initParams.put(name, value);
+ }
+ public Map<String, String> getInitParams() {
+ return initParams;
+ }
+
+}
Modified: trunk/java/org/apache/catalina/startup/ContextConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-05-27 15:35:26 UTC (rev 1067)
+++ trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-05-27 22:27:25 UTC (rev 1068)
@@ -108,6 +108,7 @@
import org.apache.catalina.deploy.SecurityConstraint;
import org.apache.catalina.deploy.WebAbsoluteOrdering;
import org.apache.catalina.deploy.WebOrdering;
+import org.apache.catalina.deploy.jsp.TagLibraryInfo;
import org.apache.catalina.util.StringManager;
import org.apache.naming.resources.JARDirContext;
import org.apache.naming.resources.ProxyDirContext;
@@ -621,12 +622,14 @@
ok = false;
} else {
synchronized (tldDigester) {
+ TagLibraryInfo tagLibraryInfo = new TagLibraryInfo();
try {
- tldDigester.push(context);
+ tldDigester.push(tagLibraryInfo);
tldDigester.parse(new InputSource(stream));
} finally {
tldDigester.reset();
}
+ context.addJspTagLibrary(tagLibraryInfo);
}
}
} catch (Exception e) {
Modified: trunk/java/org/apache/catalina/startup/TldRuleSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/TldRuleSet.java 2009-05-27 15:35:26 UTC (rev 1067)
+++ trunk/java/org/apache/catalina/startup/TldRuleSet.java 2009-05-27 22:27:25 UTC (rev 1068)
@@ -87,6 +87,121 @@
*/
public void addRuleInstances(Digester digester) {
+ digester.addCallMethod(prefix + "taglib/tlibversion",
+ "setTlibversion", 0);
+ digester.addCallMethod(prefix + "taglib/tlib-version",
+ "setTlibversion", 0);
+ digester.addCallMethod(prefix + "taglib/jspversion",
+ "setJspversion", 0);
+ digester.addCallMethod(prefix + "taglib/jsp-version",
+ "setJspversion", 0);
+ digester.addCallMethod(prefix + "taglib/shortname",
+ "setShortname", 0);
+ digester.addCallMethod(prefix + "taglib/short-name",
+ "setShortname", 0);
+ digester.addCallMethod(prefix + "taglib/uri",
+ "setUri", 0);
+ digester.addCallMethod(prefix + "taglib/info",
+ "setInfo", 0);
+ digester.addCallMethod(prefix + "taglib/description",
+ "setInfo", 0);
+
+ // validator element
+ digester.addObjectCreate(prefix + "taglib/validator",
+ "org.apache.catalina.deploy.jsp.TagLibraryValidatorInfo");
+ digester.addSetNext(prefix + "taglib/validator",
+ "setValidator",
+ "org.apache.catalina.deploy.jsp.TagLibraryValidatorInfo");
+ digester.addCallMethod(prefix + "taglib/validator/validator-class",
+ "setValidatorClass", 0);
+ digester.addCallMethod(prefix + "taglib/validator/init-param",
+ "addInitParam", 2);
+ digester.addCallParam(prefix + "taglib/validator/init-param/param-name", 0);
+ digester.addCallParam(prefix + "taglib/validator/init-param/param-value", 1);
+
+ // tag element
+ digester.addObjectCreate(prefix + "taglib/tag",
+ "org.apache.catalina.deploy.jsp.TagInfo");
+ digester.addSetNext(prefix + "taglib/tag",
+ "addTagInfo",
+ "org.apache.catalina.deploy.jsp.TagInfo");
+ digester.addCallMethod(prefix + "taglib/tag/name",
+ "setTagName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/tagclass",
+ "setTagClassName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/tag-class",
+ "setTagClassName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/teiclass",
+ "setTagExtraInfo", 0);
+ digester.addCallMethod(prefix + "taglib/tag/tei-class",
+ "setTagExtraInfo", 0);
+ digester.addCallMethod(prefix + "taglib/tag/bodycontent",
+ "setBodyContent", 0);
+ digester.addCallMethod(prefix + "taglib/tag/body-content",
+ "setBodyContent", 0);
+ digester.addCallMethod(prefix + "taglib/tag/display-name",
+ "setDisplayName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/small-icon",
+ "setSmallIcon", 0);
+ digester.addCallMethod(prefix + "taglib/tag/large-icon",
+ "setLargeIcon", 0);
+ digester.addCallMethod(prefix + "taglib/tag/icon/small-icon",
+ "setSmallIcon", 0);
+ digester.addCallMethod(prefix + "taglib/tag/icon/large-icon",
+ "setLargeIcon", 0);
+ digester.addCallMethod(prefix + "taglib/tag/info",
+ "setInfoString", 0);
+ digester.addCallMethod(prefix + "taglib/tag/description",
+ "setInfoString", 0);
+ digester.addCallMethod(prefix + "taglib/tag/dynamic-attributes",
+ "setDynamicAttributes", 0);
+
+ // tag/variable element
+ digester.addObjectCreate(prefix + "taglib/tag/variable",
+ "org.apache.catalina.deploy.jsp.TagVariableInfo");
+ digester.addSetNext(prefix + "taglib/tag/variable",
+ "addTagVariableInfo",
+ "org.apache.catalina.deploy.jsp.TagVariableInfo");
+ digester.addCallMethod(prefix + "taglib/tag/variable/name-given",
+ "setNameGiven", 0);
+ digester.addCallMethod(prefix + "taglib/tag/variable/name-from-attribute",
+ "setNameFromAttribute", 0);
+ digester.addCallMethod(prefix + "taglib/tag/variable/class",
+ "setClassName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/variable/declare",
+ "setDeclare", 0);
+ digester.addCallMethod(prefix + "taglib/tag/variable/scope",
+ "setScope", 0);
+
+ // tag/attribute element
+ digester.addObjectCreate(prefix + "taglib/tag/attribute",
+ "org.apache.catalina.deploy.jsp.TagAttributeInfo");
+ digester.addSetNext(prefix + "taglib/tag/attribute",
+ "addTagAttributeInfo",
+ "org.apache.catalina.deploy.jsp.TagAttributeInfo");
+ digester.addCallMethod(prefix + "taglib/tag/attribute/name",
+ "setName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/type",
+ "setType", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/rtexprvalue",
+ "setReqTime", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/required",
+ "setRequired", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/fragment",
+ "setFragment", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/description",
+ "setDescription", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/required",
+ "setRequired", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/deferred-value",
+ "setDeferredValue", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/deferred-value/type",
+ "setExpectedTypeName", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/deferred-method",
+ "setDeferredMethod", 0);
+ digester.addCallMethod(prefix + "taglib/tag/attribute/deferred-value/method-signature",
+ "setMethodSignature", 0);
+
digester.addCallMethod(prefix + "taglib/listener/listener-class",
"addApplicationListener", 0);
15 years, 7 months
JBossWeb SVN: r1067 - in trunk/java/org/apache/catalina: core and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-05-27 11:35:26 -0400 (Wed, 27 May 2009)
New Revision: 1067
Modified:
trunk/java/org/apache/catalina/Context.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java
trunk/java/org/apache/catalina/startup/WebRuleSet.java
Log:
- Add jsp-property-group rules.
Modified: trunk/java/org/apache/catalina/Context.java
===================================================================
--- trunk/java/org/apache/catalina/Context.java 2009-05-27 15:31:15 UTC (rev 1066)
+++ trunk/java/org/apache/catalina/Context.java 2009-05-27 15:35:26 UTC (rev 1067)
@@ -25,6 +25,7 @@
import org.apache.catalina.deploy.ErrorPage;
import org.apache.catalina.deploy.FilterDef;
import org.apache.catalina.deploy.FilterMap;
+import org.apache.catalina.deploy.JspPropertyGroup;
import org.apache.catalina.deploy.LoginConfig;
import org.apache.catalina.deploy.NamingResources;
import org.apache.catalina.deploy.SecurityConstraint;
@@ -580,6 +581,14 @@
/**
+ * Add the given jsp-property-group.
+ *
+ * @param propertyGroup the property group which will be added
+ */
+ public void addJspPropertyGroup(JspPropertyGroup propertyGroup);
+
+
+ /**
* Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
*
* @param locale locale to map an encoding for
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-27 15:31:15 UTC (rev 1066)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-05-27 15:35:26 UTC (rev 1067)
@@ -83,6 +83,7 @@
import org.apache.catalina.deploy.FilterMap;
import org.apache.catalina.deploy.Injectable;
import org.apache.catalina.deploy.InjectionTarget;
+import org.apache.catalina.deploy.JspPropertyGroup;
import org.apache.catalina.deploy.LoginConfig;
import org.apache.catalina.deploy.MessageDestination;
import org.apache.catalina.deploy.MessageDestinationRef;
@@ -2264,6 +2265,17 @@
/**
+ * Add the given jsp-property-group.
+ *
+ * @param pattern URL pattern to be mapped
+ */
+ public void addJspPropertyGroup(JspPropertyGroup propertyGroup) {
+ addJspMapping(propertyGroup.getUrlPattern());
+ // FIXME: store locally to pass to the Jasper plugin later on
+ }
+
+
+ /**
* Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
*
* @param locale locale to map an encoding for
Modified: trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java 2009-05-27 15:31:15 UTC (rev 1066)
+++ trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java 2009-05-27 15:35:26 UTC (rev 1067)
@@ -37,6 +37,8 @@
*/
protected String uri;
+ protected ArrayList<String> listeners = new ArrayList<String>();
+
/**
* An array describing the tags that are defined in this tag library.
*/
@@ -163,5 +165,12 @@
return tags.toArray(new TagInfo[0]);
}
+ public void addListener(String listener) {
+ listeners.add(listener);
+ }
+
+ public String[] getListeners() {
+ return listeners.toArray(new String[0]);
+ }
}
Modified: trunk/java/org/apache/catalina/startup/WebRuleSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/WebRuleSet.java 2009-05-27 15:31:15 UTC (rev 1066)
+++ trunk/java/org/apache/catalina/startup/WebRuleSet.java 2009-05-27 15:35:26 UTC (rev 1067)
@@ -244,8 +244,35 @@
digester.addCallParam(prefix + elementName + "/jsp-config/taglib/taglib-location", 1);
digester.addCallParam(prefix + elementName + "/jsp-config/taglib/taglib-uri", 0);
+ digester.addObjectCreate(prefix + elementName + "/jsp-config/jsp-property-group",
+ "org.apache.catalina.deploy.JspPropertyGroup");
+ digester.addSetNext(prefix + elementName + "/jsp-config/jsp-property-group",
+ "addJspPropertyGroup", "org.apache.catalina.deploy.JspPropertyGroup");
+
digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/url-pattern",
- "addJspMapping", 0);
+ "setUrlPattern", 0);
+ digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/el-ignored",
+ "setElIgnored", 0);
+ digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/page-encoding",
+ "setPageEncoding", 0);
+ digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/scripting-invalid",
+ "setScriptingInvalid", 0);
+ digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/is-xml",
+ "setIsXml", 0);
+ digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/include-prelude",
+ "setIncludePrelude", 0);
+ digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/include-coda",
+ "setIncludeCoda", 0);
+ digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/deferred-syntax-allowed-as-literal",
+ "setDeferredSyntaxAllowedAsLiteral", 0);
+ digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/trim-directive-whitespaces",
+ "setTrimDirectiveWhitespaces", 0);
+ digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/default-content-type",
+ "setDefaultContentType", 0);
+ digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/buffer",
+ "setBuffer", 0);
+ digester.addCallMethod(prefix + elementName + "/jsp-config/jsp-property-group/error-on-undeclared-namespace",
+ "setErrorOnUndeclaredNamespace", 0);
digester.addCallMethod(prefix + elementName + "/listener/listener-class",
"addApplicationListener", 0);
15 years, 7 months
JBossWeb SVN: r1066 - branches/JBOSSWEB_2_0_0_GA_CP.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-05-27 11:31:15 -0400 (Wed, 27 May 2009)
New Revision: 1066
Modified:
branches/JBOSSWEB_2_0_0_GA_CP/build.properties.default
Log:
Use 4.2.3.GA instead the 5.0.0.Beta that has been removed.
Modified: branches/JBOSSWEB_2_0_0_GA_CP/build.properties.default
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP/build.properties.default 2009-05-26 16:26:15 UTC (rev 1065)
+++ branches/JBOSSWEB_2_0_0_GA_CP/build.properties.default 2009-05-27 15:31:15 UTC (rev 1066)
@@ -16,10 +16,10 @@
version.patch=GA_CP
# ----- Vesion Control Flags -----
-jboss.version.major=5
-jboss.version.minor=0
-jboss.version.build=0
-jboss.version.patch=Beta
+jboss.version.major=4
+jboss.version.minor=2
+jboss.version.build=3
+jboss.version.patch=GA
# ----- Compile Control Flags -----
compile.debug=on
15 years, 7 months
JBossWeb SVN: r1065 - in trunk/java/org/apache/catalina/deploy: jsp and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-05-26 12:26:15 -0400 (Tue, 26 May 2009)
New Revision: 1065
Added:
trunk/java/org/apache/catalina/deploy/jsp/
trunk/java/org/apache/catalina/deploy/jsp/FunctionInfo.java
trunk/java/org/apache/catalina/deploy/jsp/TagAttributeInfo.java
trunk/java/org/apache/catalina/deploy/jsp/TagFileInfo.java
trunk/java/org/apache/catalina/deploy/jsp/TagInfo.java
trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java
trunk/java/org/apache/catalina/deploy/jsp/TagVariableInfo.java
Log:
- Add the beans to handle parsing using the digester, derived from the ones in the spec.
Added: trunk/java/org/apache/catalina/deploy/jsp/FunctionInfo.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/jsp/FunctionInfo.java (rev 0)
+++ trunk/java/org/apache/catalina/deploy/jsp/FunctionInfo.java 2009-05-26 16:26:15 UTC (rev 1065)
@@ -0,0 +1,45 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.catalina.deploy.jsp;
+
+public class FunctionInfo {
+
+ protected String name;
+ protected String functionClass;
+ protected String functionSignature;
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getFunctionClass() {
+ return functionClass;
+ }
+ public void setFunctionClass(String functionClass) {
+ this.functionClass = functionClass;
+ }
+ public String getFunctionSignature() {
+ return functionSignature;
+ }
+ public void setFunctionSignature(String functionSignature) {
+ this.functionSignature = functionSignature;
+ }
+
+}
Added: trunk/java/org/apache/catalina/deploy/jsp/TagAttributeInfo.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/jsp/TagAttributeInfo.java (rev 0)
+++ trunk/java/org/apache/catalina/deploy/jsp/TagAttributeInfo.java 2009-05-26 16:26:15 UTC (rev 1065)
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.deploy.jsp;
+
+public class TagAttributeInfo {
+ protected String name;
+ protected String type;
+ protected boolean reqTime;
+ protected boolean required;
+ /*
+ * private fields for JSP 2.0
+ */
+ protected boolean fragment;
+ /*
+ * private fields for JSP 2.1
+ */
+ protected String description;
+ protected boolean deferredValue;
+ protected boolean deferredMethod;
+ protected String expectedTypeName;
+ protected String methodSignature;
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public boolean isReqTime() {
+ return reqTime;
+ }
+ public void setReqTime(boolean reqTime) {
+ this.reqTime = reqTime;
+ }
+ public boolean isRequired() {
+ return required;
+ }
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+ public boolean isFragment() {
+ return fragment;
+ }
+ public void setFragment(boolean fragment) {
+ this.fragment = fragment;
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public boolean isDeferredValue() {
+ return deferredValue;
+ }
+ public void setDeferredValue(boolean deferredValue) {
+ this.deferredValue = deferredValue;
+ }
+ public boolean isDeferredMethod() {
+ return deferredMethod;
+ }
+ public void setDeferredMethod(boolean deferredMethod) {
+ this.deferredMethod = deferredMethod;
+ }
+ public String getExpectedTypeName() {
+ return expectedTypeName;
+ }
+ public void setExpectedTypeName(String expectedTypeName) {
+ this.expectedTypeName = expectedTypeName;
+ }
+ public String getMethodSignature() {
+ return methodSignature;
+ }
+ public void setMethodSignature(String methodSignature) {
+ this.methodSignature = methodSignature;
+ }
+}
Added: trunk/java/org/apache/catalina/deploy/jsp/TagFileInfo.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/jsp/TagFileInfo.java (rev 0)
+++ trunk/java/org/apache/catalina/deploy/jsp/TagFileInfo.java 2009-05-26 16:26:15 UTC (rev 1065)
@@ -0,0 +1,36 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package org.apache.catalina.deploy.jsp;
+
+public class TagFileInfo {
+ protected String name;
+ protected String path;
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getPath() {
+ return path;
+ }
+ public void setPath(String path) {
+ this.path = path;
+ }
+}
Added: trunk/java/org/apache/catalina/deploy/jsp/TagInfo.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/jsp/TagInfo.java (rev 0)
+++ trunk/java/org/apache/catalina/deploy/jsp/TagInfo.java 2009-05-26 16:26:15 UTC (rev 1065)
@@ -0,0 +1,136 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package org.apache.catalina.deploy.jsp;
+
+import java.util.ArrayList;
+
+public class TagInfo {
+
+ /*
+ * private fields for 1.1 info
+ */
+ protected String tagName; // the name of the tag
+ protected String tagClassName;
+ protected String bodyContent;
+ protected String infoString;
+ protected String tagExtraInfo;
+ protected ArrayList<TagAttributeInfo> tagAttributeInfos = new ArrayList<TagAttributeInfo>();
+
+ /*
+ * private fields for 1.2 info
+ */
+ protected String displayName;
+ protected String smallIcon;
+ protected String largeIcon;
+ protected ArrayList<TagVariableInfo> tagVariableInfos = new ArrayList<TagVariableInfo>();
+
+ /*
+ * Additional private fields for 2.0 info
+ */
+ protected boolean dynamicAttributes;
+
+ public void addTagAttributeInfo(TagAttributeInfo tagAttributeInfo) {
+ tagAttributeInfos.add(tagAttributeInfo);
+ }
+
+ public TagAttributeInfo[] getTagAttributeInfos() {
+ return tagAttributeInfos.toArray(new TagAttributeInfo[0]);
+ }
+
+ public void addTagVariableInfo(TagVariableInfo tagVariableInfo) {
+ tagVariableInfos.add(tagVariableInfo);
+ }
+
+ public TagVariableInfo[] getTagVariableInfos() {
+ return tagVariableInfos.toArray(new TagVariableInfo[0]);
+ }
+
+ public String getTagName() {
+ return tagName;
+ }
+
+ public void setTagName(String tagName) {
+ this.tagName = tagName;
+ }
+
+ public String getTagClassName() {
+ return tagClassName;
+ }
+
+ public void setTagClassName(String tagClassName) {
+ this.tagClassName = tagClassName;
+ }
+
+ public String getBodyContent() {
+ return bodyContent;
+ }
+
+ public void setBodyContent(String bodyContent) {
+ this.bodyContent = bodyContent;
+ }
+
+ public String getInfoString() {
+ return infoString;
+ }
+
+ public void setInfoString(String infoString) {
+ this.infoString = infoString;
+ }
+
+ public String getTagExtraInfo() {
+ return tagExtraInfo;
+ }
+
+ public void setTagExtraInfo(String tagExtraInfo) {
+ this.tagExtraInfo = tagExtraInfo;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getSmallIcon() {
+ return smallIcon;
+ }
+
+ public void setSmallIcon(String smallIcon) {
+ this.smallIcon = smallIcon;
+ }
+
+ public String getLargeIcon() {
+ return largeIcon;
+ }
+
+ public void setLargeIcon(String largeIcon) {
+ this.largeIcon = largeIcon;
+ }
+
+ public boolean isDynamicAttributes() {
+ return dynamicAttributes;
+ }
+
+ public void setDynamicAttributes(boolean dynamicAttributes) {
+ this.dynamicAttributes = dynamicAttributes;
+ }
+
+}
Added: trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java (rev 0)
+++ trunk/java/org/apache/catalina/deploy/jsp/TagLibraryInfo.java 2009-05-26 16:26:15 UTC (rev 1065)
@@ -0,0 +1,167 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.catalina.deploy.jsp;
+
+import java.util.ArrayList;
+
+import javax.servlet.jsp.tagext.TagFileInfo;
+import javax.servlet.jsp.tagext.TagInfo;
+
+public class TagLibraryInfo {
+
+ // Protected fields
+
+ /**
+ * The prefix assigned to this taglib from the taglib directive.
+ */
+ protected String prefix;
+
+ /**
+ * The value of the uri attribute from the taglib directive for
+ * this library.
+ */
+ protected String uri;
+
+ /**
+ * An array describing the tags that are defined in this tag library.
+ */
+ protected ArrayList<TagInfo> tags = new ArrayList<TagInfo>();
+
+ /**
+ * An array describing the tag files that are defined in this tag library.
+ *
+ * @since 2.0
+ */
+ protected ArrayList<TagFileInfo> tagFiles = new ArrayList<TagFileInfo>();
+
+ /**
+ * An array describing the functions that are defined in this tag library.
+ *
+ * @since 2.0
+ */
+ protected ArrayList<FunctionInfo> functionsTag = new ArrayList<FunctionInfo>();
+
+ // Tag Library Data
+
+ /**
+ * The version of the tag library.
+ */
+ protected String tlibversion; // required
+
+ /**
+ * The version of the JSP specification this tag library is written to.
+ */
+ protected String jspversion; // required
+
+ /**
+ * The preferred short name (prefix) as indicated in the TLD.
+ */
+ protected String shortname; // required
+
+ /**
+ * The "reliable" URN indicated in the TLD.
+ */
+ protected String urn; // required
+
+ /**
+ * Information (documentation) for this TLD.
+ */
+ protected String info; // optional
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public String getTlibversion() {
+ return tlibversion;
+ }
+
+ public void setTlibversion(String tlibversion) {
+ this.tlibversion = tlibversion;
+ }
+
+ public String getJspversion() {
+ return jspversion;
+ }
+
+ public void setJspversion(String jspversion) {
+ this.jspversion = jspversion;
+ }
+
+ public String getShortname() {
+ return shortname;
+ }
+
+ public void setShortname(String shortname) {
+ this.shortname = shortname;
+ }
+
+ public String getUrn() {
+ return urn;
+ }
+
+ public void setUrn(String urn) {
+ this.urn = urn;
+ }
+
+ public String getInfo() {
+ return info;
+ }
+
+ public void setInfo(String info) {
+ this.info = info;
+ }
+
+ public void addFunctionInfo(FunctionInfo functionInfo) {
+ functionsTag.add(functionInfo);
+ }
+
+ public FunctionInfo[] getFunctionInfos() {
+ return functionsTag.toArray(new FunctionInfo[0]);
+ }
+
+ public void addTagFileInfo(TagFileInfo tagFileInfo) {
+ tagFiles.add(tagFileInfo);
+ }
+
+ public TagFileInfo[] getTagFileInfos() {
+ return tagFiles.toArray(new TagFileInfo[0]);
+ }
+
+ public void addTagInfo(TagInfo tagInfo) {
+ tags.add(tagInfo);
+ }
+
+ public TagInfo[] getTags() {
+ return tags.toArray(new TagInfo[0]);
+ }
+
+
+}
Added: trunk/java/org/apache/catalina/deploy/jsp/TagVariableInfo.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/jsp/TagVariableInfo.java (rev 0)
+++ trunk/java/org/apache/catalina/deploy/jsp/TagVariableInfo.java 2009-05-26 16:26:15 UTC (rev 1065)
@@ -0,0 +1,62 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+package org.apache.catalina.deploy.jsp;
+
+public class TagVariableInfo {
+ /*
+ * private fields
+ */
+ protected String nameGiven; // <name-given>
+ protected String nameFromAttribute; // <name-from-attribute>
+ protected String className; // <class>
+ protected boolean declare; // <declare>
+ protected int scope; // <scope>
+
+ public String getNameGiven() {
+ return nameGiven;
+ }
+ public void setNameGiven(String nameGiven) {
+ this.nameGiven = nameGiven;
+ }
+ public String getNameFromAttribute() {
+ return nameFromAttribute;
+ }
+ public void setNameFromAttribute(String nameFromAttribute) {
+ this.nameFromAttribute = nameFromAttribute;
+ }
+ public String getClassName() {
+ return className;
+ }
+ public void setClassName(String className) {
+ this.className = className;
+ }
+ public boolean isDeclare() {
+ return declare;
+ }
+ public void setDeclare(boolean declare) {
+ this.declare = declare;
+ }
+ public int getScope() {
+ return scope;
+ }
+ public void setScope(int scope) {
+ this.scope = scope;
+ }
+
+}
15 years, 7 months
JBossWeb SVN: r1064 - trunk/java/org/jboss/web/cluster.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-05-25 14:07:04 -0400 (Mon, 25 May 2009)
New Revision: 1064
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
Log:
- Remove ServerFactory.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2009-05-25 14:36:15 UTC (rev 1063)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2009-05-25 18:07:04 UTC (rev 1064)
@@ -51,7 +51,6 @@
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Server;
-import org.apache.catalina.ServerFactory;
import org.apache.catalina.Service;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.core.StandardContext;
@@ -91,6 +90,12 @@
// ----------------------------------------------------------------- Fields
+
+ /**
+ * Associated server.
+ */
+ protected Server server = null;
+
/**
* URL encoder used to generate requests bodies.
@@ -507,7 +512,7 @@
}
} else if (Lifecycle.AFTER_START_EVENT.equals(event.getType())) {
if (source instanceof Server) {
-
+ server = (Server) source;
if (this.proxyList == null) {
if (advertise != 0) {
proxies = new Proxy[0];
@@ -721,7 +726,7 @@
* Disable all webapps for all engines. To be used through JMX or similar.
*/
public boolean disable() {
- Service[] services = ServerFactory.getServer().findServices();
+ Service[] services = server.findServices();
for (int i = 0; i < services.length; i++) {
Engine engine = (Engine) services[i].getContainer();
HashMap<String, String> parameters = new HashMap<String, String>();
@@ -737,7 +742,7 @@
* Enable all webapps for all engines. To be used through JMX or similar.
*/
public boolean enable() {
- Service[] services = ServerFactory.getServer().findServices();
+ Service[] services = server.findServices();
for (int i = 0; i < services.length; i++) {
Engine engine = (Engine) services[i].getContainer();
HashMap<String, String> parameters = new HashMap<String, String>();
@@ -900,7 +905,7 @@
*/
protected void reset(int pos) {
- Service[] services = ServerFactory.getServer().findServices();
+ Service[] services = server.findServices();
for (int i = 0; i < services.length; i++) {
Engine engine = (Engine) services[i].getContainer();
removeAll((Engine) services[i].getContainer(), pos);
15 years, 7 months
JBossWeb SVN: r1063 - in trunk: java/org/apache/catalina and 10 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-05-25 10:36:15 -0400 (Mon, 25 May 2009)
New Revision: 1063
Removed:
trunk/java/org/apache/catalina/ServerFactory.java
trunk/java/org/apache/catalina/mbeans/StandardContextMBean.java
trunk/java/org/apache/catalina/mbeans/StandardEngineMBean.java
trunk/java/org/apache/catalina/mbeans/StandardHostMBean.java
trunk/java/org/apache/catalina/mbeans/StandardServerMBean.java
trunk/java/org/apache/catalina/mbeans/StandardServiceMBean.java
Modified:
trunk/PATCHES.txt
trunk/build.properties.default
trunk/java/org/apache/catalina/connector/Connector.java
trunk/java/org/apache/catalina/connector/MapperListener.java
trunk/java/org/apache/catalina/core/StandardServer.java
trunk/java/org/apache/catalina/core/StandardService.java
trunk/java/org/apache/catalina/deploy/NamingResources.java
trunk/java/org/apache/catalina/manager/ManagerServlet.java
trunk/java/org/apache/catalina/mbeans/MBeanFactory.java
trunk/java/org/apache/catalina/mbeans/MBeanUtils.java
trunk/java/org/apache/catalina/mbeans/ServerLifecycleListener.java
trunk/java/org/apache/catalina/realm/DataSourceRealm.java
trunk/java/org/apache/catalina/realm/RealmBase.java
trunk/java/org/apache/catalina/startup/Tomcat.java
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/coyote/http11/Http11Processor.java
trunk/java/org/apache/tomcat/util/res/StringManager.java
trunk/webapps/docs/changelog.xml
Log:
- Remove ServerFactory.
Modified: trunk/PATCHES.txt
===================================================================
--- trunk/PATCHES.txt 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/PATCHES.txt 2009-05-25 14:36:15 UTC (rev 1063)
@@ -62,8 +62,12 @@
763654
Specific hack to address some error condition in HTTP method
-765727
-ETag should be identical regardless of how the entity is encoded, this patch "fixes" apparently broken proxies
+765727 (reverted)
+ETag should normally be different if the content encoding changes; content-encoding is used because
+transfer-encoding does not work with IE, and is not normally appropriate for transparent compression
-769979
-Does not hurt to unregister properly, but a JMX cleanup is redundant, so will see about it later
+770809
+Fix 47080: NPE in RealmBase.findSecurityConstraints when uri is null (normally useless, a redirection should always occur)
+
+770876
+Windows 64 bit stuff ... Zzzzz
Modified: trunk/build.properties.default
===================================================================
--- trunk/build.properties.default 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/build.properties.default 2009-05-25 14:36:15 UTC (rev 1063)
@@ -59,12 +59,12 @@
commons-collections-src.loc=${base-commons.loc}/collections/source/commons-collections-3.2.1-src.tar.gz
# ----- NSIS, version 2.0 or later -----
-nsis.home=${base.path}/nsis-2.43
+nsis.home=${base.path}/nsis-2.44
nsis.exe=${nsis.home}/makensis.exe
nsis.installoptions.dll=${nsis.home}/Plugins/InstallOptions.dll
nsis.nsexec.dll=${nsis.home}/Plugins/nsExec.dll
nsis.nsisdl.dll=${nsis.home}/Plugins/NSISdl.dll
-nsis.loc=${base-sf.loc}/nsis/nsis-2.43.zip
+nsis.loc=${base-sf.loc}/nsis/nsis-2.44.zip
# ----- JBoss Native, version 2.0 or later -----
jbossnative.home=${base.path}/jboss-native-2.0.6
Deleted: trunk/java/org/apache/catalina/ServerFactory.java
===================================================================
--- trunk/java/org/apache/catalina/ServerFactory.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/ServerFactory.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.catalina;
-
-import org.apache.catalina.core.StandardServer;
-
-
-/**
- * <p><strong>ServerFactory</strong> allows the registration of the
- * (singleton) <code>Server</code> instance for this JVM, so that it
- * can be accessed independently of any existing reference to the
- * component hierarchy. This is important for administration tools
- * that are built around the internal component implementation classes.
- *
- * @author Craig R. McClanahan
- * @version $Revision$ $Date$
- */
-
-public class ServerFactory {
-
-
- // ------------------------------------------------------- Static Variables
-
-
- /**
- * The singleton <code>Server</code> instance for this JVM.
- */
- private static Server server = null;
-
-
- // --------------------------------------------------------- Public Methods
-
-
- /**
- * Return the singleton <code>Server</code> instance for this JVM.
- */
- public static Server getServer() {
- if( server==null )
- server=new StandardServer();
- return (server);
-
- }
-
-
- /**
- * Set the singleton <code>Server</code> instance for this JVM. This
- * method must <strong>only</strong> be called from a constructor of
- * the (singleton) <code>Server</code> instance that is created for
- * this execution of Catalina.
- *
- * @param theServer The new singleton instance
- */
- public static void setServer(Server theServer) {
-
- if (server == null)
- server = theServer;
-
- }
-
-
-}
Modified: trunk/java/org/apache/catalina/connector/Connector.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Connector.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/connector/Connector.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -256,7 +256,7 @@
/**
* Mapper listener.
*/
- protected MapperListener mapperListener = new MapperListener(mapper);
+ protected MapperListener mapperListener = new MapperListener(mapper, this);
/**
Modified: trunk/java/org/apache/catalina/connector/MapperListener.java
===================================================================
--- trunk/java/org/apache/catalina/connector/MapperListener.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/connector/MapperListener.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -29,7 +29,6 @@
import org.apache.catalina.ContainerEvent;
import org.apache.catalina.ContainerListener;
import org.apache.catalina.Host;
-import org.apache.catalina.ServerFactory;
import org.apache.catalina.core.StandardContext;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.mapper.Mapper;
@@ -58,6 +57,11 @@
protected Mapper mapper = null;
/**
+ * Associated connector
+ */
+ protected Connector connector = null;
+
+ /**
* MBean server.
*/
protected MBeanServer mBeanServer = null;
@@ -71,7 +75,6 @@
// It should be null - and fail if not set
private String domain="*";
- private String engine="*";
// ----------------------------------------------------------- Constructors
@@ -79,8 +82,9 @@
/**
* Create mapper listener.
*/
- public MapperListener(Mapper mapper) {
+ public MapperListener(Mapper mapper, Connector connector) {
this.mapper = mapper;
+ this.connector = connector;
}
@@ -94,14 +98,6 @@
this.domain = domain;
}
- public String getEngine() {
- return engine;
- }
-
- public void setEngine(String engine) {
- this.engine = engine;
- }
-
/**
* Initialize associated mapper.
*/
@@ -322,29 +318,32 @@
throws Exception {
String name=objectName.getKeyProperty("host");
if( name != null ) {
- Host host = (Host) ServerFactory.getServer().findService(
- domain).getContainer().findChild(name);
+ Host host = (Host) connector.getService().getContainer().findChild(name);
String[] aliases = host.findAliases();
mapper.addHost(name, aliases, objectName);
host.addContainerListener(this);
if(log.isDebugEnabled())
log.debug(sm.getString
("mapperListener.registerHost", name, domain));
-
}
}
- /**
- * Unregister host.
- */
private void unregisterHost(ObjectName objectName)
- throws Exception {
+ throws Exception {
String name=objectName.getKeyProperty("host");
- mapper.removeHost(name);
- if(log.isDebugEnabled())
- log.debug(sm.getString
- ("mapperListener.unregisterHost", name, domain));
+ if( name != null ) {
+ Host host =
+ (Host) connector.getService().getContainer().findChild(name);
+
+ mapper.removeHost(name);
+ if (host != null) {
+ host.removeContainerListener(this);
+ }
+ if(log.isDebugEnabled())
+ log.debug(sm.getString
+ ("mapperListener.unregisterHost", name, domain));
+ }
}
Modified: trunk/java/org/apache/catalina/core/StandardServer.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardServer.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/core/StandardServer.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -38,7 +38,6 @@
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Server;
-import org.apache.catalina.ServerFactory;
import org.apache.catalina.Service;
import org.apache.catalina.deploy.NamingResources;
import org.apache.catalina.util.LifecycleSupport;
@@ -63,16 +62,6 @@
private static Logger log = Logger.getLogger(StandardServer.class);
- // -------------------------------------------------------------- Constants
-
-
- /**
- * ServerLifecycleListener classname.
- */
- private static String SERVER_LISTENER_CLASS_NAME =
- "org.apache.catalina.mbeans.ServerLifecycleListener";
-
-
// ------------------------------------------------------------ Constructor
@@ -81,9 +70,6 @@
*/
public StandardServer() {
- super();
- ServerFactory.setServer(this);
-
globalNamingResources = new NamingResources();
globalNamingResources.setContainer(this);
Modified: trunk/java/org/apache/catalina/core/StandardService.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardService.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/core/StandardService.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -21,25 +21,25 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+
import javax.management.MBeanRegistration;
import javax.management.MBeanServer;
import javax.management.ObjectName;
+
import org.apache.catalina.Container;
import org.apache.catalina.Engine;
+import org.apache.catalina.Executor;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Server;
import org.apache.catalina.Service;
-import org.apache.catalina.ServerFactory;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.util.StringManager;
import org.apache.tomcat.util.modeler.Registry;
-import java.util.ArrayList;
-import org.apache.catalina.Executor;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
/**
@@ -670,10 +670,9 @@
}
if( server==null ) {
- // Register with the server
- // HACK: ServerFactory should be removed...
-
- ServerFactory.getServer().addService(this);
+ // If no server was defined - create one
+ server = new StandardServer();
+ server.addService(this);
}
Modified: trunk/java/org/apache/catalina/deploy/NamingResources.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/NamingResources.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/deploy/NamingResources.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -21,11 +21,15 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Hashtable;
-import java.io.Serializable;
+import org.apache.catalina.Context;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Server;
+
/**
* Holds and manages the naming resources defined in the J2EE Enterprise
* Naming Context and their associated JNDI context.
@@ -191,9 +195,26 @@
public void addEnvironment(ContextEnvironment environment) {
if (entries.containsKey(environment.getName())) {
- if (findEnvironment(environment.getName()).getOverride()) {
- removeEnvironment(environment.getName());
+ ContextEnvironment ce = findEnvironment(environment.getName());
+ ContextResourceLink rl = findResourceLink(environment.getName());
+ if (ce != null) {
+ if (ce.getOverride()) {
+ removeEnvironment(environment.getName());
+ } else {
+ return;
+ }
+ } else if (rl != null) {
+ // Link. Need to look at the global resources
+ NamingResources global = getServer().getGlobalNamingResources();
+ if (global.findEnvironment(rl.getGlobal()) != null) {
+ if (global.findEnvironment(rl.getGlobal()).getOverride()) {
+ removeResourceLink(environment.getName());
+ } else {
+ return;
+ }
+ }
} else {
+ // It exists but it isn't an env or a res link...
return;
}
}
@@ -208,6 +229,20 @@
}
+ // Container should be an instance of Server or Context. If it is anything
+ // else, return null which will trigger a NPE.
+ private Server getServer() {
+ if (container instanceof Server) {
+ return (Server) container;
+ }
+ if (container instanceof Context) {
+ // Could do this in one go. Lots of casts so split out for clarity
+ Engine engine =
+ (Engine) ((Context) container).getParent().getParent();
+ return engine.getService().getServer();
+ }
+ return null;
+ }
/**
* Add a local EJB resource reference for this web application.
Modified: trunk/java/org/apache/catalina/manager/ManagerServlet.java
===================================================================
--- trunk/java/org/apache/catalina/manager/ManagerServlet.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/manager/ManagerServlet.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -46,7 +46,6 @@
import org.apache.catalina.Lifecycle;
import org.apache.catalina.Manager;
import org.apache.catalina.Server;
-import org.apache.catalina.ServerFactory;
import org.apache.catalina.Session;
import org.apache.catalina.Wrapper;
import org.apache.catalina.core.StandardServer;
@@ -462,7 +461,7 @@
}
// Acquire global JNDI resources if available
- Server server = ServerFactory.getServer();
+ Server server = ((Engine) host.getParent()).getService().getServer();
if ((server != null) && (server instanceof StandardServer)) {
global = ((StandardServer) server).getGlobalNamingContext();
}
@@ -521,7 +520,7 @@
*/
protected synchronized void save(PrintWriter writer, String path) {
- Server server = ServerFactory.getServer();
+ Server server = ((Engine) host.getParent()).getService().getServer();
if (!(server instanceof StandardServer)) {
writer.println(sm.getString("managerServlet.saveFail", server));
Modified: trunk/java/org/apache/catalina/mbeans/MBeanFactory.java
===================================================================
--- trunk/java/org/apache/catalina/mbeans/MBeanFactory.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/mbeans/MBeanFactory.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -18,7 +18,6 @@
package org.apache.catalina.mbeans;
import java.io.File;
-import java.util.Vector;
import javax.management.MBeanException;
import javax.management.MBeanServer;
@@ -29,7 +28,6 @@
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
import org.apache.catalina.Server;
-import org.apache.catalina.ServerFactory;
import org.apache.catalina.Service;
import org.apache.catalina.Valve;
import org.apache.catalina.authenticator.SingleSignOn;
@@ -102,12 +100,22 @@
// ------------------------------------------------------------- Attributes
+ /**
+ * The container (Server/Service) for which this factory was created.
+ */
+ private Object container;
-
// ------------------------------------------------------------- Operations
+ /**
+ * Set the container that this factory was created for.
+ */
+ public void setContainer(Object container) {
+ this.container = container;
+ }
+
/**
* Return the managed bean definition for the specified bean type
*
@@ -206,18 +214,25 @@
private Service getService(ObjectName oname) throws Exception {
-
- String domain = oname.getDomain();
- Server server = ServerFactory.getServer();
- Service[] services = server.findServices();
+
+ if (container instanceof Service) {
+ // Don't bother checking the domain - this is the only option
+ return (Service) container;
+ }
+
StandardService service = null;
- for (int i = 0; i < services.length; i++) {
- service = (StandardService) services[i];
- if (domain.equals(service.getObjectName().getDomain())) {
- break;
+ String domain = oname.getDomain();
+ if (container instanceof Server) {
+ Service[] services = ((Server)container).findServices();
+ for (int i = 0; i < services.length; i++) {
+ service = (StandardService) services[i];
+ if (domain.equals(service.getObjectName().getDomain())) {
+ break;
+ }
}
}
- if (!service.getObjectName().getDomain().equals(domain)) {
+ if (service == null ||
+ !service.getObjectName().getDomain().equals(domain)) {
throw new Exception("Service with the domain is not found");
}
return service;
@@ -645,48 +660,6 @@
}
- /**
- * Create a new StandardEngine.
- *
- * @param parent MBean Name of the associated parent component
- * @param engineName Unique name of this Engine
- * @param defaultHost Default hostname of this Engine
- * @param serviceName Unique name of this Service
- *
- * @exception Exception if an MBean cannot be created or registered
- */
-
- public Vector createStandardEngineService(String parent,
- String engineName, String defaultHost, String serviceName)
- throws Exception {
-
- // Create a new StandardService instance
- StandardService service = new StandardService();
- service.setName(serviceName);
- // Create a new StandardEngine instance
- StandardEngine engine = new StandardEngine();
- engine.setName(engineName);
- engine.setDefaultHost(defaultHost);
- // Need to set engine before adding it to server in order to set domain
- service.setContainer(engine);
- // Add the new instance to its parent component
- Server server = ServerFactory.getServer();
- server.addService(service);
- Vector onames = new Vector();
- // FIXME service & engine.getObjectName
- //ObjectName oname = engine.getObjectName();
- ObjectName oname =
- MBeanUtils.createObjectName(engineName, engine);
- onames.add(0, oname);
- //oname = service.getObjectName();
- oname =
- MBeanUtils.createObjectName(engineName, service);
- onames.add(1, oname);
- return (onames);
-
- }
-
-
/**
* Create a new StandardHost.
*
@@ -767,32 +740,6 @@
/**
- * Create a new StandardService.
- *
- * @param parent MBean Name of the associated parent component
- * @param name Unique name of this StandardService
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public String createStandardService(String parent, String name, String domain)
- throws Exception {
-
- // Create a new StandardService instance
- StandardService service = new StandardService();
- service.setName(name);
-
- // Add the new instance to its parent component
- Server server = ServerFactory.getServer();
- server.addService(service);
-
- // Return the corresponding MBean name
- return (service.getObjectName().toString());
-
- }
-
-
-
- /**
* Create a new Web Application Loader.
*
* @param parent MBean Name of the associated parent component
@@ -831,7 +778,6 @@
// Acquire a reference to the component to be removed
ObjectName oname = new ObjectName(name);
- Server server = ServerFactory.getServer();
Service service = getService(oname);
String port = oname.getKeyProperty("port");
//String address = oname.getKeyProperty("address");
@@ -989,27 +935,6 @@
/**
- * Remove an existing Service.
- *
- * @param name MBean Name of the component to remove
- *
- * @exception Exception if a component cannot be removed
- */
- public void removeService(String name) throws Exception {
-
- // Acquire a reference to the component to be removed
- ObjectName oname = new ObjectName(name);
- String serviceName = oname.getKeyProperty("serviceName");
- Server server = ServerFactory.getServer();
- Service service = server.findService(serviceName);
-
- // Remove this component from its parent component
- server.removeService(service);
-
- }
-
-
- /**
* Remove an existing Valve.
*
* @param name MBean Name of the comonent to remove
Modified: trunk/java/org/apache/catalina/mbeans/MBeanUtils.java
===================================================================
--- trunk/java/org/apache/catalina/mbeans/MBeanUtils.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/mbeans/MBeanUtils.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -19,6 +19,7 @@
import java.util.Hashtable;
+import java.util.Set;
import javax.management.DynamicMBean;
import javax.management.MBeanException;
@@ -43,11 +44,15 @@
import org.apache.catalina.deploy.ContextResourceLink;
import org.apache.catalina.deploy.NamingResources;
import org.apache.catalina.valves.ValveBase;
+import org.apache.coyote.ProtocolHandler;
+import org.apache.coyote.ajp.AjpAprProtocol;
+import org.apache.coyote.ajp.AjpProtocol;
+import org.apache.coyote.http11.Http11AprProtocol;
+import org.apache.coyote.http11.Http11Protocol;
import org.apache.tomcat.util.IntrospectionUtils;
import org.apache.tomcat.util.modeler.ManagedBean;
import org.apache.tomcat.util.modeler.Registry;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
/**
@@ -606,31 +611,26 @@
throws MalformedObjectNameException {
ObjectName name = null;
- if (connector.getClass().getName().indexOf("CoyoteConnector") >= 0 ) {
- try {
- String address = (String)
- IntrospectionUtils.getProperty(connector, "address");
- Integer port = (Integer)
- IntrospectionUtils.getProperty(connector, "port");
- Service service = connector.getService();
- String serviceName = null;
- if (service != null)
- serviceName = service.getName();
- StringBuffer sb = new StringBuffer(domain);
- sb.append(":type=Connector");
- sb.append(",port=" + port);
- if ((address != null) && (address.length()>0)) {
- sb.append(",address=" + address);
- }
- name = new ObjectName(sb.toString());
- return (name);
- } catch (Exception e) {
- throw new MalformedObjectNameException
- ("Cannot create object name for " + connector+e);
+ try {
+ String address = (String)
+ IntrospectionUtils.getProperty(connector, "address");
+ Integer port = (Integer)
+ IntrospectionUtils.getProperty(connector, "port");
+ Service service = connector.getService();
+ String serviceName = null;
+ if (service != null)
+ serviceName = service.getName();
+ StringBuffer sb = new StringBuffer(domain);
+ sb.append(":type=Connector");
+ sb.append(",port=" + port);
+ if ((address != null) && (address.length()>0)) {
+ sb.append(",address=" + address);
}
- } else {
+ name = new ObjectName(sb.toString());
+ return (name);
+ } catch (Exception e) {
throw new MalformedObjectNameException
- ("Cannot create object name for " + connector);
+ ("Cannot create object name for " + connector+e);
}
}
@@ -1205,6 +1205,24 @@
if( mserver.isRegistered( oname )) {
mserver.unregisterMBean(oname);
}
+ // Unregister associated request processor
+ String worker = null;
+ ProtocolHandler handler = connector.getProtocolHandler();
+ if (handler instanceof Http11Protocol) {
+ worker = ((Http11Protocol)handler).getName();
+ } else if (handler instanceof Http11AprProtocol) {
+ worker = ((Http11AprProtocol)handler).getName();
+ } else if (handler instanceof AjpProtocol) {
+ worker = ((AjpProtocol)handler).getName();
+ } else if (handler instanceof AjpAprProtocol) {
+ worker = ((AjpAprProtocol)handler).getName();
+ }
+ ObjectName query = new ObjectName(
+ domain + ":type=RequestProcessor,worker=" + worker + ",*");
+ Set<ObjectName> results = mserver.queryNames(query, null);
+ for(ObjectName result : results) {
+ mserver.unregisterMBean(result);
+ }
}
@@ -1490,6 +1508,16 @@
if( mserver.isRegistered(oname) )
mserver.unregisterMBean(oname);
+ // Global String cache - fixed name
+ oname = new ObjectName("Catalina:type=StringCache");
+ if( mserver.isRegistered(oname) )
+ mserver.unregisterMBean(oname);
+
+ // MBean Factory - fixed name
+ oname = new ObjectName("Catalina:type=MBeanFactory");
+ if( mserver.isRegistered(oname) )
+ mserver.unregisterMBean(oname);
+
}
Modified: trunk/java/org/apache/catalina/mbeans/ServerLifecycleListener.java
===================================================================
--- trunk/java/org/apache/catalina/mbeans/ServerLifecycleListener.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/mbeans/ServerLifecycleListener.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -20,6 +20,7 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+
import javax.management.MBeanException;
import org.apache.catalina.Container;
@@ -36,7 +37,6 @@
import org.apache.catalina.Manager;
import org.apache.catalina.Realm;
import org.apache.catalina.Server;
-import org.apache.catalina.ServerFactory;
import org.apache.catalina.Service;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.core.StandardContext;
@@ -49,7 +49,6 @@
import org.apache.catalina.deploy.ContextResourceLink;
import org.apache.catalina.deploy.NamingResources;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
/**
@@ -125,19 +124,33 @@
Lifecycle lifecycle = event.getLifecycle();
if (Lifecycle.START_EVENT.equals(event.getType())) {
- if (lifecycle instanceof Server) {
- createMBeans();
- }
+ try {
- // We are embedded.
- if( lifecycle instanceof Service ) {
- try {
+ if (lifecycle instanceof Server) {
MBeanFactory factory = new MBeanFactory();
+ factory.setContainer(lifecycle);
createMBeans(factory);
+ createMBeans((Server) lifecycle);
+ }
+
+ if( lifecycle instanceof Service ) {
+ MBeanFactory factory = new MBeanFactory();
+ factory.setContainer(lifecycle);
+ createMBeans(factory);
createMBeans((Service)lifecycle);
- } catch( Exception ex ) {
- log.error("Create mbean factory");
}
+
+ } catch (MBeanException t) {
+
+ Exception e = t.getTargetException();
+ if (e == null)
+ e = t;
+ log.error("createMBeans: MBeanException", e);
+
+ } catch (Throwable t) {
+
+ log.error("createMBeans: Throwable", t);
+
}
/*
@@ -148,7 +161,7 @@
createMBeans();
*/
- } else if (Lifecycle.STOP_EVENT.equals(event.getType())) {
+ } else if (Lifecycle.AFTER_STOP_EVENT.equals(event.getType())) {
try {
if (lifecycle instanceof Server) {
destroyMBeans((Server)lifecycle);
@@ -267,33 +280,6 @@
/**
- * Create the MBeans that correspond to every existing node of our tree.
- */
- protected void createMBeans() {
-
- try {
-
- MBeanFactory factory = new MBeanFactory();
- createMBeans(factory);
- createMBeans(ServerFactory.getServer());
-
- } catch (MBeanException t) {
-
- Exception e = t.getTargetException();
- if (e == null)
- e = t;
- log.error("createMBeans: MBeanException", e);
-
- } catch (Throwable t) {
-
- log.error("createMBeans: Throwable", t);
-
- }
-
- }
-
-
- /**
* Create the MBeans for the specified Connector and its nested components.
*
* @param connector Connector for which to create MBeans
@@ -640,10 +626,6 @@
*/
protected void createMBeans(Service service) throws Exception {
- // Create the MBean for the Service itself
- if (log.isDebugEnabled())
- log.debug("Creating MBean for Service " + service);
- //MBeanUtils.createMBean(service);
if (service instanceof StandardService) {
((StandardService) service).addPropertyChangeListener(this);
}
@@ -676,10 +658,10 @@
protected void destroyMBeans(Connector connector, Service service)
throws Exception {
-// // deregister the MBean for the Connector itself
-// if (log.isDebugEnabled())
-// log.debug("Destroying MBean for Connector " + connector);
-// MBeanUtils.destroyMBean(connector, service);
+ // deregister the MBean for the Connector itself
+ if (log.isDebugEnabled())
+ log.debug("Destroying MBean for Connector " + connector);
+ MBeanUtils.destroyMBean(connector, service);
}
@@ -727,7 +709,7 @@
// deregister the MBean for the Context itself
if (log.isDebugEnabled())
log.debug("Destroying MBean for Context " + context);
- //MBeanUtils.destroyMBean(context);
+ MBeanUtils.destroyMBean(context);
if (context instanceof StandardContext) {
((StandardContext) context).
removePropertyChangeListener(this);
@@ -865,7 +847,7 @@
if (log.isDebugEnabled()) {
log.debug("Destroying MBean for Engine " + engine);
}
- //MBeanUtils.destroyMBean(engine);
+ MBeanUtils.destroyMBean(engine);
}
@@ -902,7 +884,7 @@
if (log.isDebugEnabled()) {
log.debug("Destroying MBean for Host " + host);
}
- //MBeanUtils.destroyMBean(host);
+ MBeanUtils.destroyMBean(host);
}
@@ -979,7 +961,7 @@
if (log.isDebugEnabled()) {
log.debug("Destroying MBean for Server " + server);
}
- //MBeanUtils.destroyMBean(server);
+ MBeanUtils.destroyMBean(server);
if (server instanceof StandardServer) {
((StandardServer) server).removePropertyChangeListener(this);
}
@@ -1000,20 +982,15 @@
// Deregister the MBeans for the associated Engine
Engine engine = (Engine) service.getContainer();
if (engine != null) {
- //destroyMBeans(engine);
+ destroyMBeans(engine);
}
-// // Deregister the MBeans for the corresponding Connectors
-// Connector connectors[] = service.findConnectors();
-// for (int j = 0; j < connectors.length; j++) {
-// destroyMBeans(connectors[j], service);
-// }
-
- // Deregister the MBean for the Service itself
- if (log.isDebugEnabled()) {
- log.debug("Destroying MBean for Service " + service);
+ // Deregister the MBeans for the corresponding Connectors
+ Connector connectors[] = service.findConnectors();
+ for (int j = 0; j < connectors.length; j++) {
+ destroyMBeans(connectors[j], service);
}
- //MBeanUtils.destroyMBean(service);
+
if (service instanceof StandardService) {
((StandardService) service).removePropertyChangeListener(this);
}
Deleted: trunk/java/org/apache/catalina/mbeans/StandardContextMBean.java
===================================================================
--- trunk/java/org/apache/catalina/mbeans/StandardContextMBean.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/mbeans/StandardContextMBean.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -1,358 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.catalina.mbeans;
-
-import java.util.ArrayList;
-
-import javax.management.MBeanException;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.RuntimeOperationsException;
-
-import org.apache.catalina.core.StandardContext;
-import org.apache.catalina.deploy.ContextEnvironment;
-import org.apache.catalina.deploy.ContextResource;
-import org.apache.catalina.deploy.ContextResourceLink;
-import org.apache.catalina.deploy.NamingResources;
-import org.apache.tomcat.util.modeler.BaseModelMBean;
-import org.apache.tomcat.util.modeler.ManagedBean;
-import org.apache.tomcat.util.modeler.Registry;
-
-/**
- * <p>A <strong>ModelMBean</strong> implementation for the
- * <code>org.apache.catalina.core.StandardContext</code> component.</p>
- *
- * @author Amy Roh
- * @version $Revision$ $Date$
- */
-
-public class StandardContextMBean extends BaseModelMBean {
-
-
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a <code>ModelMBean</code> with default
- * <code>ModelMBeanInfo</code> information.
- *
- * @exception MBeanException if the initializer of an object
- * throws an exception
- * @exception RuntimeOperationsException if an IllegalArgumentException
- * occurs
- */
- public StandardContextMBean()
- throws MBeanException, RuntimeOperationsException {
-
- super();
-
- }
-
-
- // ----------------------------------------------------- Instance Variables
-
-
- /**
- * The configuration information registry for our managed beans.
- */
- protected Registry registry = MBeanUtils.createRegistry();
-
- /**
- * The <code>ManagedBean</code> information describing this MBean.
- */
- protected ManagedBean managed =
- registry.findManagedBean("StandardContext");
-
-
- // ------------------------------------------------------------- Attributes
-
-
- /**
- * Return the naming resources associated with this web application.
- */
- private NamingResources getNamingResources() {
-
- return ((StandardContext)this.resource).getNamingResources();
-
- }
-
- /**
- * Return the naming resources associated with this web application.
- */
- public void reload() {
-
- ((StandardContext)this.resource).reload();
-
- }
-
-
- /**
- * Return the MBean Names of the set of defined environment entries for
- * this web application
- */
- public String[] getEnvironments() {
- ContextEnvironment[] envs = getNamingResources().findEnvironments();
- ArrayList results = new ArrayList();
- for (int i = 0; i < envs.length; i++) {
- try {
- ObjectName oname =
- MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
- results.add(oname.toString());
- } catch (MalformedObjectNameException e) {
- IllegalArgumentException iae = new IllegalArgumentException
- ("Cannot create object name for environment " + envs[i]);
- iae.initCause(e);
- throw iae;
- }
- }
- return ((String[]) results.toArray(new String[results.size()]));
-
- }
-
-
- /**
- * Return the MBean Names of all the defined resource references for this
- * application.
- */
- public String[] getResources() {
-
- ContextResource[] resources = getNamingResources().findResources();
- ArrayList results = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- try {
- ObjectName oname =
- MBeanUtils.createObjectName(managed.getDomain(), resources[i]);
- results.add(oname.toString());
- } catch (MalformedObjectNameException e) {
- IllegalArgumentException iae = new IllegalArgumentException
- ("Cannot create object name for resource " + resources[i]);
- iae.initCause(e);
- throw iae;
- }
- }
- return ((String[]) results.toArray(new String[results.size()]));
-
- }
-
-
- /**
- * Return the MBean Names of all the defined resource links for this
- * application
- */
- public String[] getResourceLinks() {
-
- ContextResourceLink[] links = getNamingResources().findResourceLinks();
- ArrayList results = new ArrayList();
- for (int i = 0; i < links.length; i++) {
- try {
- ObjectName oname =
- MBeanUtils.createObjectName(managed.getDomain(), links[i]);
- results.add(oname.toString());
- } catch (MalformedObjectNameException e) {
- IllegalArgumentException iae = new IllegalArgumentException
- ("Cannot create object name for resource " + links[i]);
- iae.initCause(e);
- throw iae;
- }
- }
- return ((String[]) results.toArray(new String[results.size()]));
-
- }
-
-
- /**
- * Return the naming resources associated with this web application.
- */
- public javax.naming.directory.DirContext getStaticResources() {
-
- return ((StandardContext)this.resource).getResources();
-
- }
-
-
- /**
- * Return the naming resources associated with this web application.
- */
- public String[] getWelcomeFiles() {
-
- return ((StandardContext)this.resource).findWelcomeFiles();
-
- }
-
-
- // ------------------------------------------------------------- Operations
-
-
- /**
- * Add an environment entry for this web application.
- *
- * @param envName New environment entry name
- */
- public String addEnvironment(String envName, String type)
- throws MalformedObjectNameException {
-
- NamingResources nresources = getNamingResources();
- if (nresources == null) {
- return null;
- }
- ContextEnvironment env = nresources.findEnvironment(envName);
- if (env != null) {
- throw new IllegalArgumentException
- ("Invalid environment name - already exists '" + envName + "'");
- }
- env = new ContextEnvironment();
- env.setName(envName);
- env.setType(type);
- nresources.addEnvironment(env);
-
- // Return the corresponding MBean name
- ManagedBean managed = registry.findManagedBean("ContextEnvironment");
- ObjectName oname =
- MBeanUtils.createObjectName(managed.getDomain(), env);
- return (oname.toString());
-
- }
-
-
- /**
- * Add a resource reference for this web application.
- *
- * @param resourceName New resource reference name
- */
- public String addResource(String resourceName, String type)
- throws MalformedObjectNameException {
-
- NamingResources nresources = getNamingResources();
- if (nresources == null) {
- return null;
- }
- ContextResource resource = nresources.findResource(resourceName);
- if (resource != null) {
- throw new IllegalArgumentException
- ("Invalid resource name - already exists'" + resourceName + "'");
- }
- resource = new ContextResource();
- resource.setName(resourceName);
- resource.setType(type);
- nresources.addResource(resource);
-
- // Return the corresponding MBean name
- ManagedBean managed = registry.findManagedBean("ContextResource");
- ObjectName oname =
- MBeanUtils.createObjectName(managed.getDomain(), resource);
- return (oname.toString());
- }
-
-
- /**
- * Add a resource link for this web application.
- *
- * @param resourceLinkName New resource link name
- */
- public String addResourceLink(String resourceLinkName, String global,
- String name, String type) throws MalformedObjectNameException {
-
- NamingResources nresources = getNamingResources();
- if (nresources == null) {
- return null;
- }
- ContextResourceLink resourceLink =
- nresources.findResourceLink(resourceLinkName);
- if (resourceLink != null) {
- throw new IllegalArgumentException
- ("Invalid resource link name - already exists'" +
- resourceLinkName + "'");
- }
- resourceLink = new ContextResourceLink();
- resourceLink.setGlobal(global);
- resourceLink.setName(resourceLinkName);
- resourceLink.setType(type);
- nresources.addResourceLink(resourceLink);
-
- // Return the corresponding MBean name
- ManagedBean managed = registry.findManagedBean("ContextResourceLink");
- ObjectName oname =
- MBeanUtils.createObjectName(managed.getDomain(), resourceLink);
- return (oname.toString());
- }
-
-
- /**
- * Remove any environment entry with the specified name.
- *
- * @param envName Name of the environment entry to remove
- */
- public void removeEnvironment(String envName) {
-
- NamingResources nresources = getNamingResources();
- if (nresources == null) {
- return;
- }
- ContextEnvironment env = nresources.findEnvironment(envName);
- if (env == null) {
- throw new IllegalArgumentException
- ("Invalid environment name '" + envName + "'");
- }
- nresources.removeEnvironment(envName);
-
- }
-
-
- /**
- * Remove any resource reference with the specified name.
- *
- * @param resourceName Name of the resource reference to remove
- */
- public void removeResource(String resourceName) {
-
- resourceName = ObjectName.unquote(resourceName);
- NamingResources nresources = getNamingResources();
- if (nresources == null) {
- return;
- }
- ContextResource resource = nresources.findResource(resourceName);
- if (resource == null) {
- throw new IllegalArgumentException
- ("Invalid resource name '" + resourceName + "'");
- }
- nresources.removeResource(resourceName);
- }
-
-
- /**
- * Remove any resource link with the specified name.
- *
- * @param resourceLinkName Name of the resource reference to remove
- */
- public void removeResourceLink(String resourceLinkName) {
-
- resourceLinkName = ObjectName.unquote(resourceLinkName);
- NamingResources nresources = getNamingResources();
- if (nresources == null) {
- return;
- }
- ContextResourceLink resource = nresources.findResourceLink(resourceLinkName);
- if (resource == null) {
- throw new IllegalArgumentException
- ("Invalid resource name '" + resourceLinkName + "'");
- }
- nresources.removeResourceLink(resourceLinkName);
- }
-
-
-}
Deleted: trunk/java/org/apache/catalina/mbeans/StandardEngineMBean.java
===================================================================
--- trunk/java/org/apache/catalina/mbeans/StandardEngineMBean.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/mbeans/StandardEngineMBean.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.catalina.mbeans;
-
-
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.RuntimeOperationsException;
-
-import org.apache.tomcat.util.modeler.BaseModelMBean;
-
-
-/**
- * <p>A <strong>ModelMBean</strong> implementation for the
- * <code>org.apache.catalina.core.StandardEngine</code> component.</p>
- *
- * @author Craig R. McClanahan
- * @version $Revision$ $Date$
- */
-
-public class StandardEngineMBean extends BaseModelMBean {
-
- /**
- * The <code>MBeanServer</code> for this application.
- */
- private static MBeanServer mserver = MBeanUtils.createServer();
-
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a <code>ModelMBean</code> with default
- * <code>ModelMBeanInfo</code> information.
- *
- * @exception MBeanException if the initializer of an object
- * throws an exception
- * @exception RuntimeOperationsException if an IllegalArgumentException
- * occurs
- */
- public StandardEngineMBean()
- throws MBeanException, RuntimeOperationsException {
-
- super();
-
- }
-
-
- // ------------------------------------------------------------- Attributes
-
-
-
- // ------------------------------------------------------------- Operations
-
-
-}
Deleted: trunk/java/org/apache/catalina/mbeans/StandardHostMBean.java
===================================================================
--- trunk/java/org/apache/catalina/mbeans/StandardHostMBean.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/mbeans/StandardHostMBean.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.catalina.mbeans;
-
-
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.RuntimeOperationsException;
-
-import org.apache.catalina.Valve;
-import org.apache.catalina.core.StandardHost;
-import org.apache.tomcat.util.modeler.BaseModelMBean;
-import org.apache.tomcat.util.modeler.ManagedBean;
-import org.apache.tomcat.util.modeler.Registry;
-
-
-/**
- * <p>A <strong>ModelMBean</strong> implementation for the
- * <code>org.apache.catalina.core.StandardHost</code> component.</p>
- *
- * @author Amy Roh
- * @version $Revision$ $Date$
- */
-
-public class StandardHostMBean extends BaseModelMBean {
-
- /**
- * The <code>MBeanServer</code> for this application.
- */
- private static MBeanServer mserver = MBeanUtils.createServer();
-
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a <code>ModelMBean</code> with default
- * <code>ModelMBeanInfo</code> information.
- *
- * @exception MBeanException if the initializer of an object
- * throws an exception
- * @exception RuntimeOperationsException if an IllegalArgumentException
- * occurs
- */
- public StandardHostMBean()
- throws MBeanException, RuntimeOperationsException {
-
- super();
-
- }
-
-
- // ------------------------------------------------------------- Attributes
-
-
-
- // ------------------------------------------------------------- Operations
-
-
- /**
- * Add an alias name that should be mapped to this Host
- *
- * @param alias The alias to be added
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void addAlias(String alias)
- throws Exception {
-
- StandardHost host = (StandardHost) this.resource;
- host.addAlias(alias);
-
- }
-
-
- /**
- * Return the set of alias names for this Host
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public String [] findAliases()
- throws Exception {
-
- StandardHost host = (StandardHost) this.resource;
- return host.findAliases();
-
- }
-
-
- /**
- * Return the MBean Names of the Valves assoicated with this Host
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public String [] getValves()
- throws Exception {
-
- Registry registry = MBeanUtils.createRegistry();
- StandardHost host = (StandardHost) this.resource;
- String mname = MBeanUtils.createManagedName(host);
- ManagedBean managed = registry.findManagedBean(mname);
- String domain = null;
- if (managed != null) {
- domain = managed.getDomain();
- }
- if (domain == null)
- domain = mserver.getDefaultDomain();
- Valve [] valves = host.getValves();
- String [] mbeanNames = new String[valves.length];
- for (int i = 0; i < valves.length; i++) {
- mbeanNames[i] =
- MBeanUtils.createObjectName(domain, valves[i]).toString();
- }
-
- return mbeanNames;
-
- }
-
-
- /**
- * Return the specified alias name from the aliases for this Host
- *
- * @param alias Alias name to be removed
- *
- * @exception Exception if an MBean cannot be created or registered
- */
- public void removeAlias(String alias)
- throws Exception {
-
- StandardHost host = (StandardHost) this.resource;
- host.removeAlias(alias);
-
- }
-
-
-}
Deleted: trunk/java/org/apache/catalina/mbeans/StandardServerMBean.java
===================================================================
--- trunk/java/org/apache/catalina/mbeans/StandardServerMBean.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/mbeans/StandardServerMBean.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.catalina.mbeans;
-
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.RuntimeOperationsException;
-import org.apache.catalina.Server;
-import org.apache.catalina.ServerFactory;
-import org.apache.catalina.core.StandardServer;
-import org.apache.tomcat.util.modeler.BaseModelMBean;
-
-
-/**
- * <p>A <strong>ModelMBean</strong> implementation for the
- * <code>org.apache.catalina.core.StandardServer</code> component.</p>
- *
- * @author Amy Roh
- * @version $Revision$ $Date$
- */
-
-public class StandardServerMBean extends BaseModelMBean {
-
-
- // ------------------------------------------------------- Static Variables
-
-
- /**
- * The <code>MBeanServer</code> for this application.
- */
- private static MBeanServer mserver = MBeanUtils.createServer();
-
-
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a <code>ModelMBean</code> with default
- * <code>ModelMBeanInfo</code> information.
- *
- * @exception MBeanException if the initializer of an object
- * throws an exception
- * @exception RuntimeOperationsException if an IllegalArgumentException
- * occurs
- */
- public StandardServerMBean()
- throws MBeanException, RuntimeOperationsException {
-
- super();
-
- }
-
-
- // ------------------------------------------------------------- Attributes
-
-
- // ------------------------------------------------------------- Operations
-
-
- /**
- * Write the configuration information for this entire <code>Server</code>
- * out to the server.xml configuration file.
- *
- * @exception InstanceNotFoundException if the managed resource object
- * cannot be found
- * @exception MBeanException if the initializer of the object throws
- * an exception, or persistence is not supported
- * @exception RuntimeOperationsException if an exception is reported
- * by the persistence mechanism
- */
- public synchronized void store() throws InstanceNotFoundException,
- MBeanException, RuntimeOperationsException {
-
- Server server = ServerFactory.getServer();
- if (server instanceof StandardServer) {
- try {
- ((StandardServer) server).storeConfig();
- } catch (Exception e) {
- throw new MBeanException(e, "Error updating conf/server.xml");
- }
- }
-
- }
-
-
-}
Deleted: trunk/java/org/apache/catalina/mbeans/StandardServiceMBean.java
===================================================================
--- trunk/java/org/apache/catalina/mbeans/StandardServiceMBean.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/mbeans/StandardServiceMBean.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.catalina.mbeans;
-
-
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.RuntimeOperationsException;
-
-import org.apache.tomcat.util.modeler.BaseModelMBean;
-
-
-/**
- * <p>A <strong>ModelMBean</strong> implementation for the
- * <code>org.apache.catalina.core.StandardService</code> component.</p>
- *
- * @author Amy Roh
- * @version $Revision$ $Date$
- */
-
-public class StandardServiceMBean extends BaseModelMBean {
-
- /**
- * The <code>MBeanServer</code> for this application.
- */
- private static MBeanServer mserver = MBeanUtils.createServer();
-
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a <code>ModelMBean</code> with default
- * <code>ModelMBeanInfo</code> information.
- *
- * @exception MBeanException if the initializer of an object
- * throws an exception
- * @exception RuntimeOperationsException if an IllegalArgumentException
- * occurs
- */
- public StandardServiceMBean()
- throws MBeanException, RuntimeOperationsException {
-
- super();
-
- }
-
-
- // ------------------------------------------------------------- Attributes
-
-
-
- // ------------------------------------------------------------- Operations
-
-
-}
Modified: trunk/java/org/apache/catalina/realm/DataSourceRealm.java
===================================================================
--- trunk/java/org/apache/catalina/realm/DataSourceRealm.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/realm/DataSourceRealm.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -29,11 +29,10 @@
import javax.naming.Context;
import javax.sql.DataSource;
-import org.apache.naming.ContextBindings;
import org.apache.catalina.LifecycleException;
-import org.apache.catalina.ServerFactory;
import org.apache.catalina.core.StandardServer;
import org.apache.catalina.util.StringManager;
+import org.apache.naming.ContextBindings;
/**
*
@@ -396,9 +395,7 @@
context = ContextBindings.getClassLoader();
context = (Context) context.lookup("comp/env");
} else {
- StandardServer server =
- (StandardServer) ServerFactory.getServer();
- context = server.getGlobalNamingContext();
+ context = ((StandardServer) getServer()).getGlobalNamingContext();
}
DataSource dataSource = (DataSource)context.lookup(dataSourceName);
return dataSource.getConnection();
Modified: trunk/java/org/apache/catalina/realm/RealmBase.java
===================================================================
--- trunk/java/org/apache/catalina/realm/RealmBase.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/realm/RealmBase.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -37,24 +37,27 @@
import org.apache.catalina.Container;
import org.apache.catalina.Context;
+import org.apache.catalina.Engine;
import org.apache.catalina.Globals;
+import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Realm;
+import org.apache.catalina.Server;
+import org.apache.catalina.Service;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.core.ContainerBase;
import org.apache.catalina.deploy.LoginConfig;
+import org.apache.catalina.deploy.SecurityCollection;
import org.apache.catalina.deploy.SecurityConstraint;
-import org.apache.catalina.deploy.SecurityCollection;
import org.apache.catalina.util.HexUtils;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.util.MD5Encoder;
import org.apache.catalina.util.StringManager;
import org.apache.tomcat.util.modeler.Registry;
import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
/**
* Simple implementation of <b>Realm</b> that reads an XML file to configure
@@ -1212,6 +1215,30 @@
protected abstract Principal getPrincipal(String username);
+ /**
+ * Return the Server object that is the ultimate parent for the container
+ * with which this Realm is associated. If the server cannot be found (eg
+ * because the container hierarchy is not complete), <code>null</code> is
+ * returned.
+ */
+ protected Server getServer() {
+ Container c = container;
+ if (c instanceof Context) {
+ c = c.getParent();
+ }
+ if (c instanceof Host) {
+ c = c.getParent();
+ }
+ if (c instanceof Engine) {
+ Service s = ((Engine)c).getService();
+ if (s != null) {
+ return s.getServer();
+ }
+ }
+ return null;
+ }
+
+
// --------------------------------------------------------- Static Methods
Modified: trunk/java/org/apache/catalina/startup/Tomcat.java
===================================================================
--- trunk/java/org/apache/catalina/startup/Tomcat.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/catalina/startup/Tomcat.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -178,6 +178,10 @@
* ctx.addErrorPage(ep);
*
* ctx.addMimeMapping("ext", "type");
+ *
+ * Note: If you reload the Context, all your configuration will be lost. If
+ * you need reload support, consider using a LifecycleListener to provide
+ * your configuration.
*
* TODO: add the rest
*
@@ -212,7 +216,7 @@
*
* wrapper.addInitParameter("name", "value");
*/
- public StandardWrapper addServlet(StandardContext ctx,
+ public static StandardWrapper addServlet(StandardContext ctx,
String servletName,
String servletClass) {
// will do class for name and set init params
@@ -227,7 +231,7 @@
/** Use an existing servlet, no class.forName or initialization will be
* performed
*/
- public StandardWrapper addServlet(StandardContext ctx,
+ public static StandardWrapper addServlet(StandardContext ctx,
String servletName,
Servlet servlet) {
// will do class for name and set init params
@@ -525,7 +529,7 @@
* TODO: in normal tomcat, if default-web.xml is not found, use this
* method
*/
- protected void initWebappDefaults(StandardContext ctx) {
+ public static void initWebappDefaults(StandardContext ctx) {
// Default servlet
StandardWrapper servlet =
addServlet(ctx, "default",
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -1482,7 +1482,7 @@
/**
* Parse host.
*/
- public void parseHost(MessageBytes valueMB) {
+ protected void parseHost(MessageBytes valueMB) {
if (valueMB == null || valueMB.isNull()) {
// HTTP/1.0
Modified: trunk/java/org/apache/coyote/http11/Http11Processor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Processor.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/coyote/http11/Http11Processor.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -778,12 +778,11 @@
}
/**
- * Process pipelined HTTP requests using the specified input and output
- * streams.
+ * Process pipelined HTTP requests on the specified socket.
*
- * @param input stream from which the HTTP requests will be read
- * @param output stream which will be used to output the HTTP
- * responses
+ * @param socket Socket from which the HTTP requests will be read
+ * and the HTTP responses will be written.
+ *
* @throws IOException error during an I/O operation
*/
public SocketState process(Socket socket)
@@ -1389,7 +1388,7 @@
/**
* Parse host.
*/
- public void parseHost(MessageBytes valueMB) {
+ protected void parseHost(MessageBytes valueMB) {
if (valueMB == null || valueMB.isNull()) {
// HTTP/1.0
Modified: trunk/java/org/apache/tomcat/util/res/StringManager.java
===================================================================
--- trunk/java/org/apache/tomcat/util/res/StringManager.java 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/java/org/apache/tomcat/util/res/StringManager.java 2009-05-25 14:36:15 UTC (rev 1063)
@@ -67,24 +67,13 @@
*
* @param packageName Name of package to create StringManager for.
*/
-
private StringManager(String packageName) {
- this( packageName, Locale.getDefault() );
- }
-
- private StringManager(String packageName, Locale loc) {
String bundleName = packageName + ".LocalStrings";
- bundle = ResourceBundle.getBundle(bundleName, loc);
+ bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
// Get the actual locale, which may be different from the requested one
locale = bundle.getLocale();
}
- private StringManager(ResourceBundle bundle )
- {
- this.bundle=bundle;
- locale = bundle.getLocale();
- }
-
/**
Get a string from the underlying resource bundle or return
null if the String is not found.
@@ -163,33 +152,4 @@
return mgr;
}
- /**
- * Get the StringManager for a particular package. If a manager for
- * a package already exists, it will be reused, else a new
- * StringManager will be created and returned.
- *
- * @param bundle The resource bundle
- */
- public synchronized static StringManager getManager(ResourceBundle bundle) {
- return new StringManager( bundle );
- }
-
- /**
- * Get the StringManager for a particular package and Locale. If a manager for
- * a package already exists, it will be reused, else a new
- * StringManager will be created for that Locale and returned.
- *
- * @param packageName The package name
- * @param loc The locale
- */
-
- public synchronized static StringManager getManager(String packageName,Locale loc) {
- StringManager mgr = (StringManager)managers.get(packageName+"_"+loc.toString());
- if (mgr == null) {
- mgr = new StringManager(packageName,loc);
- managers.put(packageName+"_"+loc.toString(), mgr);
- }
- return mgr;
- }
-
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-05-25 14:32:57 UTC (rev 1062)
+++ trunk/webapps/docs/changelog.xml 2009-05-25 14:36:15 UTC (rev 1063)
@@ -84,6 +84,15 @@
<bug>46925</bug>: Improve search for nested roles in JNDIRealm by replacing recursive search with
iterative search. Patch provided by Stefan Zoerner. (rjung)
</fix>
+ <fix>
+ Close stream after error in the classloader. (pero)
+ </fix>
+ <fix>
+ <bug>47046</bug>: JMX unregistration. (markt)
+ </fix>
+ <update>
+ Remove ServerFactory. (markt)
+ </update>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -108,11 +117,10 @@
<bug>46909</bug>: The ';' should really only be used if there is a following parameter. (markt)
</fix>
<fix>
- <bug>42390</bug>: Correct JSP compilation error with nested tagfile tags with variables with "AT_BEGIN" scope.
- Patch provided by Konstantin Kolinko. (markt)
+ <bug>37929</bug>: Fix session access to an invalidated session. (markt)
</fix>
<fix>
- <bug>37929</bug>: Fix session access to an invalidated session. (markt)
+ Removed some casts in ELResolverImpl. Patch suggested by kkolinko. (markt)
</fix>
</changelog>
</subsection>
15 years, 7 months