Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MVC 구현하기 - 3단계] 오찌(오지훈) 미션 제출합니다 #255

Merged
merged 13 commits into from
Sep 29, 2022

Conversation

Ohzzi
Copy link

@Ohzzi Ohzzi commented Sep 26, 2022

안녕하세요 기론 😄 3단계를 빨리 마무리하고 리뷰 요청 드립니다!

새로 추가되는 UserController 메서드도 테스트 하기 위해 InMemoryUserRepository를 UserRepository로 한 단계 추상화했습니다!
사실 나머지 Controller들도 테스트를 추가해야 할지가 조금 고민이네요...!

또다른 고민이 있다면 서블릿에 매핑되지 않은 URL의 경우 어떻게 해야 404.jsp를 보내줄 수 있을지, ServletException이 발생했을 때 500.jsp로 리다이렉션해주는 것은 어떨지에 대한 고민입니다. 에러에 관련된 jsp 파일을 리다이렉션 하는 부분에서 좋은 생각이 있으시다면 공유 부탁드려요 ㅎㅎ :)

3단계도 잘 부탁드립니다!

@Ohzzi Ohzzi requested a review from Gyuchool September 26, 2022 07:46
Copy link

@Gyuchool Gyuchool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요 오찌~! 빨리 구현해주셨네요!
잘 구현해주셔서 특별히 코멘트 드릴게 없지만 미션 기간이 여유로우니 약간의 코멘트만 남겼어요~!

README.md Outdated
## 3단계 - JSON View 구현하기

- [x] 힌트에서 제공한 UserController 컨트롤러가 json 형태로 응답을 반환한다.
- [ ] 레거시 코드를 삭제하고 서버를 띄워도 정상 동작한다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요기 체크가 안됐네요!

import nextstep.mvc.view.ModelAndView;
import org.junit.jupiter.api.Test;

class UserControllerTest {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

컨트롤러 테스트 👍

}

private Object getAttributes(final Map<String, ?> model) {
if (model.size() > 1) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사소하지만 매직넘버 제거하면 좋을 것 같아욥

@Gyuchool
Copy link

파일 체인지에 없어서 따로 코멘트 남길게요!

서블릿에 매핑되지 않은 URL의 경우 어떻게 해야 404.jsp를 보내줄 수 있을지

이 부분에 대해서 저도 리뷰를 받고 해결하다가 앞선 리뷰에서 얘기했던 MappingRegistry에서 Optional을 반환하는 이유를 찾은 것 같아서 공유해드려요!
image
HandlerMappingRegistry에서 Optional을 반환하면 dispatcherServlet의 service에서 적절히 예외를 반환할수 있더라구요! 그래서 Mapping에서는 Optional을 반환한 것이라고 생각해요!
오찌도 Optional을 반환해서 service에서 혹은 다른 클래스에 책임을 줘서 처리해볼 수 있을 것 같아욥

ServletException이 발생했을 때 500.jsp로 리다이렉션해주는 것

이 부분은 저도 놓쳤는데😅 위와 비슷한 방식으로 처리하면 되지않을까 싶네요 저도 구현해보고 말씀드릴게요!

Copy link

@Gyuchool Gyuchool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3단계까지 미션하시느라 수고하셨습니다!
마지막으로 한가지 질문만 남겼어요.
다음 미션도 화이팅하세욥🙏

@RequestMapping(value = "/api/user", method = RequestMethod.GET)
public ModelAndView show(HttpServletRequest request, HttpServletResponse response) {
final String account = request.getParameter("account");
if (account == null) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (account == null) {
if (Objects.isNull(account)) {

위에처럼 Objects의 메서드를 사용하지 않으신 이유가 있을까요?

@Gyuchool Gyuchool merged commit a3ece3b into woowacourse:ohzzi Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants