-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1 - 2 단계 Tomcat 구현하기] 마크(김승현) 미션 제출합니다. (#580)
* fix: remove implementation logback-classic on gradle (#501) * fix: add threads min-spare configuration on properties (#502) * test: FileTest 및 IOStreamTest 통과 * chore: lombok 의존성 추가 * feat: 1-1 'GET /index.html 응답하기' 기능 구현 * feat: 1-2 CSS 지원하기 기능 구현 - MimeType 열거형 추가 - 정적 URI를 못찾을 시 404 반환 * refactor: getResponse 로직 메서드 분리 * refactor: 간단한 예외처리 추가 * refactor(HttpRequest): path와 parameters 추가 및 파싱 * feat: 1-3 Query String 파싱 구현 * feat: 2-1 로그인 여부에 따라 페이지 이동 구현 * refactor: HttpResponse 객체 추가 * refactor: 메서드 인자 및 이름 변경 - getStaticResource(HttpRequest request) -> getStaticResourceResponse(String requestPath) * fix: 템플릿 엔진 미사용 * test: 휴리스틱 캐싱 제거 - CacheControlInterceptor 추가 * test: HTTP Compression 설정 * fix: 알맞은 resource 이름 반환 * test: ETag/If-None-Match 적용 - ShallowEtagHeaderFilter 사용 * test: 캐시 무효화 - 캐시 max-age 1년 설정 - ETag 적용 - url에 버전 적용 * feat: POST 방식으로 회원가입 - 요청 본문 파싱 로직 수정 * fix: 파라미터 없는 /login 접속 불가능 수정 * fix: 요청 본문 URLDecode * fix: Cookie에 JSESSIONID 값 저장 - HttpCookie 객체 구현 및 요청, 응답 객체에 추가 * feat: Session 구현 * refactor: 요청 URL 디코딩 * refactor: application/x-www-form-urlencoded MIME 타입 요청 본문 값을 파라미터로 처리 * refactor(HttpResponse): 생성자 추가 * refactor(HttpResponse): 상태 코드 및 메시지 열거형 분리 - enum HttpStatusCode --------- Co-authored-by: Gyeongho Yang <[email protected]>
- Loading branch information
1 parent
0b698a2
commit 0200db3
Showing
23 changed files
with
677 additions
and
132 deletions.
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
21 changes: 21 additions & 0 deletions
21
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,21 @@ | ||
package cache.com.example.cachecontrol; | ||
|
||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import org.springframework.http.CacheControl; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.web.servlet.HandlerInterceptor; | ||
import org.springframework.web.servlet.ModelAndView; | ||
|
||
public class CacheControlInterceptor implements HandlerInterceptor { | ||
|
||
@Override | ||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, | ||
ModelAndView modelAndView) throws Exception { | ||
final String cacheControl = CacheControl | ||
.noCache() | ||
.cachePrivate() | ||
.getHeaderValue(); | ||
response.addHeader(HttpHeaders.CACHE_CONTROL, cacheControl); | ||
} | ||
} |
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
14 changes: 10 additions & 4 deletions
14
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,18 @@ | ||
package cache.com.example.etag; | ||
|
||
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; | ||
// } | ||
@Bean | ||
public FilterRegistrationBean<ShallowEtagHeaderFilter> shallowEtagHeaderFilter() { | ||
final var filter = new ShallowEtagHeaderFilter(); | ||
final var registrationBean = new FilterRegistrationBean<>(filter); | ||
registrationBean.addUrlPatterns("/etag"); | ||
return registrationBean; | ||
} | ||
} |
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
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.