| 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 9 | |
| 10 | @Controller |
| 11 | @RequestMapping("/board") |
| 12 | public class BoardController { |
| 13 | @GetMapping("/list") |
| 14 | public String list(HttpServletRequest request) { |
| 15 | if(!loginCheck(request)) |
| 16 | return "redirect:/login/login?toURL="+request.getRequestURL(); // 로그인을 안했으면 로그인 화면으로 이동 |
| 17 | |
| 18 | return "boardList"; // 로그인을 한 상태이면, 게시판 화면으로 이동 |
| 19 | } |
| 20 | |
| 21 | private boolean loginCheck(HttpServletRequest request) { |
| 22 | // 1. 세션을 얻어서 |
| 23 | HttpSession session = request.getSession(); |
| 24 | // 2. 세션에 id가 있는지 확인, 있으면 true를 반환 |
| 25 | return session.getAttribute("id")!=null; |
| 26 | } |
| 27 | } |
nothing calls this directly
no outgoing calls
no test coverage detected