Example usage for org.springframework.web.servlet.config.annotation ViewControllerRegistry addViewController

List of usage examples for org.springframework.web.servlet.config.annotation ViewControllerRegistry addViewController

Introduction

In this page you can find the example usage for org.springframework.web.servlet.config.annotation ViewControllerRegistry addViewController.

Prototype

public ViewControllerRegistration addViewController(String urlPath) 

Source Link

Document

Map a view controller to the given URL path (or pattern) in order to render a response with a pre-configured status code and view.

Usage

From source file:alfio.config.MvcConfiguration.java

@Override
public void addViewControllers(ViewControllerRegistry registry) {
    registry.addViewController("/admin/partials/index.html").setViewName("/admin/partials/main");
}

From source file:org.bonitasoft.web.designer.config.WebMvcConfiguration.java

@Override
public void addViewControllers(ViewControllerRegistry registry) {
    if (this.resourceLoader.getResource("classpath:/static/index.html").exists()) {
        // Use forward: prefix so that no view resolution is done
        try {/*  w  ww.  j ava2 s  .c  o  m*/
            logger.info("Adding welcome page: "
                    + this.resourceLoader.getResource(FRONTEND_RESOURCES + "index.html").getURL());
            registry.addViewController("/").setViewName("forward:/index.html");
        } catch (IOException e) {
            logger.error("The home page index.html was not found", e);
        }
    }
}

From source file:de.codecentric.boot.admin.config.AdminServerWebConfiguration.java

@Override
public void addViewControllers(ViewControllerRegistry registry) {
    if (StringUtils.hasText(adminServerProperties().getContextPath())) {
        registry.addRedirectViewController(adminServerProperties().getContextPath(),
                server.getPath(adminServerProperties().getContextPath()) + "/");
    }//w ww. j a va2s  .c  om
    registry.addViewController(adminServerProperties().getContextPath() + "/")
            .setViewName("forward:index.html");
}