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