Author: jleroux
Date: Sat Oct 19 06:58:10 2019 New Revision: 1868613 URL: http://svn.apache.org/viewvc?rev=1868613&view=rev Log: "Applied fix from trunk for revision: 1868611" ------------------------------------------------------------------------ r1868611 | jleroux | 2019-10-19 08:42:07 +0200 (sam. 19 oct. 2019) | 11 lignes Improved: Handling tenant in XmlRpcEventHandler (OFBIZ-10284) The XMLRPC service does not support tenants. Even if the tenant domain is included in the HTTP request the call does not affect the correct tenant. The issue and fix has been discussed in in the thread https://markmail.org/message/bz4dofrxqp6i7ove jleroux: I was able to port the R16 patch provided by Rajesh to the trunk. Thanks: Rajesh Kumar Mallah ------------------------------------------------------------------------ Modified: ofbiz/ofbiz-framework/branches/release17.12/ (props changed) ofbiz/ofbiz-framework/branches/release17.12/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/XmlRpcEventHandler.java Propchange: ofbiz/ofbiz-framework/branches/release17.12/ ------------------------------------------------------------------------------ Merged /ofbiz/ofbiz-framework/trunk:r1868611 Modified: ofbiz/ofbiz-framework/branches/release17.12/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/XmlRpcEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/XmlRpcEventHandler.java?rev=1868613&r1=1868612&r2=1868613&view=diff ============================================================================== --- ofbiz/ofbiz-framework/branches/release17.12/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/XmlRpcEventHandler.java (original) +++ ofbiz/ofbiz-framework/branches/release17.12/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/XmlRpcEventHandler.java Sat Oct 19 06:58:10 2019 @@ -75,7 +75,6 @@ import org.xml.sax.XMLReader; public class XmlRpcEventHandler extends XmlRpcHttpServer implements EventHandler { public static final String module = XmlRpcEventHandler.class.getName(); - protected Delegator delegator; protected LocalDispatcher dispatcher; private Boolean enabledForExtensions = null; @@ -83,7 +82,7 @@ public class XmlRpcEventHandler extends public void init(ServletContext context) throws EventHandlerException { String delegatorName = context.getInitParameter("entityDelegatorName"); - this.delegator = DelegatorFactory.getDelegator(delegatorName); + Delegator delegator = DelegatorFactory.getDelegator(delegatorName); this.dispatcher = ServiceContainer.getLocalDispatcher(delegator.getDelegatorName(), delegator); this.setHandlerMapping(new ServiceRpcHandler()); @@ -159,7 +158,7 @@ public class XmlRpcEventHandler extends } protected XmlRpcHttpRequestConfig getXmlRpcConfig(HttpServletRequest req) { - XmlRpcHttpRequestConfigImpl result = new XmlRpcHttpRequestConfigImpl(); + OFBizXmlRpcHttpRequestConfigImpl result = new OFBizXmlRpcHttpRequestConfigImpl(req); XmlRpcHttpServerConfig serverConfig = (XmlRpcHttpServerConfig) getConfig(); result.setBasicEncoding(serverConfig.getBasicEncoding()); @@ -184,7 +183,8 @@ public class XmlRpcEventHandler extends class OfbizRpcAuthHandler implements AbstractReflectiveHandlerMapping.AuthenticationHandler { public boolean isAuthorized(XmlRpcRequest xmlRpcReq) throws XmlRpcException { - XmlRpcHttpRequestConfig config = (XmlRpcHttpRequestConfig) xmlRpcReq.getConfig(); + OFBizXmlRpcHttpRequestConfigImpl config = (OFBizXmlRpcHttpRequestConfigImpl) xmlRpcReq.getConfig(); + LocalDispatcher dispatcher = config.getDispatcher(); ModelService model; try { @@ -324,6 +324,10 @@ public class XmlRpcEventHandler extends } public Object execute(XmlRpcRequest xmlRpcReq) throws XmlRpcException { + + OFBizXmlRpcHttpRequestConfigImpl requestConfig = (OFBizXmlRpcHttpRequestConfigImpl) xmlRpcReq.getConfig(); + LocalDispatcher dispatcher = requestConfig.getDispatcher(); + DispatchContext dctx = dispatcher.getDispatchContext(); String serviceName = xmlRpcReq.getMethodName(); ModelService model = null; @@ -373,6 +377,8 @@ public class XmlRpcEventHandler extends protected Map<String, Object> getContext(XmlRpcRequest xmlRpcReq, String serviceName) throws XmlRpcException { ModelService model; + OFBizXmlRpcHttpRequestConfigImpl requestConfig = (OFBizXmlRpcHttpRequestConfigImpl) xmlRpcReq.getConfig(); + LocalDispatcher dispatcher = requestConfig.getDispatcher(); try { model = dispatcher.getDispatchContext().getModelService(serviceName); } catch (GenericServiceException e) { @@ -451,4 +457,18 @@ public class XmlRpcEventHandler extends response.getOutputStream().close(); } } + + class OFBizXmlRpcHttpRequestConfigImpl extends XmlRpcHttpRequestConfigImpl { + private LocalDispatcher dispatcher; + + public OFBizXmlRpcHttpRequestConfigImpl (HttpServletRequest request) { + dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + } + + public LocalDispatcher getDispatcher() { + return dispatcher; + } + } + + } |
Free forum by Nabble | Edit this page |