-
Notifications
You must be signed in to change notification settings - Fork 311
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단계] 재즈(함석명) 미션 제출합니다. #581
Merged
Merged
Changes from all commits
Commits
Show all changes
31 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 b1871e8
test: File 학습 테스트
seokmyungham 97af7b2
test: IOStream 학습 테스트
seokmyungham 50f9b6a
feat: index.html 응답 기능 추가
seokmyungham b628ead
feat: ContentType Enum 정의
seokmyungham 0a8101e
feat: 요청 URI 확장자에 따라 ContentType을 동적으로 응답
seokmyungham 024165d
feat: 로그인 HTML 응답 기능 추가
seokmyungham e5cd643
feat: 로그인 시 성공, 실패 여부에 따라 리다이렉트 처리
seokmyungham 23f9092
feat: HTTP GET 메서드 조건을 추가
seokmyungham 2c65d2d
feat: 로그인 요청을 GET에서 POST로 변경
seokmyungham d66eedf
feat: 회원가입 HTML 응답 기능 추가
seokmyungham f31812d
feat: 회원가입 기능 추가
seokmyungham a56d23a
refactor: 로그인 성공 로그 메시지 변경
seokmyungham 1b7af13
feat: 로그인 성공 시 JSESSIONID 쿠키를 반환하는 기능 추가
seokmyungham c7ba93e
feat: 세션 객체와 세션을 관리하는 세션 매니저 추가
seokmyungham 6eff5e8
feat: 로그인 성공 시 세션 저장소에 유저 세션을 저장
seokmyungham 606730b
feat: 로그인 페이지 접근 시 이미 로그인 상태일 경우 리다이렉트 처리
seokmyungham a15a1cb
refactor: HttpMethod Enum 정의
seokmyungham 7900c28
refactor: HttpStatus Enum 정의
seokmyungham a8569c3
refactor: RequestLine 정의
seokmyungham b815063
refactor: HttpRequest 정의
seokmyungham 536b2d8
feat: 휴리스틱 캐싱 제거 학습 테스트 추가
seokmyungham be0b642
feat: HTTP 응답 압축 학습 테스트 추가
seokmyungham ee9d484
feat: ETag/If-None-Match 적용 학습 테스트 추가
seokmyungham fa6ad24
feat: 캐시 무효화 학습 테스트 추가
seokmyungham 4654f58
refactor: RequestHeaders 구조 개선
seokmyungham 953992c
refactor: RequestLine에 HttpMethod를 물어보도록 개선
seokmyungham 12b4dba
refactor: 핸들러 분기 처리 개선
seokmyungham e92c2ec
move: ContentType 패키지 위치 이동
seokmyungham e72f18a
refactor: HttpResponse 공백 추가
seokmyungham 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
22 changes: 22 additions & 0 deletions
22
study/src/main/java/cache/com/example/cachecontrol/CacheControlInterceptor.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,22 @@ | ||
package cache.com.example.cachecontrol; | ||
|
||
import static com.google.common.net.HttpHeaders.CACHE_CONTROL; | ||
|
||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import org.springframework.http.CacheControl; | ||
import org.springframework.web.servlet.HandlerInterceptor; | ||
|
||
public class CacheControlInterceptor implements HandlerInterceptor { | ||
|
||
@Override | ||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { | ||
String cacheControl = CacheControl | ||
.noCache() | ||
.cachePrivate() | ||
.getHeaderValue(); | ||
|
||
response.setHeader(CACHE_CONTROL, cacheControl); | ||
return true; | ||
} | ||
} | ||
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
15 changes: 15 additions & 0 deletions
15
study/src/main/java/cache/com/example/cachecontrol/WebMvcConfig.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,15 @@ | ||
package cache.com.example.cachecontrol; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
@Configuration | ||
public class WebMvcConfig implements WebMvcConfigurer { | ||
|
||
@Override | ||
public void addResourceHandlers(ResourceHandlerRegistry registry) { | ||
registry.addResourceHandler("/**") | ||
.addResourceLocations("classpath:/templates/", "classpath:/static/"); | ||
} | ||
} |
25 changes: 21 additions & 4 deletions
25
study/src/main/java/cache/com/example/etag/EtagFilterConfiguration.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,12 +1,29 @@ | ||
package cache.com.example.etag; | ||
|
||
import static cache.com.example.version.CacheBustingWebConfig.PREFIX_STATIC_RESOURCES; | ||
|
||
import cache.com.example.version.ResourceVersion; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
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; | ||
// } | ||
private final ResourceVersion version; | ||
|
||
@Autowired | ||
public EtagFilterConfiguration(ResourceVersion version) { | ||
this.version = version; | ||
} | ||
|
||
@Bean | ||
public FilterRegistrationBean<ShallowEtagHeaderFilter> shallowEtagHeaderFilter() { | ||
FilterRegistrationBean<ShallowEtagHeaderFilter> filterRegistrationBean = new FilterRegistrationBean<>( | ||
new ShallowEtagHeaderFilter()); | ||
filterRegistrationBean.addUrlPatterns("/etag", PREFIX_STATIC_RESOURCES + "/" + version.getVersion() + "/*"); | ||
return filterRegistrationBean; | ||
} | ||
} |
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
3 changes: 1 addition & 2 deletions
3
study/src/main/java/cache/com/example/version/ResourceVersion.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
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
27 changes: 27 additions & 0 deletions
27
tomcat/src/main/java/org/apache/catalina/manager/Session.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,27 @@ | ||
package org.apache.catalina.manager; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class Session { | ||
|
||
private final String id; | ||
private final Map<String, Object> values; | ||
|
||
public Session(String id) { | ||
this.id = id; | ||
values = new HashMap<>(); | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setAttribute(String name, Object value) { | ||
values.put(name, value); | ||
} | ||
|
||
public void removeAttribute(String name) { | ||
values.remove(name); | ||
} | ||
} |
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.
스프링 단에서 캐시 설정을 위해
WebContentInterceptor
를 제공해주는데, 이를 이용해 보아도 좋을 것 같아욥!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.
오 캐시 정책과 관련하여 이미 제공해주는 인터셉터 구현체가 있었군요!!
알려주셔서 감사해요 낙낙 😊