-
Notifications
You must be signed in to change notification settings - Fork 310
[1 -2단계 - Tomcat 구현하기] 릴리(최윤서) 미션 제출합니다. #528
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
Merged
+817
−70
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fed02f6
fix: remove implementation logback-classic on gradle (#501)
geoje 7e91356
fix: add threads min-spare configuration on properties (#502)
geoje 0a57c01
feat: http 서버 구현
lilychoibb 9fc9c7e
feat: 로그인 구현
lilychoibb e192357
refactor: was, controller, session 분리
lilychoibb a86389d
test: 학습 테스트
lilychoibb 568e37c
feat: 학습테스트 구현
lilychoibb 1afb92c
refactor: http 패키지 이동
lilychoibb eae383d
refactor: requestBody 필드로 추출
lilychoibb f6f29c6
refactor: httpVersion 및 statusCode 객체 분리
lilychoibb 605778a
refactor: requestMethod enum으로 분리
lilychoibb b7d96b3
refactor: 불필요한 if 문 제거 및 early return
lilychoibb 6ffe192
refactor: stream으로 변경
lilychoibb 2a4fb9f
refactor: header에서 cookie 인자를 받아 꺼내도록 변경
lilychoibb 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 hidden or 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 hidden or 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
15 changes: 15 additions & 0 deletions
15
study/src/main/java/cache/com/example/cachecontrol/CacheWebConfig.java
This file contains hidden or 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,28 @@ | ||
package cache.com.example.cachecontrol; | ||
|
||
import cache.com.example.version.ResourceVersion; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.CacheControl; | ||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
import org.springframework.web.servlet.mvc.WebContentInterceptor; | ||
|
||
@Configuration | ||
public class CacheWebConfig implements WebMvcConfigurer { | ||
|
||
public static final String PREFIX_STATIC_RESOURCES = "/resources"; | ||
|
||
private final ResourceVersion version; | ||
|
||
public CacheWebConfig(final ResourceVersion version) { | ||
this.version = version; | ||
} | ||
|
||
@Override | ||
public void addInterceptors(final InterceptorRegistry registry) { | ||
WebContentInterceptor interceptor = new WebContentInterceptor(); | ||
interceptor.addCacheMapping(CacheControl.noCache().cachePrivate(), "/*"); | ||
registry.addInterceptor(interceptor) | ||
.excludePathPatterns(PREFIX_STATIC_RESOURCES + "/" + version.getVersion() + "/**"); | ||
} | ||
} |
23 changes: 19 additions & 4 deletions
23
study/src/main/java/cache/com/example/etag/EtagFilterConfiguration.java
This file contains hidden or 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,12 +1,27 @@ | ||
package cache.com.example.etag; | ||
|
||
import cache.com.example.version.ResourceVersion; | ||
import org.springframework.boot.web.servlet.FilterRegistrationBean; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.filter.ShallowEtagHeaderFilter; | ||
|
||
@Configuration | ||
public class EtagFilterConfiguration { | ||
|
||
// @Bean | ||
// public FilterRegistrationBean<ShallowEtagHeaderFilter> shallowEtagHeaderFilter() { | ||
// return null; | ||
// } | ||
public static final String PREFIX_STATIC_RESOURCES = "/resources"; | ||
|
||
private final ResourceVersion version; | ||
|
||
public EtagFilterConfiguration(final ResourceVersion version) { | ||
this.version = version; | ||
} | ||
|
||
@Bean | ||
public FilterRegistrationBean<ShallowEtagHeaderFilter> shallowEtagHeaderFilter() { | ||
final FilterRegistrationBean<ShallowEtagHeaderFilter> registration = new FilterRegistrationBean<>(); | ||
registration.setFilter(new ShallowEtagHeaderFilter()); | ||
registration.addUrlPatterns("/etag", PREFIX_STATIC_RESOURCES + "/" + version.getVersion() + "/*"); | ||
return registration; | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
24 changes: 24 additions & 0 deletions
24
tomcat/src/main/java/com/techcourse/controller/AbstractController.java
This file contains hidden or 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,24 @@ | ||
package com.techcourse.controller; | ||
|
||
import org.apache.coyote.http.HttpRequest; | ||
import org.apache.coyote.http.HttpResponse; | ||
import org.apache.coyote.http.RequestMethod; | ||
|
||
public abstract class AbstractController implements Controller { | ||
|
||
@Override | ||
public void service(HttpRequest request, HttpResponse.HttpResponseBuilder response) throws Exception { | ||
RequestMethod method = request.getMethod(); | ||
if (method.isGetMethod()) { | ||
doGet(request, response); | ||
} | ||
|
||
if (method.isPostMethod()) { | ||
doPost(request, response); | ||
} | ||
} | ||
|
||
protected abstract void doGet(HttpRequest request, HttpResponse.HttpResponseBuilder response) throws Exception; | ||
|
||
protected abstract void doPost(HttpRequest request, HttpResponse.HttpResponseBuilder response); | ||
} |
9 changes: 9 additions & 0 deletions
9
tomcat/src/main/java/com/techcourse/controller/Controller.java
This file contains hidden or 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,9 @@ | ||
package com.techcourse.controller; | ||
|
||
import org.apache.coyote.http.HttpRequest; | ||
import org.apache.coyote.http.HttpResponse; | ||
|
||
public interface Controller { | ||
|
||
void service(HttpRequest request, HttpResponse.HttpResponseBuilder response) throws Exception; | ||
} |
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.
/com.techcourse.controller
에 위치해 있는데, 이 클래스는 해당 서비스가 다뤄야할 부분은 아닌 것 같다는 생각이 들어요현재 패키지 구조에서
/com/techcourse/
에는 해당 애플리케이션의 고유한 비즈니스 플로우가 담겨야 할 것 같다는 생각인데요, 🤔릴리는 어떻게 생각하시는지 궁금합니당
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.
저도 같은 생각입니다!
/org.apache.catalina.controller
에 두었습니다