-
Notifications
You must be signed in to change notification settings - Fork 388
[2단계 - 로그인 구현하기] 상돌(이상진) 미션 제출합니다. #646
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| private WebContentInterceptor getNoCacheInterceptor() { | ||
| CacheControl cacheControl = CacheControl.noCache().cachePrivate(); | ||
|
|
||
| return createWebContentInterceptorByCache(cacheControl, "/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
루트 경로에만 적용되지 않을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
루트 경로에만 적용되지 않을까요?
학습 테스트의 testNoCachePrivate()가 휴리스틱 캐싱을 적용해보는 것이 의도라고 생각해서 정해진 경로만 지정하였습니다 😄
| final var tomcat = new Tomcat(); | ||
| tomcat.start(); | ||
| } | ||
| public static void main(String[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
탭사이즈 몇으로 사용하고 계신가요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
탭사이즈 몇으로 사용하고 계신가요??
4로 사용하고 있습니다 ㅎㅎ 탭사이즈에 제약이 있었나용?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제약은 없는걸로 아는데 원래 있던 코드의 탭 사이즈가 달라져서 여쭤봤어요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제약은 없는걸로 아는데 원래 있던 코드의 탭 사이즈가 달라져서 여쭤봤어요!
인텔리제이 포맷 파일을 https://naver.github.io/hackday-conventions-java/ 를 쓰고있어요😄
| } | ||
|
|
||
| default HttpResponse redirect(HttpResponseHeader header, String location) { | ||
| header.addHeader("Location", location); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상수로 추출해볼까요? 헤더 관련 상수가 이곳저곳 흩어져있다면 enum으로 관리해도 좋겠습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상수로 추출해볼까요? 헤더 관련 상수가 이곳저곳 흩어져있다면 enum으로 관리해도 좋겠습니다
해당 클래스와 직접적으로 연관이 있다고 판단되는 값만 상수로 지정하게 되었는데.. 관리 포인트를 생각하면 enum으로 정의하는게 낫겠네요~~! 바로 반영할게요😄
| return handlers.stream() | ||
| .filter(handler -> handler.isSupport(requestLine)) | ||
| .findFirst() | ||
| .orElseThrow(() -> new IllegalArgumentException("handler not found. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Http11Processor에서 IllegalArgumentException을 처리하지 않고 있습니다
예외대신 404 페이지를 바라보는 NotFoundHandler를 구현해서 리턴하면 어떨까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Http11Processor에서IllegalArgumentException을 처리하지 않고 있습니다 예외대신 404 페이지를 바라보는NotFoundHandler를 구현해서 리턴하면 어떨까요?
텔레파시 🤜🤛
| return new HttpResponse(new HttpResponseStartLine(HTTP_VERSION, HttpStatusCode.OK), header, body); | ||
| } | ||
|
|
||
| public static HttpResponse notFound(HttpResponseHeader header, HttpResponseBody body) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok()와 더불어서, usages를 확인했을 때 모두 추가적인 로직없이 단순히 외부에서 header 객체를 생성 후 넘겨주고 있습니다
이렇게 구현하신 이유가 있을까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok()와 더불어서, usages를 확인했을 때 모두 추가적인 로직없이 단순히 외부에서 header 객체를 생성 후 넘겨주고 있습니다 이렇게 구현하신 이유가 있을까요??
음 지금은 응답 헤더에 값을 넣고있지 않는데 헤더에 값을 넣을 여지는 열어놔야 한다고 생각했읍니다 ~~!
| void findHandler_WhenRequestRootPage() { | ||
| String requestPath = "/"; | ||
|
|
||
| Class<? extends Handler> expectedHandler = RootPageHandler.class; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제네릭인 이유가 있나요?? Handler 인터페이스로 선언해도 되지 않을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제네릭인 이유가 있나요?? Handler 인터페이스로 선언해도 되지 않을까요?
테스트에서 타입 비교에 사용되는데, 이 경우는 제네릭을 안 쓰면 구체 타입을 지정해야 하더라구요. 그런데 생각해보니 runTest의 파라미터만 제네릭을 써도 충분해서 구체 타입을 지정하는 방법으로 수정했습니다😄
|
|
||
| Handler handler = HandlerMapper.findHandler(request); | ||
|
|
||
| assertThat(handler).isInstanceOf(expectedHandler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isExactlyInstanceOf()로 클래스가 정확히 일치하는지 검증하면 신뢰도가 더 높을 것 같습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isExactlyInstanceOf()로 클래스가 정확히 일치하는지 검증하면 신뢰도가 더 높을 것 같습니다
쵝오..😌
tomcat/src/test/resources/index.html
Outdated
| @@ -0,0 +1,106 @@ | |||
| <!DOCTYPE html> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 html 파일은 어떤 용도인가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 html 파일은 어떤 용도인가요?
getPath() 에서 NPE가 나오길래 파일을 넣었는데.. 제가 경로 설정을 잘못했군요..ㅎㅎ..
| } | ||
|
|
||
| private void validateIsNotEmptyValue(String account, String password, String email) { | ||
| if (account == null || account.isBlank()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user 검증 추가 좋네요 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user 검증 추가 좋네요 👍🏻
감사링 ㅎㅎ
| return null; | ||
| } | ||
|
|
||
| LinkedHashMap<String, List<String>> result = new LinkedHashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
구체적인 하위 타입을 선언하신 이유가 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
구체적인 하위 타입을 선언하신 이유가 있을까요?
제가 에러 휴먼이라서요..? ㅋㅋㅋ 감사합니닷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아니요? 상돌은 핸섬 휴먼입니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아니요? 상돌은 핸섬 휴먼입니다
ㅋㅋㅋㅋㅋ 영광이에요 ㅋㅋㅋㅋ
pricelees
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
뿌링 안녕하세요~
남겨주신 의견들에 모두 답글 남겨놨고, 반영이 필요한 부분은 모두 반영했습니다.
(커밋을 커멘트 단위로 해서 커밋 로그를 보시는 것도 좋을 것 같아요!)
바쁜 와중에서도 디테일한 리뷰 감사합니다~~🙇
| private WebContentInterceptor getNoCacheInterceptor() { | ||
| CacheControl cacheControl = CacheControl.noCache().cachePrivate(); | ||
|
|
||
| return createWebContentInterceptorByCache(cacheControl, "/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
루트 경로에만 적용되지 않을까요?
학습 테스트의 testNoCachePrivate()가 휴리스틱 캐싱을 적용해보는 것이 의도라고 생각해서 정해진 경로만 지정하였습니다 😄
| final var tomcat = new Tomcat(); | ||
| tomcat.start(); | ||
| } | ||
| public static void main(String[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
탭사이즈 몇으로 사용하고 계신가요??
4로 사용하고 있습니다 ㅎㅎ 탭사이즈에 제약이 있었나용?
| } | ||
|
|
||
| private void validateIsNotEmptyValue(String account, String password, String email) { | ||
| if (account == null || account.isBlank()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user 검증 추가 좋네요 👍🏻
감사링 ㅎㅎ
| } | ||
|
|
||
| default HttpResponse redirect(HttpResponseHeader header, String location) { | ||
| header.addHeader("Location", location); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상수로 추출해볼까요? 헤더 관련 상수가 이곳저곳 흩어져있다면 enum으로 관리해도 좋겠습니다
해당 클래스와 직접적으로 연관이 있다고 판단되는 값만 상수로 지정하게 되었는데.. 관리 포인트를 생각하면 enum으로 정의하는게 낫겠네요~~! 바로 반영할게요😄
| return handlers.stream() | ||
| .filter(handler -> handler.isSupport(requestLine)) | ||
| .findFirst() | ||
| .orElseThrow(() -> new IllegalArgumentException("handler not found. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Http11Processor에서IllegalArgumentException을 처리하지 않고 있습니다 예외대신 404 페이지를 바라보는NotFoundHandler를 구현해서 리턴하면 어떨까요?
텔레파시 🤜🤛
| return new HttpResponse(new HttpResponseStartLine(HTTP_VERSION, HttpStatusCode.OK), header, body); | ||
| } | ||
|
|
||
| public static HttpResponse notFound(HttpResponseHeader header, HttpResponseBody body) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok()와 더불어서, usages를 확인했을 때 모두 추가적인 로직없이 단순히 외부에서 header 객체를 생성 후 넘겨주고 있습니다 이렇게 구현하신 이유가 있을까요??
음 지금은 응답 헤더에 값을 넣고있지 않는데 헤더에 값을 넣을 여지는 열어놔야 한다고 생각했읍니다 ~~!
| return new HttpResponse(new HttpResponseStartLine(HTTP_VERSION, HttpStatusCode.NOT_FOUND), header, body); | ||
| } | ||
|
|
||
| public HttpResponse(HttpResponseStartLine startLine, HttpResponseHeader header, HttpResponseBody body) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
객체 내부에서만 사용하는 생성자는 private 접근 제어자를 사용하면 어떨까요?
ok, notfound 등이 이후에 추가한 것들이라 반영이 다 안되었네요..ㅎㅎ 수정했습니다👍
| void findHandler_WhenRequestRootPage() { | ||
| String requestPath = "/"; | ||
|
|
||
| Class<? extends Handler> expectedHandler = RootPageHandler.class; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제네릭인 이유가 있나요?? Handler 인터페이스로 선언해도 되지 않을까요?
테스트에서 타입 비교에 사용되는데, 이 경우는 제네릭을 안 쓰면 구체 타입을 지정해야 하더라구요. 그런데 생각해보니 runTest의 파라미터만 제네릭을 써도 충분해서 구체 타입을 지정하는 방법으로 수정했습니다😄
|
|
||
| Handler handler = HandlerMapper.findHandler(request); | ||
|
|
||
| assertThat(handler).isInstanceOf(expectedHandler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isExactlyInstanceOf()로 클래스가 정확히 일치하는지 검증하면 신뢰도가 더 높을 것 같습니다
쵝오..😌
tomcat/src/test/resources/index.html
Outdated
| @@ -0,0 +1,106 @@ | |||
| <!DOCTYPE html> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 html 파일은 어떤 용도인가요?
getPath() 에서 NPE가 나오길래 파일을 넣었는데.. 제가 경로 설정을 잘못했군요..ㅎㅎ..
이미 로그인이 되어 있으면 POST /login 요청을 보낼 일이 없다고 생각했으나.. 로그인 마다 새로운 sessionId를 발급받아 갱신하는 방향으로 수정했습니다~!! |
GIVEN53
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
빠른 반영 감사합니다 상돌 👍🏻 저도 빠르게 머지드리겠습니다
18시까지 부지런히 달려보죠!



프린 안녕하세요! 제출이 늦어서 죄송합니다 ㅎㅎ;;
전에 말씀드린대로 코드가 다 바뀌었어요..ㅎㅎ.. 분량이 많아져서 죄송해요.
시간 여유 생기면 커피라도 대접하겠습니다 🙇 귀한 시간 내주셔서 감사해요 😄