Skip to content

Commit

Permalink
feat : add eTag response
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Diger committed Feb 28, 2024
1 parent 5280614 commit 22095d0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public ResponseEntity<ApiResponse<NoOffsetPaginationResponse<LectureWithOptional
public ResponseEntity<LectureAndCountResponseForm> findAllLectureApi(
@RequestParam(required = false) String option,
@RequestParam(required = false) Integer page,
@RequestParam(required = false) String majorType) {
@RequestParam(required = false) String majorType
) {

LectureFindOption findOption = new LectureFindOption(option, page, majorType);
LectureAndCountResponseForm response = lectureService.readAllLecture(findOption);
Expand All @@ -81,7 +82,8 @@ public ResponseEntity<LectureAndCountResponseForm> findAllLectureApi(
@GetMapping
public ResponseEntity<ResponseForm> findLectureByLectureId(
@RequestParam Long lectureId,
@RequestHeader String Authorization) {
@RequestHeader String Authorization
) {

if (jwtAgent.getUserIsRestricted(Authorization)) {
throw new AccountException(USER_RESTRICTED);
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/usw/suwiki/global/config/ETagConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package usw.suwiki.global.config;

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 ETagConfig {

@Bean
public ShallowEtagHeaderFilter shallowEtagHeaderFilter() {
FilterRegistrationBean<ShallowEtagHeaderFilter> filterFilterRegistrationBean = new FilterRegistrationBean<>(
new ShallowEtagHeaderFilter()
);

filterFilterRegistrationBean.addUrlPatterns("/lecture/all");
filterFilterRegistrationBean.setName("etagFilter");
return new ShallowEtagHeaderFilter();
}

}

0 comments on commit 22095d0

Please sign in to comment.