package pwc.taxtech.atms.web.controller; import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller @RequestMapping("/") public class IndexController { @RequestMapping(value = { "/", "/index", "/index.html" }, method = RequestMethod.GET) public String login(@CookieValue(value = "AtmsApiToken", required = false) String atmsApiToken) { if (StringUtils.hasText(atmsApiToken)) { return "index"; } return "redirect:Account/LogOn"; }
@RequestMapping(value = {"/admin", "/admin.html" }, method = RequestMethod.GET) public String admin(@CookieValue(value = "AtmsApiToken", required = false) String atmsApiToken) { if (StringUtils.hasText(atmsApiToken)) { return "admin"; } return "redirect:Account/LogOn"; }
}