Skip to content

Commit 45795f8

Browse files
committed
Fix: Controller 병합
1 parent 42fac50 commit 45795f8

12 files changed

+368
-267
lines changed

java-webMVC.iws

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,14 @@
55
</component>
66
<component name="ChangeListManager">
77
<list default="true" id="b8532e5e-d8f5-4e8c-a002-746704734daf" name="Changes" comment="">
8-
<change afterPath="$PROJECT_DIR$/src/main/java/jwp/repository/QuestionRepository.java" afterDir="false" />
9-
<change afterPath="$PROJECT_DIR$/src/main/java/jwp/repository/UserRepository.java" afterDir="false" />
10-
<change afterPath="$PROJECT_DIR$/src/main/java/jwp/service/QuestionService.java" afterDir="false" />
11-
<change afterPath="$PROJECT_DIR$/src/main/java/jwp/service/UserService.java" afterDir="false" />
128
<change beforePath="$PROJECT_DIR$/java-webMVC.iws" beforeDir="false" afterPath="$PROJECT_DIR$/java-webMVC.iws" afterDir="false" />
13-
<change beforePath="$PROJECT_DIR$/src/main/java/core/jdbc/ConnectionManager.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/jdbc/ConnectionManager.java" afterDir="false" />
14-
<change beforePath="$PROJECT_DIR$/src/main/java/core/jdbc/KeyHolder.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/jdbc/KeyHolder.java" afterDir="false" />
15-
<change beforePath="$PROJECT_DIR$/src/main/java/core/jdbc/PreparedStatementSetter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/jdbc/PreparedStatementSetter.java" afterDir="false" />
16-
<change beforePath="$PROJECT_DIR$/src/main/java/core/jdbc/RowMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/jdbc/RowMapper.java" afterDir="false" />
17-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/Controller.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/Controller.java" afterDir="false" />
18-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/CreateQuestionController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/CreateQuestionController.java" afterDir="false" />
19-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/CreateQuestionFormController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/CreateQuestionFormController.java" afterDir="false" />
209
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/CreateUserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/CreateUserController.java" afterDir="false" />
21-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/DispatcherServlet.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/DispatcherServlet.java" afterDir="false" />
2210
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/ForwardController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/ForwardController.java" afterDir="false" />
23-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/HomeController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/HomeController.java" afterDir="false" />
24-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/ListUserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/ListUserController.java" afterDir="false" />
2511
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/LoginController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/LoginController.java" afterDir="false" />
2612
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/LogoutController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/LogoutController.java" afterDir="false" />
27-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/RequestMapping.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/RequestMapping.java" afterDir="false" />
28-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/ShowQuestionController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/ShowQuestionController.java" afterDir="false" />
2913
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/UpdateUserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/UpdateUserController.java" afterDir="false" />
3014
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/UpdateUserFormController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/UpdateUserFormController.java" afterDir="false" />
3115
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/controller/UserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/controller/UserController.java" afterDir="false" />
32-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/dao/QuestionDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/dao/QuestionDao.java" afterDir="false" />
33-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/dao/UserDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/dao/UserDao.java" afterDir="false" />
34-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/model/Question.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/model/Question.java" afterDir="false" />
35-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/model/User.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/model/User.java" afterDir="false" />
36-
<change beforePath="$PROJECT_DIR$/src/main/java/jwp/support/context/ContextLoaderListener.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/jwp/support/context/ContextLoaderListener.java" afterDir="false" />
3716
</list>
3817
<option name="SHOW_DIALOG" value="false" />
3918
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -332,7 +311,7 @@
332311
<workItem from="1761813440661" duration="22235000" />
333312
<workItem from="1761983761744" duration="329000" />
334313
<workItem from="1762087694007" duration="8947000" />
335-
<workItem from="1762319002804" duration="10575000" />
314+
<workItem from="1762319002804" duration="11409000" />
336315
</task>
337316
<servers />
338317
</component>
Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
package jwp.controller;
2-
3-
4-
import jwp.model.Question;
5-
import jwp.model.User;
6-
import jwp.service.QuestionService;
7-
import jwp.support.session.UserSessionUtils;
8-
import lombok.RequiredArgsConstructor;
9-
import org.springframework.stereotype.Controller;
10-
import org.springframework.web.bind.annotation.PostMapping;
11-
import org.springframework.web.bind.annotation.RequestMapping;
12-
import org.springframework.web.bind.annotation.RequestParam;
13-
14-
import javax.servlet.ServletException;
15-
import javax.servlet.http.HttpServletRequest;
16-
import javax.servlet.http.HttpServletResponse;
17-
import javax.servlet.http.HttpSession;
18-
import java.io.IOException;
19-
import java.sql.SQLException;
20-
21-
@Controller
22-
@RequestMapping("/qna")
23-
@RequiredArgsConstructor
24-
public class CreateQuestionController{
25-
private final QuestionService questionService;
26-
@PostMapping("/create")
27-
public String createQuestion(@RequestParam String title,
28-
@RequestParam String contents,
29-
HttpSession session) {
30-
User user = UserSessionUtils.getUserFromSession(session);
31-
if (user == null) {
32-
return "redirect:/user/loginForm";
33-
}
34-
questionService.createQuestion(user.getUserId(), title, contents);
35-
return "redirect:/";
36-
}
37-
}
1+
//package jwp.controller;
2+
//
3+
//
4+
//import jwp.model.Question;
5+
//import jwp.model.User;
6+
//import jwp.service.QuestionService;
7+
//import jwp.support.session.UserSessionUtils;
8+
//import lombok.RequiredArgsConstructor;
9+
//import org.springframework.stereotype.Controller;
10+
//import org.springframework.web.bind.annotation.PostMapping;
11+
//import org.springframework.web.bind.annotation.RequestMapping;
12+
//import org.springframework.web.bind.annotation.RequestParam;
13+
//
14+
//import javax.servlet.ServletException;
15+
//import javax.servlet.http.HttpServletRequest;
16+
//import javax.servlet.http.HttpServletResponse;
17+
//import javax.servlet.http.HttpSession;
18+
//import java.io.IOException;
19+
//import java.sql.SQLException;
20+
//
21+
//@Controller
22+
//@RequestMapping("/qna")
23+
//@RequiredArgsConstructor
24+
//public class CreateQuestionController{
25+
// private final QuestionService questionService;
26+
// @PostMapping("/create")
27+
// public String createQuestion(@RequestParam String title,
28+
// @RequestParam String contents,
29+
// HttpSession session) {
30+
// User user = UserSessionUtils.getUserFromSession(session);
31+
// if (user == null) {
32+
// return "redirect:/user/loginForm";
33+
// }
34+
// questionService.createQuestion(user.getUserId(), title, contents);
35+
// return "redirect:/";
36+
// }
37+
//}
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
package jwp.controller;
2-
3-
import jwp.support.session.UserSessionUtils;
4-
import org.springframework.stereotype.Controller;
5-
import org.springframework.web.bind.annotation.GetMapping;
6-
import org.springframework.web.bind.annotation.RequestMapping;
7-
8-
import javax.servlet.http.HttpSession;
9-
10-
@Controller
11-
@RequestMapping("/qna")
12-
public class CreateQuestionFormController {
13-
14-
@GetMapping("/form")
15-
public String showForm(HttpSession session) {
16-
if (UserSessionUtils.isLogined(session)) {
17-
return "qna/form.jsp";
18-
}
19-
return "redirect:/user/loginForm";
20-
}
21-
}
1+
//package jwp.controller;
2+
//
3+
//import jwp.support.session.UserSessionUtils;
4+
//import org.springframework.stereotype.Controller;
5+
//import org.springframework.web.bind.annotation.GetMapping;
6+
//import org.springframework.web.bind.annotation.RequestMapping;
7+
//
8+
//import javax.servlet.http.HttpSession;
9+
//
10+
//@Controller
11+
//@RequestMapping("/qna")
12+
//public class CreateQuestionFormController {
13+
//
14+
// @GetMapping("/form")
15+
// public String showForm(HttpSession session) {
16+
// if (UserSessionUtils.isLogined(session)) {
17+
// return "qna/form.jsp";
18+
// }
19+
// return "redirect:/user/loginForm";
20+
// }
21+
//}
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
package jwp.controller;
2-
3-
import jwp.model.User;
4-
import jwp.service.UserService;
5-
import lombok.RequiredArgsConstructor;
6-
import org.springframework.stereotype.Controller;
7-
import org.springframework.web.bind.annotation.ModelAttribute;
8-
import org.springframework.web.bind.annotation.PostMapping;
9-
import org.springframework.web.bind.annotation.RequestMapping;
10-
11-
@Controller
12-
@RequestMapping("/user")
13-
@RequiredArgsConstructor
14-
public class CreateUserController {
15-
private final UserService userService;
16-
17-
@PostMapping("/signup")
18-
public String createUser(@ModelAttribute User user) {
19-
userService.createUser(user);
20-
return "redirect:/user/list";
21-
}
22-
}
1+
//package jwp.controller;
2+
//
3+
//import jwp.model.User;
4+
//import jwp.service.UserService;
5+
//import lombok.RequiredArgsConstructor;
6+
//import org.springframework.stereotype.Controller;
7+
//import org.springframework.web.bind.annotation.ModelAttribute;
8+
//import org.springframework.web.bind.annotation.PostMapping;
9+
//import org.springframework.web.bind.annotation.RequestMapping;
10+
//
11+
//@Controller
12+
//@RequestMapping("/user")
13+
//@RequiredArgsConstructor
14+
//public class CreateUserController {
15+
// private final UserService userService;
16+
//
17+
// @PostMapping("/signup")
18+
// public String createUser(@ModelAttribute User user) {
19+
// userService.createUser(user);
20+
// return "redirect:/user/list";
21+
// }
22+
//}
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
package jwp.controller;
2-
3-
import org.springframework.stereotype.Controller;
4-
import org.springframework.web.bind.annotation.GetMapping;
5-
6-
@Controller
7-
public class ForwardController {
8-
// private final String viewName;
9-
@GetMapping("/user/loginForm")
10-
public String loginForm() {
11-
return "user/login";
12-
}
13-
14-
@GetMapping("/user/loginFailed")
15-
public String loginFailed() {
16-
return "user/loginFailed";
17-
}
18-
19-
@GetMapping("/user/form")
20-
public String signUpForm() {
21-
return "user/form";
22-
}
23-
}
1+
//package jwp.controller;
2+
//
3+
//import org.springframework.stereotype.Controller;
4+
//import org.springframework.web.bind.annotation.GetMapping;
5+
//
6+
//@Controller
7+
//public class ForwardController {
8+
//// private final String viewName;
9+
// @GetMapping("/user/loginForm")
10+
// public String loginForm() {
11+
// return "user/login";
12+
// }
13+
//
14+
// @GetMapping("/user/loginFailed")
15+
// public String loginFailed() {
16+
// return "user/loginFailed";
17+
// }
18+
//
19+
// @GetMapping("/user/form")
20+
// public String signUpForm() {
21+
// return "user/form";
22+
// }
23+
//}
Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
package jwp.controller;
2-
3-
import jwp.service.UserService;
4-
import jwp.support.session.UserSessionUtils;
5-
import lombok.RequiredArgsConstructor;
6-
import org.springframework.stereotype.Controller;
7-
import org.springframework.web.bind.annotation.PostMapping;
8-
import org.springframework.web.bind.annotation.RequestMapping;
9-
import org.springframework.web.bind.annotation.RequestParam;
10-
11-
import javax.servlet.http.HttpSession;
12-
13-
@Controller
14-
@RequestMapping("/user")
15-
@RequiredArgsConstructor
16-
public class LoginController {
17-
private final UserService userService;
18-
19-
@PostMapping("/login")
20-
public String login(@RequestParam String userId,
21-
@RequestParam String password,
22-
HttpSession session) {
23-
return userService.authenticate(userId, password)
24-
.map(user -> {
25-
session.setAttribute(UserSessionUtils.USER_SESSION_KEY, user);
26-
return "redirect:/";
27-
})
28-
.orElse("redirect:/user/loginFailed");
29-
}
30-
}
1+
//package jwp.controller;
2+
//
3+
//import jwp.service.UserService;
4+
//import jwp.support.session.UserSessionUtils;
5+
//import lombok.RequiredArgsConstructor;
6+
//import org.springframework.stereotype.Controller;
7+
//import org.springframework.web.bind.annotation.PostMapping;
8+
//import org.springframework.web.bind.annotation.RequestMapping;
9+
//import org.springframework.web.bind.annotation.RequestParam;
10+
//
11+
//import javax.servlet.http.HttpSession;
12+
//
13+
//@Controller
14+
//@RequestMapping("/user")
15+
//@RequiredArgsConstructor
16+
//public class LoginController {
17+
// private final UserService userService;
18+
//
19+
// @PostMapping("/login")
20+
// public String login(@RequestParam String userId,
21+
// @RequestParam String password,
22+
// HttpSession session) {
23+
// return userService.authenticate(userId, password)
24+
// .map(user -> {
25+
// session.setAttribute(UserSessionUtils.USER_SESSION_KEY, user);
26+
// return "redirect:/";
27+
// })
28+
// .orElse("redirect:/user/loginFailed");
29+
// }
30+
//}
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
package jwp.controller;
2-
3-
import jwp.support.session.UserSessionUtils;
4-
import org.springframework.stereotype.Controller;
5-
import org.springframework.web.bind.annotation.GetMapping;
6-
import org.springframework.web.bind.annotation.RequestMapping;
7-
8-
import javax.servlet.http.HttpSession;
9-
10-
@Controller
11-
@RequestMapping("/user")
12-
public class LogoutController {
13-
14-
@GetMapping("/logout")
15-
public String logout(HttpSession session) {
16-
if (session != null) {
17-
session.removeAttribute(UserSessionUtils.USER_SESSION_KEY);
18-
}
19-
return "redirect:/";
20-
}
21-
}
1+
//package jwp.controller;
2+
//
3+
//import jwp.support.session.UserSessionUtils;
4+
//import org.springframework.stereotype.Controller;
5+
//import org.springframework.web.bind.annotation.GetMapping;
6+
//import org.springframework.web.bind.annotation.RequestMapping;
7+
//
8+
//import javax.servlet.http.HttpSession;
9+
//
10+
//@Controller
11+
//@RequestMapping("/user")
12+
//public class LogoutController {
13+
//
14+
// @GetMapping("/logout")
15+
// public String logout(HttpSession session) {
16+
// if (session != null) {
17+
// session.removeAttribute(UserSessionUtils.USER_SESSION_KEY);
18+
// }
19+
// return "redirect:/";
20+
// }
21+
//}

0 commit comments

Comments
 (0)