Class RobotsTxtController

java.lang.Object
com.endurancetrio.app.common.web.RobotsTxtController

@EnduranceTrioWebController public class RobotsTxtController extends Object
The RobotsTxtController serves the /robots.txt endpoint.

The content is rendered from the templates/robots.txt template so that the Sitemap directive uses the configured app.site-url at runtime. The template is processed by a dedicated SpringTemplateEngine configured with an .txt suffix and TEXT template mode. The engine is created in the constructor rather than as a Spring bean so that the autoconfigured Thymeleaf engine (which uses the .html suffix for HTML views) is left untouched.

  • Constructor Details

    • RobotsTxtController

      @Autowired public RobotsTxtController(AppProperties appProperties)
  • Method Details

    • generateRobotsTxt

      @GetMapping(value="/robots.txt", produces="text/plain") @ResponseBody public String generateRobotsTxt()
      Returns the robots.txt content with the Sitemap directive pointing to the configured site URL.
      Returns:
      the rendered robots.txt content