tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r586738 - in /tomcat/tc6.0.x/trunk: ./ java/org/apache/catalina/connector/ java/org/apache/catalina/ha/tcp/ java/org/apache/catalina/ha/util/ java/org/apache/catalina/startup/ java/org/apache/coyote/http11/ java/org/apache/tomcat/util/ java...
Date Sat, 20 Oct 2007 14:57:19 GMT
Author: fhanik
Date: Sat Oct 20 07:57:18 2007
New Revision: 586738

URL: http://svn.apache.org/viewvc?rev=586738&view=rev
Log:
Added NIO connector to server.xml parser warnings

Modified:
    tomcat/tc6.0.x/trunk/STATUS
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Connector.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/util/IDynamicProperty.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/Embedded.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
    tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
    tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS?rev=586738&r1=586737&r2=586738&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS (original)
+++ tomcat/tc6.0.x/trunk/STATUS Sat Oct 20 07:57:18 2007
@@ -25,13 +25,6 @@
 PATCHES PROPOSED TO BACKPORT:
   [ New proposals should be added at the end of the list ]
 
-* Make server.xml parsing warnings more generic, add support for the NIO connector
-* Connector is no longer an exception case. Any new component can still use setProperty and
return a boolean 
-* to accept or reject the property
-  http://people.apache.org/~fhanik/patches/digester-attribute-warnings.patch
-  +1: fhanik, yoavs,funkman
-  -1: 
-  
 * IcedTea support. Upcoming Linux distributions will package a (working) open source JRE,
   available in /usr. As a result, it could now be possible to use a "/usr/bin/java" binary
   if one is present and expect results. [tested on Fedora 8 test 3]

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Connector.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Connector.java?rev=586738&r1=586737&r2=586738&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Connector.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Connector.java Sat Oct 20 07:57:18
2007
@@ -313,29 +313,14 @@
     /**
      * Set a configured property.
      */
-    public void setProperty(String name, String value) {
+    public boolean setProperty(String name, String value) {
         String repl = name;
         if (replacements.get(name) != null) {
             repl = (String) replacements.get(name);
         }
-        if (!IntrospectionUtils.setProperty(protocolHandler, repl, value)) {
-            log.warn("Property " + name + " not found on the protocol handler.");
-        }
-    }
-
-
-    /**
-     * Set a configured property.
-     */
-    public void setPropertyInternal(String name, String value) {
-        String repl = name;
-        if (replacements.get(name) != null) {
-            repl = (String) replacements.get(name);
-        }
-        IntrospectionUtils.setProperty(protocolHandler, repl, value);
+        return IntrospectionUtils.setProperty(protocolHandler, repl, value);
     }
 
-
     /**
      * Return a configured property.
      */
@@ -402,7 +387,7 @@
     public void setAllowTrace(boolean allowTrace) {
 
         this.allowTrace = allowTrace;
-        setPropertyInternal("allowTrace", String.valueOf(allowTrace));
+        setProperty("allowTrace", String.valueOf(allowTrace));
 
     }
 
@@ -480,7 +465,7 @@
     public void setEmptySessionPath(boolean emptySessionPath) {
 
         this.emptySessionPath = emptySessionPath;
-        setPropertyInternal("emptySessionPath", String.valueOf(emptySessionPath));
+        setProperty("emptySessionPath", String.valueOf(emptySessionPath));
 
     }
 
@@ -503,7 +488,7 @@
     public void setEnableLookups(boolean enableLookups) {
 
         this.enableLookups = enableLookups;
-        setPropertyInternal("enableLookups", String.valueOf(enableLookups));
+        setProperty("enableLookups", String.valueOf(enableLookups));
 
     }
 
@@ -573,7 +558,7 @@
     public void setMaxSavePostSize(int maxSavePostSize) {
 
         this.maxSavePostSize = maxSavePostSize;
-        setPropertyInternal("maxSavePostSize", String.valueOf(maxSavePostSize));
+        setProperty("maxSavePostSize", String.valueOf(maxSavePostSize));
     }
 
 
@@ -595,7 +580,7 @@
     public void setPort(int port) {
 
         this.port = port;
-        setPropertyInternal("port", String.valueOf(port));
+        setProperty("port", String.valueOf(port));
 
     }
 
@@ -759,7 +744,7 @@
 
         if(proxyName != null && proxyName.length() > 0) {
             this.proxyName = proxyName;
-            setPropertyInternal("proxyName", proxyName);
+            setProperty("proxyName", proxyName);
         } else {
             this.proxyName = null;
             removeProperty("proxyName");
@@ -786,7 +771,7 @@
     public void setProxyPort(int proxyPort) {
 
         this.proxyPort = proxyPort;
-        setPropertyInternal("proxyPort", String.valueOf(proxyPort));
+        setProperty("proxyPort", String.valueOf(proxyPort));
 
     }
 
@@ -811,7 +796,7 @@
     public void setRedirectPort(int redirectPort) {
 
         this.redirectPort = redirectPort;
-        setPropertyInternal("redirectPort", String.valueOf(redirectPort));
+        setProperty("redirectPort", String.valueOf(redirectPort));
 
     }
 
@@ -860,7 +845,7 @@
     public void setSecure(boolean secure) {
 
         this.secure = secure;
-        setPropertyInternal("secure", Boolean.toString(secure));
+        setProperty("secure", Boolean.toString(secure));
     }
 
      /**
@@ -881,7 +866,7 @@
      public void setURIEncoding(String URIEncoding) {
 
          this.URIEncoding = URIEncoding;
-         setPropertyInternal("uRIEncoding", URIEncoding);
+         setProperty("uRIEncoding", URIEncoding);
 
      }
 
@@ -904,7 +889,7 @@
      public void setUseBodyEncodingForURI(boolean useBodyEncodingForURI) {
 
          this.useBodyEncodingForURI = useBodyEncodingForURI;
-         setPropertyInternal
+         setProperty
              ("useBodyEncodingForURI", String.valueOf(useBodyEncodingForURI));
 
      }
@@ -932,7 +917,7 @@
      */
     public void setXpoweredBy(boolean xpoweredBy) {
         this.xpoweredBy = xpoweredBy;
-        setPropertyInternal("xpoweredBy", String.valueOf(xpoweredBy));
+        setProperty("xpoweredBy", String.valueOf(xpoweredBy));
     }
 
     /**
@@ -943,7 +928,7 @@
      */
     public void setUseIPVHosts(boolean useIPVHosts) {
         this.useIPVHosts = useIPVHosts;
-        setPropertyInternal("useIPVHosts", String.valueOf(useIPVHosts));
+        setProperty("useIPVHosts", String.valueOf(useIPVHosts));
     }
 
     /**

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java?rev=586738&r1=586737&r2=586738&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java Sat Oct 20
07:57:18 2007
@@ -406,8 +406,8 @@
      * @param name
      * @param value
      */
-    public void setProperty(String name, String value) {
-        setProperty(name, (Object) value);
+    public boolean setProperty(String name, String value) {
+        return setProperty(name, (Object) value);
     }
 
     /**
@@ -416,29 +416,9 @@
      * @param name
      * @param value
      */
-    public void setProperty(String name, Object value) {
-        if (log.isTraceEnabled())
-            log.trace(sm.getString("SimpleTcpCluster.setProperty", name, value,properties.get(name)));
+    public boolean setProperty(String name, Object value) {
         properties.put(name, value);
-        //using a dynamic way of setting properties is nice, but a security risk
-        //if exposed through JMX. This way you can sit and try to guess property names,
-        //we will only allow explicit property names
-        log.warn("Dynamic setProperty("+name+",value) has been disabled, please use explicit
properties for the element you are trying to identify");
-        if(started) {
-            // FIXME Hmm, is that correct when some DeltaManagers are direct configured inside
Context?
-            // Why we not support it for other elements, like sender, receiver or membership?
-            // Must we restart element after change?
-//            if (name.startsWith("manager")) {
-//                String key = name.substring("manager".length() + 1);
-//                String pvalue = value.toString();
-//                for (Iterator iter = managers.values().iterator(); iter.hasNext();) {
-//                    Manager manager = (Manager) iter.next();
-//                    if(manager instanceof DeltaManager && ((ClusterManager) manager).isDefaultMode())
{
-//                        IntrospectionUtils.setProperty(manager, key, pvalue );
-//                    }
-//                }
-//            } 
-        }
+        return false;
     }
 
     /**

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/util/IDynamicProperty.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/util/IDynamicProperty.java?rev=586738&r1=586737&r2=586738&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/util/IDynamicProperty.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/util/IDynamicProperty.java Sat Oct 20
07:57:18 2007
@@ -32,7 +32,7 @@
      * @param name
      * @param value
      */
-    public void setProperty(String name, Object value) ;
+    public boolean setProperty(String name, Object value) ;
 
     /**
      * get current config

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/Embedded.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/Embedded.java?rev=586738&r1=586737&r2=586738&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/Embedded.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/Embedded.java Sat Oct 20 07:57:18
2007
@@ -427,7 +427,7 @@
                 connector = new Connector();
                 connector.setScheme("https");
                 connector.setSecure(true);
-                connector.setPropertyInternal("SSLEnabled","true");
+                connector.setProperty("SSLEnabled","true");
                 // FIXME !!!! SET SSL PROPERTIES
             } else {
                 connector = new Connector(protocol);

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=586738&r1=586737&r2=586738&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Sat Oct 20 07:57:18
2007
@@ -94,13 +94,13 @@
     /**
      * Set a property.
      */
-    public void setProperty(String name, String value) {
+    public boolean setProperty(String name, String value) {
+        setAttribute(name, value);
         if ( name!=null && (name.startsWith("socket.") ||name.startsWith("selectorPool."))
){
-            ep.setProperty(name, value);
+            return ep.setProperty(name, value);
         } else {
-            ep.setProperty(name,value); //make sure we at least try to set all properties
+            return ep.setProperty(name,value); //make sure we at least try to set all properties
         }
-        setAttribute(name, value);
     }
 
     /**

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java?rev=586738&r1=586737&r2=586738&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java Sat Oct 20 07:57:18
2007
@@ -266,7 +266,8 @@
 
         try {
             Method methods[] = findMethods(o.getClass());
-            Method setPropertyMethod = null;
+            Method setPropertyMethodVoid = null;
+            Method setPropertyMethodBool = null;
 
             // First, the ideal case - a setFoo( String ) method
             for (int i = 0; i < methods.length; i++) {
@@ -334,17 +335,37 @@
 
                 // save "setProperty" for later
                 if ("setProperty".equals(methods[i].getName())) {
-                    setPropertyMethod = methods[i];
+                    if (methods[i].getReturnType()==Boolean.TYPE){
+                        setPropertyMethodBool = methods[i];
+                    }else {
+                        setPropertyMethodVoid = methods[i];    
+                    }
+                    
                 }
             }
 
             // Ok, no setXXX found, try a setProperty("name", "value")
-            if (setPropertyMethod != null) {
+            if (setPropertyMethodBool != null || setPropertyMethodVoid != null) {
                 Object params[] = new Object[2];
                 params[0] = name;
                 params[1] = value;
-                setPropertyMethod.invoke(o, params);
-                return true;
+                if (setPropertyMethodBool != null) {
+                    try {
+                        return (Boolean) setPropertyMethodBool.invoke(o, params);
+                    }catch (IllegalArgumentException biae) {
+                        //the boolean method had the wrong
+                        //parameter types. lets try the other
+                        if (setPropertyMethodVoid!=null) {
+                            setPropertyMethodVoid.invoke(o, params);
+                            return true;
+                        }else {
+                            throw biae;
+                        }
+                    }
+                } else {
+                    setPropertyMethodVoid.invoke(o, params);
+                    return true;
+                }
             }
 
         } catch (IllegalArgumentException ex2) {

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=586738&r1=586737&r2=586738&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Sat Oct 20 07:57:18
2007
@@ -510,19 +510,20 @@
     /**
      * Generic properties, introspected
      */
-    public void setProperty(String name, String value) {
+    public boolean setProperty(String name, String value) {
         final String selectorPoolName = "selectorPool.";
         final String socketName = "socket.";
         try {
             if (name.startsWith(selectorPoolName)) {
-                IntrospectionUtils.setProperty(selectorPool, name.substring(selectorPoolName.length()),
value);
+                return IntrospectionUtils.setProperty(selectorPool, name.substring(selectorPoolName.length()),
value);
             } else if (name.startsWith(socketName)) {
-                IntrospectionUtils.setProperty(socketProperties, name.substring(socketName.length()),
value);
+                return IntrospectionUtils.setProperty(socketProperties, name.substring(socketName.length()),
value);
             } else {
-                IntrospectionUtils.setProperty(this,name,value);
+                return IntrospectionUtils.setProperty(this,name,value);
             }
         }catch ( Exception x ) {
             log.error("Unable to set attribute \""+name+"\" to \""+value+"\"",x);
+            return false;
         }
     }
 

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=586738&r1=586737&r2=586738&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Sat Oct 20 07:57:18 2007
@@ -45,6 +45,7 @@
   </subsection>
   <subsection name="Catalina">
     <changelog>
+      <update>Add NIO connector to server.xml parsing warning, remove Connector as
exception case</update>
       <fix><bug>43653</bug>Fix SSL buffer mixup when response is unable
to write more than socket buffer can handle</fix>
       <fix><bug>43643</bug>If connector doesn't support external executor,
display warning</fix>
       <fix><bug>43641</bug>Property bind multicast address for cluster
membership</fix>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message