Package org.springframework.web.servlet

Examples of org.springframework.web.servlet.DispatcherServlet.service()


    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myPath.do");
    request.addParameter("defaultName", "10");
    request.addParameter("age", "value2");
    request.addParameter("date", "2007-10-02");
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("myView-Integer:10-typeMismatch-tb1-myOriginalValue", response.getContentAsString());

    request = new MockHttpServletRequest("GET", "/myOtherPath.do");
    request.addParameter("defaultName", "10");
    request.addParameter("age", "value2");
View Full Code Here


    request = new MockHttpServletRequest("GET", "/myOtherPath.do");
    request.addParameter("defaultName", "10");
    request.addParameter("age", "value2");
    request.addParameter("date", "2007-10-02");
    response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("myView-myName-typeMismatch-tb1-myOriginalValue", response.getContentAsString());

    request = new MockHttpServletRequest("GET", "/myThirdPath.do");
    request.addParameter("defaultName", "10");
    request.addParameter("age", "100");
View Full Code Here

    request = new MockHttpServletRequest("GET", "/myThirdPath.do");
    request.addParameter("defaultName", "10");
    request.addParameter("age", "100");
    request.addParameter("date", "2007-10-02");
    response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("myView-special-99-special-99", response.getContentAsString());
  }

  @Test
  public void binderInitializingCommandProvidingFormController() throws Exception {
View Full Code Here

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myPath.do");
    request.addParameter("defaultName", "myDefaultName");
    request.addParameter("age", "value2");
    request.addParameter("date", "2007-10-02");
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("myView-String:myDefaultName-typeMismatch-tb1-myOriginalValue", response.getContentAsString());
  }

  @Test
  public void specificBinderInitializingCommandProvidingFormController() throws Exception {
View Full Code Here

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myPath.do");
    request.addParameter("defaultName", "myDefaultName");
    request.addParameter("age", "value2");
    request.addParameter("date", "2007-10-02");
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("myView-String:myDefaultName-typeMismatch-tb1-myOriginalValue", response.getContentAsString());
  }

  @Test
  public void parameterDispatchingController() throws Exception {
View Full Code Here

    servlet.init(servletConfig);

    MockHttpServletRequest request = new MockHttpServletRequest(servletContext, "GET", "/myPath.do");
    MockHttpServletResponse response = new MockHttpServletResponse();
    HttpSession session = request.getSession();
    servlet.service(request, response);
    assertEquals("myView", response.getContentAsString());
    assertSame(servletContext, request.getAttribute("servletContext"));
    assertSame(servletConfig, request.getAttribute("servletConfig"));
    assertSame(session.getId(), request.getAttribute("sessionId"));
    assertSame(request.getRequestURI(), request.getAttribute("requestUri"));
View Full Code Here

    assertSame(request.getLocale(), request.getAttribute("locale"));

    request = new MockHttpServletRequest(servletContext, "GET", "/myPath.do");
    response = new MockHttpServletResponse();
    session = request.getSession();
    servlet.service(request, response);
    assertEquals("myView", response.getContentAsString());
    assertSame(servletContext, request.getAttribute("servletContext"));
    assertSame(servletConfig, request.getAttribute("servletConfig"));
    assertSame(session.getId(), request.getAttribute("sessionId"));
    assertSame(request.getRequestURI(), request.getAttribute("requestUri"));
View Full Code Here

    assertSame(request.getRequestURI(), request.getAttribute("requestUri"));

    request = new MockHttpServletRequest(servletContext, "GET", "/myPath.do");
    request.addParameter("view", "other");
    response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("myOtherView", response.getContentAsString());

    request = new MockHttpServletRequest(servletContext, "GET", "/myPath.do");
    request.addParameter("view", "my");
    request.addParameter("lang", "de");
View Full Code Here

    request = new MockHttpServletRequest(servletContext, "GET", "/myPath.do");
    request.addParameter("view", "my");
    request.addParameter("lang", "de");
    response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("myLangView", response.getContentAsString());

    request = new MockHttpServletRequest(servletContext, "GET", "/myPath.do");
    request.addParameter("surprise", "!");
    response = new MockHttpServletResponse();
View Full Code Here

    assertEquals("myLangView", response.getContentAsString());

    request = new MockHttpServletRequest(servletContext, "GET", "/myPath.do");
    request.addParameter("surprise", "!");
    response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("mySurpriseView", response.getContentAsString());

    MyParameterDispatchingController deserialized = (MyParameterDispatchingController) SerializationTestUtils
        .serializeAndDeserialize(servlet.getWebApplicationContext().getBean("controller"));
    assertNotNull(deserialized.request);
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.