-
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단계] 마코(이규성) 미션 제출합니다. #332
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9303da4
feat: 1단계 - HTTP 서버 구현하기
aak2075 a9f593d
feat: 2단계 - 1.HTTP Status Code 302
aak2075 f64db47
feat: 2단계 - 2. POST 방식으로 회원가입
aak2075 2b05c7c
feat: 2단계 - 3,4 Cookie에 JSESSIONID 값 저장하기 및 Session 구현하기
aak2075 3069ea7
refactor: 개행 정리 및 불필요한 메서드 제거
aak2075 dc50303
refactor: 상수 대문자로 변경
aak2075 00417a7
refactor: 뷰 리졸버 분리 리팩토링
aak2075 7bc374c
refactor: RequestBuilder 도입
aak2075 91004b2
refactor: 사용하지 않는 import 제거
aak2075 d24f44f
refactor: 패키지 이동
aak2075 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package common; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
public class FileReader { | ||
|
||
private static final String STATIC_RESOURCE_PATH = "static"; | ||
private static final String EXTENSION_HTML = ".html"; | ||
|
||
private FileReader() { | ||
} | ||
|
||
public static String readFile(String uri) throws IOException { | ||
URL resource = findResource(uri); | ||
Path path = Paths.get(resource.getFile()); | ||
return new String(Files.readAllBytes(path)); | ||
} | ||
|
||
private static URL findResource(String fileName) { | ||
URL resource = FileReader.class.getClassLoader() | ||
.getResource(STATIC_RESOURCE_PATH + fileName); | ||
if (resource == null) { | ||
fileName = fileName + EXTENSION_HTML; | ||
resource = FileReader.class.getClassLoader() | ||
.getResource(STATIC_RESOURCE_PATH + fileName); | ||
} | ||
if (resource == null) { | ||
return FileReader.class.getClassLoader() | ||
.getResource(STATIC_RESOURCE_PATH + "/404.html"); | ||
} | ||
return resource; | ||
} | ||
} |
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.
DEFAULT_FILE_EXTENSION 은 어떤가요?!
기본 확장자가 .html인걸 더 잘 알려주는 것 같아요!