Author: jleroux
Date: Tue Aug 28 16:06:23 2018 New Revision: 1839451 URL: http://svn.apache.org/viewvc?rev=1839451&view=rev Log: Fixed: Add method attribute to request-map to controll a uri can be called GET or POST only (OFBIZ-10438) The problem was r1838081 prevented to serialise requests. Like in ordermgr/control/updateCheckoutOptions/quickcheckout where updateCheckoutOptions and quickcheckout are serialised to update the check out after updateCheckoutOptions is done and then get back to the screen with quickcheckout. CheckoutOptions.ftl is a good example of this usage. Thanks: Deepak Nigam for initial report and Mathieu for fixing it Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/RequestHandlerTests.java Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java?rev=1839451&r1=1839450&r2=1839451&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java Tue Aug 28 16:06:23 2018 @@ -194,7 +194,9 @@ public class RequestHandler { String requestUri = getRequestUri(path); String viewUri = getOverrideViewUri(path); Collection<RequestMap> rmaps; - if (requestMapMap.containsKey(requestUri) && !viewMapMap.containsKey(viewUri)) { + if (requestMapMap.containsKey(requestUri) + // Ensure that overridden view exists. + && (viewUri == null || viewMapMap.containsKey(viewUri))) { rmaps = requestMapMap.get(requestUri); } else if (defaultRequest != null) { rmaps = requestMapMap.get(defaultRequest); Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/RequestHandlerTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/RequestHandlerTests.java?rev=1839451&r1=1839450&r2=1839451&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/RequestHandlerTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/RequestHandlerTests.java Tue Aug 28 16:06:23 2018 @@ -120,7 +120,7 @@ public class RequestHandlerTests { } @Test - public void resolveURIOverrideView() throws Exception { + public void resolveURIBasicOverrideView() throws Exception { RequestMap foo = new RequestMap(dummyElement); RequestMap bar = new RequestMap(dummyElement); reqMaps.putSingle("foo", foo); @@ -130,6 +130,18 @@ public class RequestHandlerTests { when(req.getPathInfo()).thenReturn("/foo/baz"); when(ccfg.getDefaultRequest()).thenReturn("bar"); + assertThat(RequestHandler.resolveURI(ccfg, req), hasItem(foo)); + } + + @Test + public void resolveURIMissingOverrideView() throws Exception { + RequestMap foo = new RequestMap(dummyElement); + RequestMap bar = new RequestMap(dummyElement); + reqMaps.putSingle("foo", foo); + reqMaps.putSingle("bar", bar); + + when(req.getPathInfo()).thenReturn("/foo/baz"); + when(ccfg.getDefaultRequest()).thenReturn("bar"); assertThat(RequestHandler.resolveURI(ccfg, req), hasItem(bar)); } |
Free forum by Nabble | Edit this page |