Author: jochen
Date: Thu Oct  5 13:54:04 2006
New Revision: 453379

URL: http://svn.apache.org/viewvc?view=rev&rev=453379
Log:
The authentication handler, type converter and requestprocessor factories
are now configurable as properties of the XmlRpcServlet.
PR: XMLRPC-117
Submitted-By: Jimisola Laursen, [EMAIL PROTECTED]

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

Modified: 
webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/webserver/XmlRpcServlet.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/webserver/XmlRpcServlet.java?view=diff&rev=453379&r1=453378&r2=453379
==============================================================================
--- 
webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/webserver/XmlRpcServlet.java
 (original)
+++ 
webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/webserver/XmlRpcServlet.java
 Thu Oct  5 13:54:04 2006
@@ -28,10 +28,13 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.xmlrpc.XmlRpcConfig;
 import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.common.TypeConverterFactory;
 import org.apache.xmlrpc.server.PropertyHandlerMapping;
+import org.apache.xmlrpc.server.RequestProcessorFactoryFactory;
 import org.apache.xmlrpc.server.XmlRpcHandlerMapping;
 import org.apache.xmlrpc.server.XmlRpcServer;
 import org.apache.xmlrpc.server.XmlRpcServerConfigImpl;
+import org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping;
 
 
 /** <p>A default servlet implementation The typical use would
@@ -50,6 +53,9 @@
        private static final long serialVersionUID = 2348768267234L;
        private static final Log log = LogFactory.getLog(XmlRpcServlet.class);
     private XmlRpcServletServer server;
+    private AbstractReflectiveHandlerMapping.AuthenticationHandler 
authenticationHandler;
+    private RequestProcessorFactoryFactory requestProcessorFactoryFactory;
+    private TypeConverterFactory typeConverterFactory;
 
        /** Returns the servlets instance of [EMAIL PROTECTED] 
XmlRpcServletServer}. 
         * @return The configurable instance of [EMAIL PROTECTED] 
XmlRpcServletServer}.
@@ -61,7 +67,7 @@
        public void init(ServletConfig pConfig) throws ServletException {
                super.init(pConfig);
                try {
-                       server = newXmlRpcServer(pConfig);
+            server = newXmlRpcServer(pConfig);
             String enabledForExtensionsParam = 
pConfig.getInitParameter("enabledForExtensions");
             if (enabledForExtensionsParam != null) {
                 boolean b = 
Boolean.valueOf(enabledForExtensionsParam).booleanValue();
@@ -77,7 +83,43 @@
                }
        }
 
-       /** Creates a new instance of [EMAIL PROTECTED] XmlRpcServer},
+       /** Sets the servlets [EMAIL PROTECTED] 
AbstractReflectiveHandlerMapping.AuthenticationHandler}.
+        */
+       public void 
setAuthenticationHandler(AbstractReflectiveHandlerMapping.AuthenticationHandler 
pHandler) {
+           authenticationHandler = pHandler;
+       }
+
+       /** Returns the servlets [EMAIL PROTECTED] 
AbstractReflectiveHandlerMapping.AuthenticationHandler}.
+        */
+       public AbstractReflectiveHandlerMapping.AuthenticationHandler 
getAuthenticationHandler() {
+           return authenticationHandler;
+       }
+
+       /** Sets the servlets [EMAIL PROTECTED] RequestProcessorFactoryFactory}.
+        */
+       public void 
setRequestProcessorFactoryFactory(RequestProcessorFactoryFactory pFactory) {
+        requestProcessorFactoryFactory = pFactory;
+       }
+
+       /** Returns the servlets [EMAIL PROTECTED] 
RequestProcessorFactoryFactory}.
+        */
+       public RequestProcessorFactoryFactory 
getRequestProcessorFactoryFactory() {
+        return requestProcessorFactoryFactory;
+       }
+
+       /** Sets the servlets [EMAIL PROTECTED] TypeConverterFactory}.
+        */
+       public void setTypeConverterFactory(TypeConverterFactory pFactory) {
+           typeConverterFactory = pFactory;
+       }
+
+    /** Returns the servlets [EMAIL PROTECTED] TypeConverterFactory}.
+     */
+    public TypeConverterFactory getTypeConverterFactory() {
+        return typeConverterFactory;
+    }
+
+    /** Creates a new instance of [EMAIL PROTECTED] XmlRpcServer},
         * which is being used to process the requests. The default 
implementation
         * will simply invoke <code>new [EMAIL PROTECTED] XmlRpcServer}.
         */
@@ -108,7 +150,15 @@
         */
        protected PropertyHandlerMapping newPropertyHandlerMapping(URL url) 
throws IOException, XmlRpcException {
         PropertyHandlerMapping mapping = new PropertyHandlerMapping();
-        mapping.setTypeConverterFactory(server.getTypeConverterFactory());
+        mapping.setAuthenticationHandler(authenticationHandler);
+        if (requestProcessorFactoryFactory != null) {
+            
mapping.setRequestProcessorFactoryFactory(requestProcessorFactoryFactory);
+        }
+        if (typeConverterFactory != null) {
+            mapping.setTypeConverterFactory(typeConverterFactory);
+        } else {
+            mapping.setTypeConverterFactory(server.getTypeConverterFactory());
+        }
         mapping.load(Thread.currentThread().getContextClassLoader(), url);
         
mapping.setVoidMethodEnabled(server.getConfig().isEnabledForExtensions());
         return mapping;

Modified: webservices/xmlrpc/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/src/changes/changes.xml?view=diff&rev=453379&r1=453378&r2=453379
==============================================================================
--- webservices/xmlrpc/trunk/src/changes/changes.xml (original)
+++ webservices/xmlrpc/trunk/src/changes/changes.xml Thu Oct  5 13:54:04 2006
@@ -14,6 +14,11 @@
           due-to-email="[EMAIL PROTECTED]">
         Added PropertyHandlerMapping.load(ClassLoader, Map).
       </action>

+      <action dev="jochen" type="add" issue="XMLRPC-117" due-to="Jimisola 
Laursen"
+          due-to-email="[EMAIL PROTECTED]">
+        The authentication handler, type converter and requestprocessor 
factories
+        are now configurable as properties of the XmlRpcServlet.
+      </action>
     </release>

     <release version="3.0.1-SNAPSHOT" date="Not yet released">

       <action dev="jochen" type="fix">



Reply via email to