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

[톰캣 구현하기 1,2단계] 호이(이건호) 미션 제출합니다. #313

Merged
merged 31 commits into from
Sep 11, 2023

Conversation

This2sho
Copy link

@This2sho This2sho commented Sep 4, 2023

안녕하세요. 엔델 🙇‍♂️

1,2 단계 리뷰 요청드립니다!

Http11Processor 에서 inputStream으로 HttpRequest를 생성하고
request에 해당하는 컨트롤러를 찾아서 해당 컨트롤러가 작업 후 HttpResponse를 반환하는 형식으로 구현하였습니다.

편하게 시간에 편하게 리뷰 부탁드립니다 ~! 🙇‍♂️

@This2sho This2sho self-assigned this Sep 4, 2023
Copy link

@SproutMJ SproutMJ left a 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;
Copy link

Choose a reason for hiding this comment

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

혹시 null을 반환하지 않고 흐름을 제어하는 것에 대해서는 어떻게 생각하시나요?

Copy link
Author

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();
Copy link

Choose a reason for hiding this comment

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

에러 핸들링이나 로깅은 따로 안하시는지 궁금합니다!

Copy link
Author

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);
Copy link

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);
Copy link

Choose a reason for hiding this comment

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

Controller 로직을 잘 구현하신 것 같아요!

Comment on lines 26 to 27
"Content-Type: " + contentType.getValue() + ";charset=utf-8 ",
"Content-Length: " + responseBody.getBytes().length + " ");
Copy link

Choose a reason for hiding this comment

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

상수화는 어떠신지 궁금합니다!

Copy link
Author

Choose a reason for hiding this comment

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

반영하였습니다!

Comment on lines 22 to 28
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;

Copy link

Choose a reason for hiding this comment

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

HttpMethod와 HttpCookie 구현해주신거 잘 봤습니다. 그런데 혹시 나머지 요소들을 객체화 하실건지 궁금한데요.
3단계 요구사항이긴 하지만, 일부분은 객체화 하셔서 질문드립니다.

Copy link
Author

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"));
Copy link

Choose a reason for hiding this comment

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

이 클래스에 매직넘버가 존재하는데 이를 상수화 하실지 의견을 듣고싶습니다!

Copy link
Author

Choose a reason for hiding this comment

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

상수화 하겠습니다~!

@sonarcloud
Copy link

sonarcloud bot commented Sep 10, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

warning 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.
Read more here

Copy link

@SproutMJ SproutMJ left a 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단계에서 다시 뵙겠습니다.

Comment on lines +50 to +51
if (headers.containsHeader("Content-Length")) {
int contentLength = Integer.parseInt(headers.get("Content-Length"));

Choose a reason for hiding this comment

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

Content-Length도 상수화할 수 있겠네요

@SproutMJ SproutMJ merged commit 29421f3 into woowacourse:this2sho Sep 11, 2023
2 checks passed
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