Author: jochen
Date: Sun Nov 12 06:56:20 2006
New Revision: 473969

URL: http://svn.apache.org/viewvc?view=rev&rev=473969
Log:
Introduced the method AbstractReflectiveHandlerMapping.isHandlerMethod().
This should allow users to prevent remote invocation of certain methods,
for example initialization stuff.

Modified:
    
webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/AbstractReflectiveHandlerMapping.java
    webservices/xmlrpc/trunk/src/changes/changes.xml

Modified: 
webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/AbstractReflectiveHandlerMapping.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/AbstractReflectiveHandlerMapping.java?view=diff&rev=473969&r1=473968&r2=473969
==============================================================================
--- 
webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/AbstractReflectiveHandlerMapping.java
 (original)
+++ 
webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/AbstractReflectiveHandlerMapping.java
 Sun Nov 12 06:56:20 2006
@@ -96,6 +96,22 @@
         authenticationHandler = pAuthenticationHandler;
     }
 
+    protected boolean isHandlerMethod(Method pMethod) {
+        if (!Modifier.isPublic(pMethod.getModifiers())) {
+            return false;  // Ignore methods, which aren't public
+        }
+        if (Modifier.isStatic(pMethod.getModifiers())) {
+            return false;  // Ignore methods, which are static
+        }
+        if (!isVoidMethodEnabled()  &&  pMethod.getReturnType() == void.class) 
{
+            return false;  // Ignore void methods.
+        }
+        if (pMethod.getDeclaringClass() == Object.class) {
+            return false;  // Ignore methods from Object.class
+        }
+        return true;
+    }
+
     /** Searches for methods in the given class. For any valid
      * method, it creates an instance of [EMAIL PROTECTED] XmlRpcHandler}.
      * Valid methods are defined as follows:
@@ -119,17 +135,8 @@
         Method[] methods = pType.getMethods();
         for (int i = 0;  i < methods.length;  i++) {
             final Method method = methods[i];
-            if (!Modifier.isPublic(method.getModifiers())) {
-                continue;  // Ignore methods, which aren't public
-            }
-            if (Modifier.isStatic(method.getModifiers())) {
-                continue;  // Ignore methods, which are static
-            }
-            if (!isVoidMethodEnabled()  &&  method.getReturnType() == 
void.class) {
-                continue;  // Ignore void methods.
-            }
-            if (method.getDeclaringClass() == Object.class) {
-                continue;  // Ignore methods from Object.class
+            if (!isHandlerMethod(method)) {
+                continue;
             }
             String name = pKey + "." + method.getName();
             Method[] mArray;

Modified: webservices/xmlrpc/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/src/changes/changes.xml?view=diff&rev=473969&r1=473968&r2=473969
==============================================================================
--- webservices/xmlrpc/trunk/src/changes/changes.xml (original)
+++ webservices/xmlrpc/trunk/src/changes/changes.xml Sun Nov 12 06:56:20 2006
@@ -34,6 +34,11 @@
                to the configuration only, and not to the XmlRpcServlet, or the
                XmlRpcServletServer.
       </action>
+      <action dev="jochen" type="add">
+        Introduced the method 
AbstractReflectiveHandlerMapping.isHandlerMethod().
+        This should allow users to prevent remote invocation of certain 
methods,
+        for example initialization stuff.
+      </action>
     </release>
     <release version="3.0.1-SNAPSHOT" date="Not yet released">
       <action dev="jochen" type="fix">


Reply via email to