-
Notifications
You must be signed in to change notification settings - Fork 309
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
[톰캣 구현하기 1,2단계] 호이(이건호) 미션 제출합니다. #313
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.
안녕하세요 호이 구현해주신 것 잘 봤습니다.
제가 남긴 의견은 필수적으로 하기보다는 개인적인 의견이 있으시면 코멘트 부탁드립니다.
추가로, 공통적인 코멘트를 여기에 남기자면 final 키워드가 전반적으로 빠져있는데요, 이를 보강하면 좋을 것 같습니다.
감사합니다.
return user; | ||
} | ||
} | ||
return null; |
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.
혹시 null을 반환하지 않고 흐름을 제어하는 것에 대해서는 어떻게 생각하시나요?
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.
분기가 너무 많긴하네요..!
예외로 처리 후, 예외에 따른 페이지로 이동하는 쪽으로 해보겠습니다!
final User user = new User(account, password, email); | ||
InMemoryUserRepository.save(user); | ||
} catch (NullPointerException e) { | ||
e.getStackTrace(); |
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.
1,2 단계에서 시간이 급해서 요구사항만 만족하도록 구현했습니다.
} | ||
|
||
public String getJsessionid() { | ||
return cookies.getOrDefault(JSESSIONID, null); |
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.
여기서도 null을 반환하고 있네요
new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { | ||
|
||
final HttpRequest request = new HttpRequest(bufferedReader); | ||
final Controller controller = controllerAdapter.findController(request); |
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.
Controller 로직을 잘 구현하신 것 같아요!
"Content-Type: " + contentType.getValue() + ";charset=utf-8 ", | ||
"Content-Length: " + responseBody.getBytes().length + " "); |
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.
반영하였습니다!
private final HttpMethod method; | ||
private final String uri; | ||
private final String version; | ||
private final Map<String, String> headers = new HashMap<>(); | ||
private HttpCookie cookie; | ||
private Map<String, String> requestBody; | ||
|
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.
HttpMethod와 HttpCookie 구현해주신거 잘 봤습니다. 그런데 혹시 나머지 요소들을 객체화 하실건지 궁금한데요.
3단계 요구사항이긴 하지만, 일부분은 객체화 하셔서 질문드립니다.
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 void initRequestBody(final BufferedReader bufferedReader) throws IOException { | ||
if (headers.containsKey("Content-Length")) { | ||
this.requestBody = new HashMap<>(); | ||
int contentLength = Integer.parseInt(headers.get("Content-Length")); |
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.
상수화 하겠습니다~!
Kudos, SonarCloud Quality Gate passed! 0 Bugs 0.0% Coverage The version of Java (11.0.20.1) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. |
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.
요구사항 만족하신 것 같아서 1,2단계는 마무리 해도 될 것 같습니다. 3,4단계에서 다시 뵙겠습니다.
if (headers.containsHeader("Content-Length")) { | ||
int contentLength = Integer.parseInt(headers.get("Content-Length")); |
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.
Content-Length도 상수화할 수 있겠네요
안녕하세요. 엔델 🙇♂️
1,2 단계 리뷰 요청드립니다!
Http11Processor 에서 inputStream으로 HttpRequest를 생성하고
request에 해당하는 컨트롤러를 찾아서 해당 컨트롤러가 작업 후 HttpResponse를 반환하는 형식으로 구현하였습니다.
편하게 시간에 편하게 리뷰 부탁드립니다 ~! 🙇♂️