svn commit: r735066 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r735066 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java

jaz-3
Author: jaz
Date: Fri Jan 16 09:56:24 2009
New Revision: 735066

URL: http://svn.apache.org/viewvc?rev=735066&view=rev
Log:
added code to make a few properties configurable per instance (webapp) new context-param configurations available:

xmlrpc.enabledForExtensions (true|false)
xmlrpc.enabledForExceptions (true|false)

if the context-param does not exist, defaults will be used

Modified:
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java?rev=735066&r1=735065&r2=735066&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java Fri Jan 16 09:56:24 2009
@@ -39,7 +39,6 @@
 import java.io.*;
 import java.util.Map;
 import java.util.Locale;
-import java.util.Iterator;
 
 import javolution.util.FastMap;
 
@@ -52,12 +51,24 @@
     public static final String dispatcherName = "xmlrpc-dispatcher";
     protected GenericDelegator delegator;
     protected LocalDispatcher dispatcher;
+
+    private Boolean enabledForExtensions = null;
+    private Boolean enabledForExceptions = null;
             
     public void init(ServletContext context) throws EventHandlerException {
         String delegatorName = context.getInitParameter("entityDelegatorName");
         this.delegator = GenericDelegator.getGenericDelegator(delegatorName);
         this.dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, delegator);
-        this.setHandlerMapping(new ServiceRpcHandler());        
+        this.setHandlerMapping(new ServiceRpcHandler());
+
+        String extensionsEnabledString = context.getInitParameter("xmlrpc.enabledForExtensions");
+        if (UtilValidate.isNotEmpty(extensionsEnabledString)) {
+            enabledForExtensions = Boolean.valueOf(extensionsEnabledString);
+        }
+        String exceptionsEnabledString = context.getInitParameter("xmlrpc.enabledForExceptions");
+        if (UtilValidate.isNotEmpty(exceptionsEnabledString)) {
+            enabledForExceptions = Boolean.valueOf(exceptionsEnabledString);
+        }
     }
 
     public String invoke(String eventPath, String eventMethod, HttpServletRequest request, HttpServletResponse response) throws EventHandlerException {
@@ -120,7 +131,14 @@
         result.setEncoding(req.getCharacterEncoding());
         //result.setEnabledForExceptions(serverConfig.isEnabledForExceptions());
         HttpUtil.parseAuthorization(result, req.getHeader("Authorization"));
-        
+
+        // context overrides
+        if (enabledForExtensions != null) {
+            result.setEnabledForExtensions(enabledForExtensions);
+        }
+        if (enabledForExceptions != null) {
+            result.setEnabledForExtensions(enabledForExceptions);
+        }
         return result;
     }