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

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

Introduction

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

Prototype

public void addStatusController(String urlPath, HttpStatus statusCode) 

Source Link

Document

Map a simple controller to the given URL path (or pattern) in order to set the response status to the given code without rendering a body.

Usage

From source file:org.smigo.config.WebConfiguration.java

@Override
public void addViewControllers(ViewControllerRegistry registry) {
    registry.addViewController("/garden-planner-comparison").setViewName("garden-planner-comparison.jsp");
    registry.addViewController("/").setViewName("home.jsp");
    registry.addViewController("/help").setViewName("help.jsp");
    registry.addViewController("/robots.txt").setViewName("robots-txt.jsp");
    registry.addViewController("/sitemap.xml").setViewName("sitemap-xml.jsp");
    registry.addRedirectViewController("/garden-planner.html", "/views/garden-planner.html")
            .setStatusCode(HttpStatus.MOVED_PERMANENTLY);
    registry.addRedirectViewController("/garden/**", "/garden-planner")
            .setStatusCode(HttpStatus.MOVED_PERMANENTLY);
    registry.addRedirectViewController("/hasta-luego/**", "/welcome-back")
            .setStatusCode(HttpStatus.MOVED_PERMANENTLY);
    registry.addRedirectViewController("/beta/**", "/").setStatusCode(HttpStatus.MOVED_PERMANENTLY);
    registry.addRedirectViewController("/accept-termsofservice/**", "/accept-terms-of-service")
            .setStatusCode(HttpStatus.MOVED_PERMANENTLY);
    registry.addRedirectViewController("/signup/**", "/register").setStatusCode(HttpStatus.MOVED_PERMANENTLY);
    registry.addRedirectViewController("/_=_", "/garden-planner").setStatusCode(HttpStatus.MOVED_PERMANENTLY);
    registry.addRedirectViewController("/wall/{username}/**", "/gardener/{username}")
            .setStatusCode(HttpStatus.MOVED_PERMANENTLY);
    registry.addRedirectViewController("/tos.html", "/static/terms-of-service.html")
            .setStatusCode(HttpStatus.MOVED_PERMANENTLY);
    registry.addStatusController("/static/terms-of-service.html", HttpStatus.GONE);
    registry.addStatusController("/listspecies", HttpStatus.GONE);
    registry.addStatusController("/update-species", HttpStatus.GONE);
    registry.addStatusController("/rest/species/search", HttpStatus.GONE);
    registry.addStatusController("/addyear/**", HttpStatus.GONE);
    registry.addStatusController("/deletespecies/**", HttpStatus.GONE);
    registry.addStatusController("/species/**", HttpStatus.GONE);
    registry.addStatusController("/rule/**", HttpStatus.GONE);
    registry.addStatusController("**/*.php", HttpStatus.NOT_FOUND);
    registry.addStatusController("cgi-bin/**", HttpStatus.NOT_FOUND);
    registry.addStatusController("**/*.cgi", HttpStatus.NOT_FOUND);
    registry.addStatusController("/wp/", HttpStatus.NOT_FOUND);
    registry.addStatusController("/wordpress/", HttpStatus.NOT_FOUND);
    registry.addStatusController("/HNAP1/", HttpStatus.NOT_FOUND);
    registry.addStatusController("/blog/robots.txt", HttpStatus.NOT_FOUND);
    registry.addStatusController("/apple-touch-icon-precomposed.png", HttpStatus.NOT_FOUND);
    registry.addStatusController("/apple-touch-icon.png", HttpStatus.NOT_FOUND);
}