Example #1
0
  @Bean
  public HandlerMapping landingPageHandlerMapping() {
    SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
    mapping.setOrder(0);
    ParameterizableViewController pvc = new ParameterizableViewController();
    pvc.setViewName("loginPage");

    mapping.setUrlMap(Collections.singletonMap("/login", pvc));
    return mapping;
  }
Example #2
0
  @Bean
  public HandlerMapping viewControllerHandlerMapping() {
    SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
    mapping.setOrder(2);

    Map<String, String> jspMapping = jspMapping().getConfig();
    Map<String, ParameterizableViewController> jspViewBeans = new HashMap<>();
    ParameterizableViewController controller;
    for (String url : jspMapping.keySet()) {
      controller = new ParameterizableViewController();
      controller.setViewName(jspMapping.get(url));
      jspViewBeans.put(url, controller);
    }
    mapping.setUrlMap(jspViewBeans);
    return mapping;
  }