Use original query string of forwarded request
Prior to this commit, the AbstractFlashMapManager has used the originating URI but the query string of the forwarded request. That resulted to FlashMap not being matched even when both originating URI and query string matched the FlashMap attributes. The originating query string is now used to match the forwarded request. Issue: SPR-15505
This commit is contained in:
committed by
Rossen Stoyanchev
parent
44c31a6aad
commit
bf83e4e861
@@ -318,6 +318,26 @@ public class FlashMapManagerTests {
|
||||
assertEquals("value", flashMap.get("key"));
|
||||
}
|
||||
|
||||
// SPR-15505
|
||||
|
||||
@Test
|
||||
public void retrieveAndUpdateMatchByOriginatingPathAndQueryString() {
|
||||
FlashMap flashMap = new FlashMap();
|
||||
flashMap.put("key", "value");
|
||||
flashMap.setTargetRequestPath("/accounts");
|
||||
flashMap.addTargetRequestParam("a", "b");
|
||||
|
||||
this.flashMapManager.setFlashMaps(Arrays.asList(flashMap));
|
||||
|
||||
this.request.setAttribute(WebUtils.FORWARD_REQUEST_URI_ATTRIBUTE, "/accounts");
|
||||
this.request.setAttribute(WebUtils.FORWARD_QUERY_STRING_ATTRIBUTE, "a=b");
|
||||
this.request.setRequestURI("/mvc/accounts");
|
||||
this.request.setQueryString("x=y");
|
||||
FlashMap inputFlashMap = this.flashMapManager.retrieveAndUpdate(this.request, this.response);
|
||||
|
||||
assertEquals(flashMap, inputFlashMap);
|
||||
assertEquals("Input FlashMap should have been removed", 0, this.flashMapManager.getFlashMaps().size());
|
||||
}
|
||||
|
||||
private static class TestFlashMapManager extends AbstractFlashMapManager {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user