Package org.springframework.web.servlet

Examples of org.springframework.web.servlet.HandlerExecutionChain


    request.setContextPath("/springtravel");
    request.setServletPath("/app");
    request.setPathInfo("/flow");
    request.setRequestURI("/springtravel/app/flow");
    request.setMethod("GET");
    HandlerExecutionChain chain = mapping.getHandler(request);
    FlowHandler handler = (FlowHandler) chain.getHandler();
    assertEquals("flow", handler.getFlowId());
  }
View Full Code Here


    request.setContextPath("/springtravel");
    request.setServletPath("/app");
    request.setPathInfo("/foo/flow2");
    request.setRequestURI("/springtravel/app/foo/flow2");
    request.setMethod("GET");
    HandlerExecutionChain chain = mapping.getHandler(request);
    assertNotNull(chain);
    FlowHandler handler = (FlowHandler) chain.getHandler();
    assertEquals("foo/flow2", handler.getFlowId());
    assertTrue(handler instanceof CustomFlowHandler);
  }
View Full Code Here

    request.setContextPath("/springtravel");
    request.setServletPath("/app");
    request.setPathInfo("/bogus");
    request.setRequestURI("/springtravel/app/bogus");
    request.setMethod("GET");
    HandlerExecutionChain chain = mapping.getHandler(request);
    assertNull(chain);
  }
View Full Code Here

    assertNull(chain);
  }

  public void testGetHandlerNullFlowId() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest();
    HandlerExecutionChain chain = mapping.getHandler(request);
    assertNull(chain);
  }
View Full Code Here

    return (DefaultMvcResult) request.getAttribute(MockMvc.MVC_RESULT_ATTRIBUTE);
  }

  @Override
  protected HandlerExecutionChain getHandler(HttpServletRequest request) throws Exception {
    HandlerExecutionChain chain = super.getHandler(request);
    if (chain != null) {
      DefaultMvcResult mvcResult = getMvcResult(request);
      mvcResult.setHandler(chain.getHandler());
      mvcResult.setInterceptors(chain.getInterceptors());
    }
    return chain;
  }
View Full Code Here

    Controller controller = new InspectRequestManager().lookupController(request, getTransformerFactory());

    if (controller == null)
      return null;
   
    return new HandlerExecutionChain(controller);
  }
View Full Code Here

        if (object instanceof String) {
            String handlerName = (String) object;
            object = getApplicationContext().getBean(handlerName);
        }
        if (object instanceof HandlerExecutionChain) {
            HandlerExecutionChain handlerExecutionChain = (HandlerExecutionChain) object;
            object = handlerExecutionChain.getHandler();
        }
       
        if (object != null) {
          // prevent CSRF attacks
          if (object instanceof DestinationFacade) {
View Full Code Here

  @Override
  public String getRequestName() {
    String name = "";
    for (HandlerMapping handlerMapping : HandlerMappingServletContextListener.allHandlerMappings) {
      try {
        HandlerExecutionChain handler = handlerMapping.getHandler(httpServletRequest);
        name = getRequestNameFromHandler(handler);
      } catch (Exception e) {
        // ignore, try next
        logger.warn(e.getMessage(), e);
      }
View Full Code Here

    return requestMappingHandlerMapping;
  }

  private HandlerMapping createHandlerMappingNotReturningHandlerMethod() throws Exception {
    HandlerMapping requestMappingHandlerMapping = mock(HandlerMapping.class);
    HandlerExecutionChain handlerExecutionChain = mock(HandlerExecutionChain.class);

    when(handlerExecutionChain.getHandler()).thenReturn(new Object());
    when(requestMappingHandlerMapping.getHandler((HttpServletRequest) any())).thenReturn(handlerExecutionChain);
    return requestMappingHandlerMapping;
  }
View Full Code Here

  }

  private HandlerMapping createHandlerMapping(MockHttpServletRequest request, Method requestMappingMethod) throws Exception {
    System.out.println("createHandlerMapping"+request);
    HandlerMapping requestMappingHandlerMapping = mock(HandlerMapping.class);
    HandlerExecutionChain handlerExecutionChain = mock(HandlerExecutionChain.class);
    HandlerMethod handlerMethod = mock(HandlerMethod.class);

    when(handlerMethod.getMethod()).thenReturn(requestMappingMethod);
    when(handlerExecutionChain.getHandler()).thenReturn(handlerMethod);
    when(requestMappingHandlerMapping.getHandler(Matchers.argThat(new Matcher<HttpServletRequest>() {
      @Override
      public boolean matches(Object item) {
        return ((HttpServletRequest) item).getRequestURI().equals("/test/requestName");
      }
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.HandlerExecutionChain

Copyright © 2018 www.massapicom. 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.