Package org.springframework.web.servlet

Examples of org.springframework.web.servlet.HandlerExecutionChain


    assertEquals(this.wac.getBean("index"), chain.getHandler());
  }

  public void testMapSimpleUri() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/welcome");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());

    request = new MockHttpServletRequest("GET", "/welcome/product");
    chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }
View Full Code Here


  }

  public void testWithContextPath() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myapp/welcome");
    request.setContextPath("/myapp");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }
View Full Code Here

    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }

  public void testWithoutControllerSuffix() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/buyform");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("buy"), chain.getHandler());

    request = new MockHttpServletRequest("GET", "/buyform/product");
    chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("buy"), chain.getHandler());
  }
View Full Code Here

    assertEquals(this.wac.getBean("buy"), chain.getHandler());
  }

  public void testWithBasePackage() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myapp/mvc/annotation/welcome");
    HandlerExecutionChain chain = this.hm2.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }
View Full Code Here

    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }

  public void testWithBasePackageAndCaseSensitive() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myapp/mvc/annotation/buyForm");
    HandlerExecutionChain chain = this.hm2.getHandler(request);
    assertEquals(this.wac.getBean("buy"), chain.getHandler());
  }
View Full Code Here

    assertEquals(this.wac.getBean("buy"), chain.getHandler());
  }

  public void testWithFullBasePackage() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myapp/welcome");
    HandlerExecutionChain chain = this.hm3.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }
View Full Code Here

    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }

  public void testWithRootAsBasePackage() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myapp/org/springframework/web/servlet/mvc/annotation/welcome");
    HandlerExecutionChain chain = this.hm4.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }
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

   *
   * @return
   * @throws Exception
   */
  protected String getViewNameFromRequest() throws Exception {
    HandlerExecutionChain execution = getHandler(getCurrentRequestAttributes().getRequest());
    HandlerMethod hm = (HandlerMethod) execution.getHandler();
    String name = hm.getMethod().getName();
   
    if (hm.getMethod().isAnnotationPresent(ResponseMapping.class)) {
      ResponseMapping responseMapping = hm.getMethod().getAnnotation(ResponseMapping.class);
      name = responseMapping.value()[0];
View Full Code Here

    return this.handlerMappings;
  }
 
  protected HandlerExecutionChain getHandler(HttpServletRequest request) throws Exception {
    for (HandlerMapping hm : getHandlerMappings()) {
      HandlerExecutionChain handler = hm.getHandler(request);
      if (handler != null) {
        return handler;
      }
    }
    return null;
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.