Examples of FlashMap


Examples of org.springframework.web.servlet.FlashMap

    this.response = new MockHttpServletResponse();
  }

  @Test
  public void retrieveAndUpdateMatchByPath() {
    FlashMap flashMap = new FlashMap();
    flashMap.put("key", "value");
    flashMap.setTargetRequestPath("/path");

    this.flashMapManager.setFlashMaps(flashMap);

    this.request.setRequestURI("/path");
    FlashMap inputFlashMap = this.flashMapManager.retrieveAndUpdate(this.request, this.response);

    assertEquals(flashMap, inputFlashMap);
  }
View Full Code Here

Examples of org.springframework.web.servlet.FlashMap

  // SPR-8779

  @Test
  public void retrieveAndUpdateMatchByOriginatingPath() {
    FlashMap flashMap = new FlashMap();
    flashMap.put("key", "value");
    flashMap.setTargetRequestPath("/accounts");

    this.flashMapManager.setFlashMaps(flashMap);

    this.request.setAttribute(WebUtils.FORWARD_REQUEST_URI_ATTRIBUTE, "/accounts");
    this.request.setRequestURI("/mvc/accounts");
    FlashMap inputFlashMap = this.flashMapManager.retrieveAndUpdate(this.request, this.response);

    assertEquals(flashMap, inputFlashMap);
    assertEquals("Input FlashMap should have been removed", 0, this.flashMapManager.getFlashMaps().size());
  }
View Full Code Here

Examples of org.springframework.web.servlet.FlashMap

    assertEquals("Input FlashMap should have been removed", 0, this.flashMapManager.getFlashMaps().size());
  }

  @Test
  public void retrieveAndUpdateMatchWithTrailingSlash() {
    FlashMap flashMap = new FlashMap();
    flashMap.put("key", "value");
    flashMap.setTargetRequestPath("/path");

    this.flashMapManager.setFlashMaps(flashMap);

    this.request.setRequestURI("/path/");
    FlashMap inputFlashMap = this.flashMapManager.retrieveAndUpdate(this.request, this.response);

    assertEquals(flashMap, inputFlashMap);
    assertEquals("Input FlashMap should have been removed", 0, this.flashMapManager.getFlashMaps().size());
  }
View Full Code Here

Examples of org.springframework.web.servlet.FlashMap

    assertEquals("Input FlashMap should have been removed", 0, this.flashMapManager.getFlashMaps().size());
  }

  @Test
  public void retrieveAndUpdateMatchByParams() {
    FlashMap flashMap = new FlashMap();
    flashMap.put("key", "value");
    flashMap.addTargetRequestParam("number", "one");

    this.flashMapManager.setFlashMaps(flashMap);

    this.request.setParameter("number", (String) null);
    FlashMap inputFlashMap = this.flashMapManager.retrieveAndUpdate(this.request, this.response);

    assertNull(inputFlashMap);
    assertEquals("FlashMap should not have been removed", 1, this.flashMapManager.getFlashMaps().size());

    this.request.setParameter("number", "two");
View Full Code Here

Examples of org.springframework.web.servlet.FlashMap

  // SPR-8798

  @Test
  public void retrieveAndUpdateMatchWithMultiValueParam() {
    FlashMap flashMap = new FlashMap();
    flashMap.put("name", "value");
    flashMap.addTargetRequestParam("id", "1");
    flashMap.addTargetRequestParam("id", "2");

    this.flashMapManager.setFlashMaps(flashMap);

    this.request.setParameter("id", "1");
    FlashMap inputFlashMap = this.flashMapManager.retrieveAndUpdate(this.request, this.response);

    assertNull(inputFlashMap);
    assertEquals("FlashMap should not have been removed", 1, this.flashMapManager.getFlashMaps().size());

    this.request.addParameter("id", "2");
View Full Code Here

Examples of org.springframework.web.servlet.FlashMap

    assertEquals("Input FlashMap should have been removed", 0, this.flashMapManager.getFlashMaps().size());
  }

  @Test
  public void retrieveAndUpdateSortMultipleMatches() {
    FlashMap emptyFlashMap = new FlashMap();

    FlashMap flashMapOne = new FlashMap();
    flashMapOne.put("key1", "value1");
    flashMapOne.setTargetRequestPath("/one");

    FlashMap flashMapTwo = new FlashMap();
    flashMapTwo.put("key1", "value1");
    flashMapTwo.put("key2", "value2");
    flashMapTwo.setTargetRequestPath("/one/two");

    this.flashMapManager.setFlashMaps(emptyFlashMap, flashMapOne, flashMapTwo);

    this.request.setRequestURI("/one/two");
    FlashMap inputFlashMap = this.flashMapManager.retrieveAndUpdate(this.request, this.response);

    assertEquals(flashMapTwo, inputFlashMap);
    assertEquals("Input FlashMap should have been removed", 2, this.flashMapManager.getFlashMaps().size());
  }
View Full Code Here

Examples of org.springframework.web.servlet.FlashMap

  @Test
  public void retrieveAndUpdateRemoveExpired() throws InterruptedException {
    List<FlashMap> flashMaps = new ArrayList<FlashMap>();
    for (int i=0; i < 5; i++) {
      FlashMap expiredFlashMap = new FlashMap();
      expiredFlashMap.startExpirationPeriod(-1);
      flashMaps.add(expiredFlashMap);
    }
    this.flashMapManager.setFlashMaps(flashMaps);
    this.flashMapManager.retrieveAndUpdate(this.request, this.response);
View Full Code Here

Examples of org.springframework.web.servlet.FlashMap

        0, this.flashMapManager.getFlashMaps().size());
  }

  @Test
  public void saveOutputFlashMapEmpty() throws InterruptedException {
    FlashMap flashMap = new FlashMap();

    this.flashMapManager.saveOutputFlashMap(flashMap, this.request, this.response);
    List<FlashMap> allMaps = this.flashMapManager.getFlashMaps();

    assertNull(allMaps);
View Full Code Here

Examples of org.springframework.web.servlet.FlashMap

    assertNull(allMaps);
  }

  @Test
  public void saveOutputFlashMap() throws InterruptedException {
    FlashMap flashMap = new FlashMap();
    flashMap.put("name", "value");

    this.flashMapManager.setFlashMapTimeout(-1); // expire immediately so we can check expiration started
    this.flashMapManager.saveOutputFlashMap(flashMap, this.request, this.response);
    List<FlashMap> allMaps = this.flashMapManager.getFlashMaps();

    assertNotNull(allMaps);
    assertSame(flashMap, allMaps.get(0));
    assertTrue(flashMap.isExpired());
  }
View Full Code Here

Examples of org.springframework.web.servlet.FlashMap

    assertTrue(flashMap.isExpired());
  }

  @Test
  public void saveOutputFlashMapDecodeTargetPath() throws InterruptedException {
    FlashMap flashMap = new FlashMap();
    flashMap.put("key", "value");

    flashMap.setTargetRequestPath("/once%20upon%20a%20time");
    this.flashMapManager.saveOutputFlashMap(flashMap, this.request, this.response);

    assertEquals("/once upon a time", flashMap.getTargetRequestPath());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.