-
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
[톰캣 구현하기 3, 4단계] 호이(이건호) 미션 제출합니다. #493
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
39ad6be
refactor: HttpRequest에서 RequestLine 객체로 분리
This2sho cea62d1
refactor: 요구 사항에 맞게 Controller 스펙 수정
This2sho 387248f
refactor: 요구 사항에 맞게 ControllerAdapter에서 RequestMapping으로 네이밍 변경
This2sho d005ae1
fix: ! 빠진거 수정
This2sho 4d32e91
study: 스레드
This2sho d777a36
study: 실행할 수 없는거 주석 처리
This2sho daf0b3d
feat: 동시성 적용
This2sho 991a9d3
refactor: final 키워드 적용
This2sho d351953
refactor: 비밀번호 오류 시 401 페이지 반환하도록 수정
This2sho d79a766
refactor: HttpResponse 기본값 구성
This2sho b89e6ad
fix: early return 빠진 부분 수정
This2sho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package thread.stage1; | ||
|
||
import java.util.LinkedList; | ||
|
||
public class Users { | ||
|
||
private final LinkedList<User> users; | ||
|
||
private Users(final LinkedList<User> users) { | ||
this.users = users; | ||
} | ||
|
||
public static Users from(final LinkedList<User> users) { | ||
return new Users(users); | ||
} | ||
|
||
public boolean contains(User user) { | ||
return users.contains(user); | ||
} | ||
|
||
public void add(User user) { | ||
users.add(user); | ||
} | ||
|
||
public int size() { | ||
return users.size(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tomcat/src/main/java/org/apache/coyote/http11/controller/AbstractController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.apache.coyote.http11.controller; | ||
|
||
import org.apache.coyote.http11.Controller; | ||
import org.apache.coyote.http11.request.HttpRequest; | ||
import org.apache.coyote.http11.response.HttpResponse; | ||
|
||
public abstract class AbstractController implements Controller { | ||
|
||
@Override | ||
public void service(final HttpRequest request, final HttpResponse response) throws Exception { | ||
if (request.isGetMethod()) { | ||
doGet(request, response); | ||
return; | ||
} | ||
doPost(request, response); | ||
} | ||
|
||
protected void doPost(final HttpRequest request, final HttpResponse response) throws Exception { /* NOOP */ } | ||
|
||
protected void doGet(final HttpRequest request, final HttpResponse response) throws Exception { /* NOOP */ } | ||
} |
13 changes: 9 additions & 4 deletions
13
tomcat/src/main/java/org/apache/coyote/http11/controller/ErrorController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
package org.apache.coyote.http11.controller; | ||
|
||
import org.apache.coyote.http11.Controller; | ||
import org.apache.coyote.http11.ContentType; | ||
import org.apache.coyote.http11.StatusCode; | ||
import org.apache.coyote.http11.ViewLoader; | ||
import org.apache.coyote.http11.request.HttpRequest; | ||
import org.apache.coyote.http11.response.HttpResponse; | ||
|
||
public class ErrorController implements Controller { | ||
public class ErrorController extends AbstractController { | ||
|
||
@Override | ||
public HttpResponse handle(final HttpRequest request) { | ||
return HttpResponse.toNotFound(); | ||
public void service(final HttpRequest request, final HttpResponse response) throws Exception { | ||
response | ||
.statusCode(StatusCode.NOT_FOUND) | ||
.contentType(ContentType.TEXT_HTML) | ||
.responseBody(ViewLoader.toNotFound()); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
에러 컨트롤러를 만들어서 핸들링하는 것도 좋은 것 같습니다.