Class MainPageController


  • @Controller
    @RequestMapping("/")
    @SessionAttributes("statistic")
    public class MainPageController
    extends java.lang.Object
    Class MainPageController is a Spring Boot Controller class witch allow to serve HTTP requests from main page of application. Class has injected statistic service(StatisticService) for showing statistic for games with an algorithm(MiniMax) on main page.
    Path for requests "{pageContext}/"
    Author:
    Arterm Koliushko, https://www.linkedin.com/in/artem-koliushko/
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String MAIN_PAGE_NAME
      Constant with a name of main page view.
      private static java.lang.String STATISTIC_MODEL_NAME
      Constant with model attribute name for statistic.
      private StatisticService statisticService
      This is an injected statistic service(StatisticService) witch allow to get statistic for games with an algorithm(MiniMax) from DB.
    • Constructor Summary

      Constructors 
      Constructor Description
      MainPageController​(StatisticService statisticService)
      Create class with an injection of statistic service(StatisticService) to show results of the games with an algorithm(MiniMax) on main page.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) org.springframework.web.servlet.ModelAndView mainPage()
      Allow to serve HTTP requests for requests "{pageContext}/" by method GET.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • STATISTIC_MODEL_NAME

        private static final java.lang.String STATISTIC_MODEL_NAME
        Constant with model attribute name for statistic.
        See Also:
        Constant Field Values
      • MAIN_PAGE_NAME

        private static final java.lang.String MAIN_PAGE_NAME
        Constant with a name of main page view.
        See Also:
        Constant Field Values
      • statisticService

        private final StatisticService statisticService
        This is an injected statistic service(StatisticService) witch allow to get statistic for games with an algorithm(MiniMax) from DB.
    • Constructor Detail

      • MainPageController

        public MainPageController​(StatisticService statisticService)
        Create class with an injection of statistic service(StatisticService) to show results of the games with an algorithm(MiniMax) on main page.
        Parameters:
        statisticService - Injection of StatisticService class.
    • Method Detail

      • mainPage

        @GetMapping
        org.springframework.web.servlet.ModelAndView mainPage()
        Allow to serve HTTP requests for requests "{pageContext}/" by method GET.
        Returns:
        ModelAndView with mane of the main page view and Statistic of the games with an algorithm(MiniMax) in model.