From: markt Date: Thu, 20 Nov 2008 08:19:23 +0000 (+0000) Subject: Revert r718819 that completely broke Tomcat. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6bb6d46ad88e5ef8a47130eb1008111af5c20e97;p=tomcat7.0 Revert r718819 that completely broke Tomcat. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@719194 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java index ea164fae8..a3f6bff76 100644 --- a/java/org/apache/catalina/connector/CoyoteAdapter.java +++ b/java/org/apache/catalina/connector/CoyoteAdapter.java @@ -626,7 +626,7 @@ public class CoyoteAdapter } if (conv != null) { try { - conv.convert(bc, cc, cc.getBuffer().length - cc.getEnd()); + conv.convert(bc, cc); uri.setChars(cc.getBuffer(), cc.getStart(), cc.getLength()); return; diff --git a/java/org/apache/tomcat/util/IntrospectionUtils.java b/java/org/apache/tomcat/util/IntrospectionUtils.java index 2a46bcbff..8bc3fe6c2 100644 --- a/java/org/apache/tomcat/util/IntrospectionUtils.java +++ b/java/org/apache/tomcat/util/IntrospectionUtils.java @@ -470,9 +470,25 @@ public final class IntrospectionUtils { /** * Replace ${NAME} with the property value + * + * @deprecated Use the explicit method + */ + public static String replaceProperties(String value, Object getter) { + if (getter instanceof Hashtable) + return replaceProperties(value, (Hashtable) getter, null); + + if (getter instanceof PropertySource) { + PropertySource src[] = new PropertySource[] { (PropertySource) getter }; + return replaceProperties(value, null, src); + } + return value; + } + + /** + * Replace ${NAME} with the property value */ - public static String replaceProperties(String value, - Hashtable staticProp, PropertySource dynamicProp[]) { + public static String replaceProperties(String value, Hashtable staticProp, + PropertySource dynamicProp[]) { if (value.indexOf("$") < 0) { return value; } diff --git a/java/org/apache/tomcat/util/buf/B2CConverter.java b/java/org/apache/tomcat/util/buf/B2CConverter.java index 5bf66bf3e..995476b3e 100644 --- a/java/org/apache/tomcat/util/buf/B2CConverter.java +++ b/java/org/apache/tomcat/util/buf/B2CConverter.java @@ -67,6 +67,16 @@ public class B2CConverter { static final int BUFFER_SIZE=8192; char result[]=new char[BUFFER_SIZE]; + /** Convert a buffer of bytes into a chars + * @deprecated + */ + public void convert( ByteChunk bb, CharChunk cb ) + throws IOException + { + // Set the ByteChunk as input to the Intermediate reader + convert(bb, cb, cb.getBuffer().length - cb.getEnd()); + } + public void convert( ByteChunk bb, CharChunk cb, int limit) throws IOException diff --git a/java/org/apache/tomcat/util/buf/MessageBytes.java b/java/org/apache/tomcat/util/buf/MessageBytes.java index 42db3c515..4e35b43e0 100644 --- a/java/org/apache/tomcat/util/buf/MessageBytes.java +++ b/java/org/apache/tomcat/util/buf/MessageBytes.java @@ -68,10 +68,10 @@ public final class MessageBytes implements Cloneable, Serializable { /** * Creates a new, uninitialized MessageBytes object. - * Use static newInstance() in order to allow + * @deprecated Use static newInstance() in order to allow * future hooks. */ - private MessageBytes() { + public MessageBytes() { } /** Construct a new MessageBytes instance diff --git a/java/org/apache/tomcat/util/digester/AbstractRulesImpl.java b/java/org/apache/tomcat/util/digester/AbstractRulesImpl.java index a01dfa464..d3f131c65 100644 --- a/java/org/apache/tomcat/util/digester/AbstractRulesImpl.java +++ b/java/org/apache/tomcat/util/digester/AbstractRulesImpl.java @@ -132,6 +132,22 @@ abstract public class AbstractRulesImpl implements Rules { * in the order originally registered through the add() * method. * + * @param pattern Nesting pattern to be matched + * + * @deprecated Call match(namespaceURI,pattern) instead. + */ + public List match(String pattern) { + return match(namespaceURI, pattern); + } + + + /** + * Return a List of all registered Rule instances that match the specified + * nesting pattern, or a zero-length List if there are no matches. If more + * than one Rule instance matches, they must be returned + * in the order originally registered through the add() + * method. + * * @param namespaceURI Namespace URI for which to select matching rules, * or null to match regardless of namespace URI * @param pattern Nesting pattern to be matched diff --git a/java/org/apache/tomcat/util/digester/CallMethodRule.java b/java/org/apache/tomcat/util/digester/CallMethodRule.java index adb6e5b87..20c2039ce 100644 --- a/java/org/apache/tomcat/util/digester/CallMethodRule.java +++ b/java/org/apache/tomcat/util/digester/CallMethodRule.java @@ -74,6 +74,73 @@ public class CallMethodRule extends Rule { * Construct a "call method" rule with the specified method name. The * parameter types (if any) default to java.lang.String. * + * @param digester The associated Digester + * @param methodName Method name of the parent method to call + * @param paramCount The number of parameters to collect, or + * zero for a single argument from the body of this element. + * + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #CallMethodRule(String methodName,int paramCount)} instead. + */ + public CallMethodRule(Digester digester, String methodName, + int paramCount) { + + this(methodName, paramCount); + + } + + + /** + * Construct a "call method" rule with the specified method name. + * + * @param digester The associated Digester + * @param methodName Method name of the parent method to call + * @param paramCount The number of parameters to collect, or + * zero for a single argument from the body of ths element + * @param paramTypes The Java class names of the arguments + * (if you wish to use a primitive type, specify the corresonding + * Java wrapper class instead, such as java.lang.Boolean + * for a boolean parameter) + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #CallMethodRule(String methodName,int paramCount, String [] paramTypes)} instead. + */ + public CallMethodRule(Digester digester, String methodName, + int paramCount, String paramTypes[]) { + + this(methodName, paramCount, paramTypes); + + } + + + /** + * Construct a "call method" rule with the specified method name. + * + * @param digester The associated Digester + * @param methodName Method name of the parent method to call + * @param paramCount The number of parameters to collect, or + * zero for a single argument from the body of ths element + * @param paramTypes The Java classes that represent the + * parameter types of the method arguments + * (if you wish to use a primitive type, specify the corresonding + * Java wrapper class instead, such as java.lang.Boolean.TYPE + * for a boolean parameter) + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #CallMethodRule(String methodName,int paramCount, Class [] paramTypes)} instead. + */ + public CallMethodRule(Digester digester, String methodName, + int paramCount, Class paramTypes[]) { + + this(methodName, paramCount, paramTypes); + } + + + /** + * Construct a "call method" rule with the specified method name. The + * parameter types (if any) default to java.lang.String. + * * @param methodName Method name of the parent method to call * @param paramCount The number of parameters to collect, or * zero for a single argument from the body of this element. diff --git a/java/org/apache/tomcat/util/digester/CallParamRule.java b/java/org/apache/tomcat/util/digester/CallParamRule.java index 2cbf77d66..7f804610d 100644 --- a/java/org/apache/tomcat/util/digester/CallParamRule.java +++ b/java/org/apache/tomcat/util/digester/CallParamRule.java @@ -50,6 +50,41 @@ public class CallParamRule extends Rule { * Construct a "call parameter" rule that will save the body text of this * element as the parameter value. * + * @param digester The associated Digester + * @param paramIndex The zero-relative parameter number + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #CallParamRule(int paramIndex)} instead. + */ + public CallParamRule(Digester digester, int paramIndex) { + + this(paramIndex); + + } + + + /** + * Construct a "call parameter" rule that will save the value of the + * specified attribute as the parameter value. + * + * @param digester The associated Digester + * @param paramIndex The zero-relative parameter number + * @param attributeName The name of the attribute to save + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #CallParamRule(int paramIndex, String attributeName)} instead. + */ + public CallParamRule(Digester digester, int paramIndex, + String attributeName) { + + this(paramIndex, attributeName); + + } + + /** + * Construct a "call parameter" rule that will save the body text of this + * element as the parameter value. + * * @param paramIndex The zero-relative parameter number */ public CallParamRule(int paramIndex) { diff --git a/java/org/apache/tomcat/util/digester/Digester.java b/java/org/apache/tomcat/util/digester/Digester.java index 7e186a19c..6e88381ee 100644 --- a/java/org/apache/tomcat/util/digester/Digester.java +++ b/java/org/apache/tomcat/util/digester/Digester.java @@ -206,6 +206,13 @@ public class Digester extends DefaultHandler { protected SAXParserFactory factory = null; /** + * @deprecated This is now managed by {@link ParserFeatureSetterFactory} + */ + protected String JAXP_SCHEMA_LANGUAGE = + "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; + + + /** * The Locator associated with our parser. */ protected Locator locator = null; @@ -436,6 +443,37 @@ public class Digester extends DefaultHandler { /** + * Return the debugging detail level of our currently enabled logger. + * + * @deprecated This method now always returns 0. Digester uses the apache + * jakarta commons-logging library; see the documentation for that library + * for more information. + */ + public int getDebug() { + + return (0); + + } + + + /** + * Set the debugging detail level of our currently enabled logger. + * + * @param debug New debugging detail level (0=off, increasing integers + * for more detail) + * + * @deprecated This method now has no effect at all. Digester uses + * the apache jakarta comons-logging library; see the documentation + * for that library for more information. + */ + public void setDebug(int debug) { + + ; // No action is taken + + } + + + /** * Return the error handler for this Digester. */ public ErrorHandler getErrorHandler() { @@ -726,6 +764,25 @@ public class Digester extends DefaultHandler { /** + * By setting the reader in the constructor, you can bypass JAXP and + * be able to use digester in Weblogic 6.0. + * + * @deprecated Use getXMLReader() instead, which can throw a + * SAXException if the reader cannot be instantiated + */ + public XMLReader getReader() { + + try { + return (getXMLReader()); + } catch (SAXException e) { + log.error("Cannot get XMLReader", e); + return (null); + } + + } + + + /** * Return the Rules implementation object containing our * rules collection and associated matching policy. If none has been * established, a default implementation will be created and returned. @@ -1533,6 +1590,32 @@ public class Digester extends DefaultHandler { /** + * Log a message to our associated logger. + * + * @param message The message to be logged + * @deprecated Call getLogger() and use it's logging methods + */ + public void log(String message) { + + log.info(message); + + } + + + /** + * Log a message and exception to our associated logger. + * + * @param message The message to be logged + * @deprecated Call getLogger() and use it's logging methods + */ + public void log(String message, Throwable exception) { + + log.error(message, exception); + + } + + + /** * Parse the content of the specified file using this Digester. Returns * the root element from the object stack (if any). * @@ -2609,6 +2692,26 @@ public class Digester extends DefaultHandler { /** + * Return the set of rules that apply to the specified match position. + * The selected rules are those that match exactly, or those rules + * that specify a suffix match and the tail of the rule matches the + * current match position. Exact matches have precedence over + * suffix matches, then (among suffix matches) the longest match + * is preferred. + * + * @param match The current match position + * + * @deprecated Call match() on the Rules + * implementation returned by getRules() + */ + List getRules(String match) { + + return (getRules().match(match)); + + } + + + /** *

Return the top object on the parameters stack without removing it. If there are * no objects on the stack, return null.

* diff --git a/java/org/apache/tomcat/util/digester/FactoryCreateRule.java b/java/org/apache/tomcat/util/digester/FactoryCreateRule.java index c71ef7989..5634a4ec5 100644 --- a/java/org/apache/tomcat/util/digester/FactoryCreateRule.java +++ b/java/org/apache/tomcat/util/digester/FactoryCreateRule.java @@ -46,6 +46,103 @@ public class FactoryCreateRule extends Rule { /** + * Construct a factory create rule that will use the specified + * class name to create an {@link ObjectCreationFactory} which will + * then be used to create an object and push it on the stack. + * + * @param digester The associated Digester + * @param className Java class name of the object creation factory class + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #FactoryCreateRule(String className)} instead. + */ + public FactoryCreateRule(Digester digester, String className) { + + this(className); + + } + + + /** + * Construct a factory create rule that will use the specified + * class to create an {@link ObjectCreationFactory} which will + * then be used to create an object and push it on the stack. + * + * @param digester The associated Digester + * @param clazz Java class name of the object creation factory class + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #FactoryCreateRule(Class clazz)} instead. + */ + public FactoryCreateRule(Digester digester, Class clazz) { + + this(clazz); + + } + + + /** + * Construct a factory create rule that will use the specified + * class name (possibly overridden by the specified attribute if present) + * to create an {@link ObjectCreationFactory}, which will then be used + * to instantiate an object instance and push it onto the stack. + * + * @param digester The associated Digester + * @param className Default Java class name of the factory class + * @param attributeName Attribute name which, if present, contains an + * override of the class name of the object creation factory to create. + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #FactoryCreateRule(String className, String attributeName)} instead. + */ + public FactoryCreateRule(Digester digester, + String className, String attributeName) { + + this(className, attributeName); + + } + + + /** + * Construct a factory create rule that will use the specified + * class (possibly overridden by the specified attribute if present) + * to create an {@link ObjectCreationFactory}, which will then be used + * to instantiate an object instance and push it onto the stack. + * + * @param digester The associated Digester + * @param clazz Default Java class name of the factory class + * @param attributeName Attribute name which, if present, contains an + * override of the class name of the object creation factory to create. + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #FactoryCreateRule(Class clazz, String attributeName)} instead. + */ + public FactoryCreateRule(Digester digester, + Class clazz, String attributeName) { + + this(clazz, attributeName); + + } + + + /** + * Construct a factory create rule using the given, already instantiated, + * {@link ObjectCreationFactory}. + * + * @param digester The associated Digester + * @param creationFactory called on to create the object. + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #FactoryCreateRule(ObjectCreationFactory creationFactory)} instead. + */ + public FactoryCreateRule(Digester digester, + ObjectCreationFactory creationFactory) { + + this(creationFactory); + + } + + /** *

Construct a factory create rule that will use the specified * class name to create an {@link ObjectCreationFactory} which will * then be used to create an object and push it on the stack.

diff --git a/java/org/apache/tomcat/util/digester/ObjectCreateRule.java b/java/org/apache/tomcat/util/digester/ObjectCreateRule.java index def594e2d..d1c4fe40f 100644 --- a/java/org/apache/tomcat/util/digester/ObjectCreateRule.java +++ b/java/org/apache/tomcat/util/digester/ObjectCreateRule.java @@ -38,6 +38,78 @@ public class ObjectCreateRule extends Rule { /** * Construct an object create rule with the specified class name. * + * @param digester The associated Digester + * @param className Java class name of the object to be created + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #ObjectCreateRule(String className)} instead. + */ + public ObjectCreateRule(Digester digester, String className) { + + this(className); + + } + + + /** + * Construct an object create rule with the specified class. + * + * @param digester The associated Digester + * @param clazz Java class name of the object to be created + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #ObjectCreateRule(Class clazz)} instead. + */ + public ObjectCreateRule(Digester digester, Class clazz) { + + this(clazz); + + } + + + /** + * Construct an object create rule with the specified class name and an + * optional attribute name containing an override. + * + * @param digester The associated Digester + * @param className Java class name of the object to be created + * @param attributeName Attribute name which, if present, contains an + * override of the class name to create + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #ObjectCreateRule(String className, String attributeName)} instead. + */ + public ObjectCreateRule(Digester digester, String className, + String attributeName) { + + this (className, attributeName); + + } + + + /** + * Construct an object create rule with the specified class and an + * optional attribute name containing an override. + * + * @param digester The associated Digester + * @param attributeName Attribute name which, if present, contains an + * @param clazz Java class name of the object to be created + * override of the class name to create + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #ObjectCreateRule(String attributeName, Class clazz)} instead. + */ + public ObjectCreateRule(Digester digester, + String attributeName, + Class clazz) { + + this(attributeName, clazz); + + } + + /** + * Construct an object create rule with the specified class name. + * * @param className Java class name of the object to be created */ public ObjectCreateRule(String className) { diff --git a/java/org/apache/tomcat/util/digester/Rule.java b/java/org/apache/tomcat/util/digester/Rule.java index ffb10fa80..c20239cd0 100644 --- a/java/org/apache/tomcat/util/digester/Rule.java +++ b/java/org/apache/tomcat/util/digester/Rule.java @@ -35,6 +35,19 @@ public abstract class Rule { /** + * Constructor sets the associated Digester. + * + * @param digester The digester with which this rule is associated + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. Use {@link #Rule()} instead. + */ + public Rule(Digester digester) { + + super(); + setDigester(digester); + + } + + /** *

Base constructor. * Now the digester will be set when the rule is added.

*/ @@ -105,6 +118,22 @@ public abstract class Rule { /** * This method is called when the beginning of a matching XML element + * is encountered. + * + * @param attributes The attribute list of this element + * @deprecated Use the {@link #begin(String,String,Attributes) begin} + * method with namespace and name + * parameters instead. + */ + public void begin(Attributes attributes) throws Exception { + + ; // The default implementation does nothing + + } + + + /** + * This method is called when the beginning of a matching XML element * is encountered. The default implementation delegates to the deprecated * method {@link #begin(Attributes) begin} without the * namespace and name parameters, to retain @@ -121,7 +150,24 @@ public abstract class Rule { public void begin(String namespace, String name, Attributes attributes) throws Exception { - // The default implementation does nothing + begin(attributes); + + } + + + /** + * This method is called when the body of a matching XML element + * is encountered. If the element has no body, this method is + * not called at all. + * + * @param text The text of the body of this element + * @deprecated Use the {@link #body(String,String,String) body} method + * with namespace and name parameters + * instead. + */ + public void body(String text) throws Exception { + + ; // The default implementation does nothing } @@ -144,7 +190,21 @@ public abstract class Rule { public void body(String namespace, String name, String text) throws Exception { - // The default implementation does nothing + body(text); + + } + + + /** + * This method is called when the end of a matching XML element + * is encountered. + * + * @deprecated Use the {@link #end(String,String) end} method with + * namespace and name parameters instead. + */ + public void end() throws Exception { + + ; // The default implementation does nothing } @@ -166,7 +226,7 @@ public abstract class Rule { public void end(String namespace, String name) throws Exception { - // The default implementation does nothing + end(); } diff --git a/java/org/apache/tomcat/util/digester/Rules.java b/java/org/apache/tomcat/util/digester/Rules.java index 37878bcb6..13d9ed93c 100644 --- a/java/org/apache/tomcat/util/digester/Rules.java +++ b/java/org/apache/tomcat/util/digester/Rules.java @@ -94,6 +94,20 @@ public interface Rules { * in the order originally registered through the add() * method. * + * @param pattern Nesting pattern to be matched + * + * @deprecated Call match(namespaceURI,pattern) instead. + */ + public List match(String pattern); + + + /** + * Return a List of all registered Rule instances that match the specified + * nesting pattern, or a zero-length List if there are no matches. If more + * than one Rule instance matches, they must be returned + * in the order originally registered through the add() + * method. + * * @param namespaceURI Namespace URI for which to select matching rules, * or null to match regardless of namespace URI * @param pattern Nesting pattern to be matched diff --git a/java/org/apache/tomcat/util/digester/RulesBase.java b/java/org/apache/tomcat/util/digester/RulesBase.java index b9c4471a8..dd2375757 100644 --- a/java/org/apache/tomcat/util/digester/RulesBase.java +++ b/java/org/apache/tomcat/util/digester/RulesBase.java @@ -188,6 +188,24 @@ public class RulesBase implements Rules { * in the order originally registered through the add() * method. * + * @param pattern Nesting pattern to be matched + * + * @deprecated Call match(namespaceURI,pattern) instead. + */ + public List match(String pattern) { + + return (match(null, pattern)); + + } + + + /** + * Return a List of all registered Rule instances that match the specified + * nesting pattern, or a zero-length List if there are no matches. If more + * than one Rule instance matches, they must be returned + * in the order originally registered through the add() + * method. + * * @param namespaceURI Namespace URI for which to select matching rules, * or null to match regardless of namespace URI * @param pattern Nesting pattern to be matched diff --git a/java/org/apache/tomcat/util/digester/SetNextRule.java b/java/org/apache/tomcat/util/digester/SetNextRule.java index 1e6c9f43b..54063003f 100644 --- a/java/org/apache/tomcat/util/digester/SetNextRule.java +++ b/java/org/apache/tomcat/util/digester/SetNextRule.java @@ -44,6 +44,44 @@ public class SetNextRule extends Rule { * method's argument type is assumed to be the class of the * child object. * + * @param digester The associated Digester + * @param methodName Method name of the parent method to call + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #SetNextRule(String methodName)} instead. + */ + public SetNextRule(Digester digester, String methodName) { + + this(methodName); + + } + + + /** + * Construct a "set next" rule with the specified method name. + * + * @param digester The associated Digester + * @param methodName Method name of the parent method to call + * @param paramType Java class of the parent method's argument + * (if you wish to use a primitive type, specify the corresonding + * Java wrapper class instead, such as java.lang.Boolean + * for a boolean parameter) + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #SetNextRule(String methodName,String paramType)} instead. + */ + public SetNextRule(Digester digester, String methodName, + String paramType) { + + this(methodName, paramType); + + } + + /** + * Construct a "set next" rule with the specified method name. The + * method's argument type is assumed to be the class of the + * child object. + * * @param methodName Method name of the parent method to call */ public SetNextRule(String methodName) { diff --git a/java/org/apache/tomcat/util/digester/SetPropertiesRule.java b/java/org/apache/tomcat/util/digester/SetPropertiesRule.java index 744f851d2..e68bbf1d2 100644 --- a/java/org/apache/tomcat/util/digester/SetPropertiesRule.java +++ b/java/org/apache/tomcat/util/digester/SetPropertiesRule.java @@ -42,6 +42,21 @@ public class SetPropertiesRule extends Rule { /** + * Default constructor sets only the the associated Digester. + * + * @param digester The digester with which this rule is associated + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #SetPropertiesRule()} instead. + */ + public SetPropertiesRule(Digester digester) { + + this(); + + } + + + /** * Base constructor. */ public SetPropertiesRule() { diff --git a/java/org/apache/tomcat/util/digester/SetPropertyRule.java b/java/org/apache/tomcat/util/digester/SetPropertyRule.java index 2d0970765..f4b133ed7 100644 --- a/java/org/apache/tomcat/util/digester/SetPropertyRule.java +++ b/java/org/apache/tomcat/util/digester/SetPropertyRule.java @@ -39,6 +39,25 @@ public class SetPropertyRule extends Rule { * Construct a "set property" rule with the specified name and value * attributes. * + * @param digester The digester with which this rule is associated + * @param name Name of the attribute that will contain the name of the + * property to be set + * @param value Name of the attribute that will contain the value to which + * the property should be set + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #SetPropertyRule(String name, String value)} instead. + */ + public SetPropertyRule(Digester digester, String name, String value) { + + this(name, value); + + } + + /** + * Construct a "set property" rule with the specified name and value + * attributes. + * * @param name Name of the attribute that will contain the name of the * property to be set * @param value Name of the attribute that will contain the value to which diff --git a/java/org/apache/tomcat/util/digester/SetRootRule.java b/java/org/apache/tomcat/util/digester/SetRootRule.java index be18c5977..b801c5052 100644 --- a/java/org/apache/tomcat/util/digester/SetRootRule.java +++ b/java/org/apache/tomcat/util/digester/SetRootRule.java @@ -44,6 +44,44 @@ public class SetRootRule extends Rule { * method's argument type is assumed to be the class of the * child object. * + * @param digester The associated Digester + * @param methodName Method name of the parent method to call + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #SetRootRule(String methodName)} instead. + */ + public SetRootRule(Digester digester, String methodName) { + + this(methodName); + + } + + + /** + * Construct a "set root" rule with the specified method name. + * + * @param digester The associated Digester + * @param methodName Method name of the parent method to call + * @param paramType Java class of the parent method's argument + * (if you wish to use a primitive type, specify the corresonding + * Java wrapper class instead, such as java.lang.Boolean + * for a boolean parameter) + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #SetRootRule(String methodName,String paramType)} instead. + */ + public SetRootRule(Digester digester, String methodName, + String paramType) { + + this(methodName, paramType); + + } + + /** + * Construct a "set root" rule with the specified method name. The + * method's argument type is assumed to be the class of the + * child object. + * * @param methodName Method name of the parent method to call */ public SetRootRule(String methodName) { diff --git a/java/org/apache/tomcat/util/digester/SetTopRule.java b/java/org/apache/tomcat/util/digester/SetTopRule.java index 5bc956a62..08500cda3 100644 --- a/java/org/apache/tomcat/util/digester/SetTopRule.java +++ b/java/org/apache/tomcat/util/digester/SetTopRule.java @@ -44,6 +44,44 @@ public class SetTopRule extends Rule { * "set parent" method's argument type is assumed to be the class of the * parent object. * + * @param digester The associated Digester + * @param methodName Method name of the "set parent" method to call + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #SetTopRule(String methodName)} instead. + */ + public SetTopRule(Digester digester, String methodName) { + + this(methodName); + + } + + + /** + * Construct a "set parent" rule with the specified method name. + * + * @param digester The associated Digester + * @param methodName Method name of the "set parent" method to call + * @param paramType Java class of the "set parent" method's argument + * (if you wish to use a primitive type, specify the corresonding + * Java wrapper class instead, such as java.lang.Boolean + * for a boolean parameter) + * + * @deprecated The digester instance is now set in the {@link Digester#addRule} method. + * Use {@link #SetTopRule(String methodName, String paramType)} instead. + */ + public SetTopRule(Digester digester, String methodName, + String paramType) { + + this(methodName, paramType); + + } + + /** + * Construct a "set parent" rule with the specified method name. The + * "set parent" method's argument type is assumed to be the class of the + * parent object. + * * @param methodName Method name of the "set parent" method to call */ public SetTopRule(String methodName) { diff --git a/java/org/apache/tomcat/util/http/ServerCookie.java b/java/org/apache/tomcat/util/http/ServerCookie.java index e3a1595e3..6309561d7 100644 --- a/java/org/apache/tomcat/util/http/ServerCookie.java +++ b/java/org/apache/tomcat/util/http/ServerCookie.java @@ -211,6 +211,26 @@ public class ServerCookie implements Serializable { return true; } + /** + * @deprecated - Not used + */ + public static boolean checkName( String name ) { + if (!isToken(name) + || name.equalsIgnoreCase("Comment") // rfc2019 + || name.equalsIgnoreCase("Discard") // rfc2965 + || name.equalsIgnoreCase("Domain") // rfc2019 + || name.equalsIgnoreCase("Expires") // Netscape + || name.equalsIgnoreCase("Max-Age") // rfc2019 + || name.equalsIgnoreCase("Path") // rfc2019 + || name.equalsIgnoreCase("Secure") // rfc2019 + || name.equalsIgnoreCase("Version") // rfc2019 + // TODO remaining RFC2965 attributes + ) { + return false; + } + return true; + } + // -------------------- Cookie parsing tools @@ -324,6 +344,21 @@ public class ServerCookie implements Serializable { headerBuf.append(buf); } + /** + * @deprecated - Not used + */ + @Deprecated + public static void maybeQuote (int version, StringBuffer buf,String value) { + // special case - a \n or \r shouldn't happen in any case + if (isToken(value)) { + buf.append(value); + } else { + buf.append('"'); + buf.append(escapeDoubleQuotes(value,0,value.length())); + buf.append('"'); + } + } + public static boolean alreadyQuoted (String value) { if (value==null || value.length()==0) return false; return (value.charAt(0)=='\"' && value.charAt(value.length()-1)=='\"'); diff --git a/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java b/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java index 2cf3ad20e..860e630c1 100644 --- a/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java +++ b/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java @@ -224,7 +224,7 @@ public class BaseNotificationBroadcaster implements NotificationBroadcaster { private synchronized void registerNotifications( FixedNotificationFilter filter ) { String names[]=filter.getNames(); - Registry reg=Registry.getRegistry(null, null); + Registry reg=Registry.getRegistry(); for( int i=0; iMBeanServer instance. + * + * @since 1.0 + * @deprecated Use the instance method + */ + public static MBeanServer getServer() { + return Registry.getRegistry().getMBeanServer(); + } + + /** + * Set the MBeanServer to be utilized for our + * registered management beans. + * + * @param mbeanServer The new MBeanServer instance + * @since 1.0 + * @deprecated Use the instance method + */ + public static void setServer(MBeanServer mbeanServer) { + Registry.getRegistry().setMBeanServer(mbeanServer); + } + + /** + * Load the registry from the XML input found in the specified input + * stream. + * + * @param stream InputStream containing the registry configuration + * information + * + * @exception Exception if any parsing or processing error occurs + * @deprecated use normal class method instead + * @since 1.0 + */ + public static void loadRegistry(InputStream stream) throws Exception { + Registry registry = getRegistry(); + registry.loadMetadata(stream); + } + + /** Get a "singelton" registry, or one per thread if setUseContextLoader + * was called + * + * @deprecated Not enough info - use the method that takes CL and domain + * @since 1.0 + */ + public synchronized static Registry getRegistry() { + return getRegistry(null, null); + } + // -------------------- Helpers -------------------- /** Get the type of an attribute of the object, from the metadata. @@ -795,13 +846,15 @@ public class Registry implements RegistryMBean, MBeanRegistration { return; } - /** + /**Experimental. Will become private, some code may still use it + * * @param sourceType * @param source * @param param * @throws Exception + * @deprecated */ - private void loadDescriptors(String sourceType, Object source, String param) + public void loadDescriptors(String sourceType, Object source, String param) throws Exception { load(sourceType, source, param); } @@ -907,7 +960,6 @@ public class Registry implements RegistryMBean, MBeanRegistration { public void resetMetadata() { stop(); } - /** * Load the registry from the XML input found in the specified input * stream. @@ -922,6 +974,22 @@ public class Registry implements RegistryMBean, MBeanRegistration { loadDescriptors("MbeansDescriptorsDigesterSource", source, null ); } + /** @deprecated - may still be used in code using pre-1.1 builds + */ + public void registerComponent(Object bean, String domain, String type, + String name) + throws Exception + { + StringBuffer sb=new StringBuffer(); + sb.append( domain ).append(":"); + sb.append( name ); + String nameStr=sb.toString(); + ObjectName oname=new ObjectName( nameStr ); + registerComponent(bean, oname, type ); + } + + + // should be removed public void unregisterComponent( String domain, String name ) { try { @@ -934,4 +1002,19 @@ public class Registry implements RegistryMBean, MBeanRegistration { } } + + /** + * Load the registry from a cached .ser file. This is typically 2-3 times + * faster than parsing the XML. + * + * @param source Source to be used to load. Can be an InputStream or URL. + * + * @exception Exception if any parsing or processing error occurs + * @deprecated Loaded automatically or using a File or Url ending in .ser + */ + public void loadCachedDescriptors( Object source ) + throws Exception + { + loadDescriptors("MbeansDescriptorsSerSource", source, null ); + } } diff --git a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDOMSource.java b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDOMSource.java index 6429e76ae..f108d9f30 100644 --- a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDOMSource.java +++ b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDOMSource.java @@ -80,7 +80,7 @@ public class MbeansDescriptorsDOMSource extends ModelerSource } public void execute() throws Exception { - if( registry==null ) registry=Registry.getRegistry(null, null); + if( registry==null ) registry=Registry.getRegistry(); try { InputStream stream=(InputStream)source; diff --git a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java index b1813ca05..94ed10fbe 100644 --- a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java +++ b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java @@ -77,7 +77,7 @@ public class MbeansDescriptorsIntrospectionSource extends ModelerSource } public void execute() throws Exception { - if( registry==null ) registry=Registry.getRegistry(null, null); + if( registry==null ) registry=Registry.getRegistry(); try { ManagedBean managed = createManagedBean(registry, null, (Class)source, type); diff --git a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java index 10a73f834..53a302f31 100644 --- a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java +++ b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java @@ -70,7 +70,7 @@ public class MbeansDescriptorsSerSource extends ModelerSource } public void execute() throws Exception { - if( registry==null ) registry=Registry.getRegistry(null, null); + if( registry==null ) registry=Registry.getRegistry(); long t1=System.currentTimeMillis(); try { InputStream stream=null; diff --git a/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java b/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java index c95e52dd5..7362006b1 100644 --- a/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java +++ b/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java @@ -123,7 +123,7 @@ public class MbeansSource extends ModelerSource implements MbeansSourceMBean public void init() throws Exception { if( mbeans==null) execute(); - if( registry==null ) registry=Registry.getRegistry(null, null); + if( registry==null ) registry=Registry.getRegistry(); registry.invoke(mbeans, "init", false); } @@ -137,7 +137,7 @@ public class MbeansSource extends ModelerSource implements MbeansSourceMBean } public void execute() throws Exception { - if( registry==null ) registry=Registry.getRegistry(null, null); + if( registry==null ) registry=Registry.getRegistry(); try { InputStream stream=getInputStream(); long t1=System.currentTimeMillis(); @@ -160,8 +160,7 @@ public class MbeansSource extends ModelerSource implements MbeansSourceMBean firstMbeanN=descriptorsN; } - MBeanServer server = - Registry.getRegistry(null, null).getMBeanServer(); + MBeanServer server = Registry.getServer(); // XXX Not very clean... Just a workaround if( ! loaderLoaded ) { diff --git a/java/org/apache/tomcat/util/net/TcpConnectionHandler.java b/java/org/apache/tomcat/util/net/TcpConnectionHandler.java index 686d55f0d..b9096d4ca 100644 --- a/java/org/apache/tomcat/util/net/TcpConnectionHandler.java +++ b/java/org/apache/tomcat/util/net/TcpConnectionHandler.java @@ -28,6 +28,22 @@ package org.apache.tomcat.util.net; */ public interface TcpConnectionHandler { + /** Add informations about the a "controler" object + * specific to the server. In tomcat it will be a + * ContextManager. + * @deprecated This has nothing to do with TcpHandling, + * was used as a workaround + */ + public void setServer(Object manager); + + + /** Used to pass config informations to the handler. + * + * @deprecated This has nothing to do with Tcp, + * was used as a workaround. + */ + public void setAttribute(String name, Object value ); + /** Called before the call to processConnection. * If the thread is reused, init() should be called once per thread. * diff --git a/java/org/apache/tomcat/util/threads/ThreadPool.java b/java/org/apache/tomcat/util/threads/ThreadPool.java index e11810c69..899005fa1 100644 --- a/java/org/apache/tomcat/util/threads/ThreadPool.java +++ b/java/org/apache/tomcat/util/threads/ThreadPool.java @@ -525,6 +525,12 @@ public class ThreadPool { currentThreadCount = toOpen; } + /** @deprecated */ + void log( String s ) { + log.info(s); + //loghelper.flush(); + } + /** * Periodically execute an action - cleanup in this case */