Skip to content

Commit

Permalink
4주차 PR 코드 리뷰 피드백을 토대로 코드 수정 Merge
Browse files Browse the repository at this point in the history
#85 4주차 PR 코드 리뷰 피드백을 토대로 코드 수정
  • Loading branch information
Train0303 authored Oct 8, 2023
2 parents b10d19d + 7c91323 commit 90e16fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class HttpConnectionConfig {
@Bean
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder){
return restTemplateBuilder
// .setConnectTimeout(Duration.ofMillis(5000)) //읽기시간초과, ms
// .setReadTimeout(Duration.ofMillis(5000)) //연결시간초과, ms
.setConnectTimeout(Duration.ofMillis(5000)) // 연결시간초과, ms
// .setReadTimeout(Duration.ofMillis(5000)) // 읽기시간초과, ms
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@RequiredArgsConstructor
public enum RedisExceptionStatus implements BaseExceptionStatus {
REFRESH_TOKEN_NOT_FOUND("Redis에 존재하지 않는 Refresh토큰입니다.", 404),
REFRESH_TOKEN_NOT_FOUND("존재하지 않는 Refresh토큰입니다.", 404),
BLACKLIST_TOKEN("블랙리스트에 존재하는 토큰입니다.", 403);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ public class JwtExceptionFilter extends OncePerRequestFilter {
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
try {
filterChain.doFilter(request, response);
} catch (JWTVerificationException | JWTCreationException e) {
setJwtExceptionResponse(request, response, e);
} catch (Exception403 e) {
} catch (JWTVerificationException | JWTCreationException | Exception403 e) {
setForbiddenResponse(request, response, e);
}
}
Expand All @@ -42,9 +40,9 @@ private void setJwtExceptionResponse(HttpServletRequest request, HttpServletResp
response.getOutputStream().write(om.writeValueAsBytes(ApiUtils.error(exception.getMessage(), HttpStatus.UNAUTHORIZED.value())));
}

private void setForbiddenResponse(HttpServletRequest request, HttpServletResponse response, Exception403 exception) throws IOException {
private void setForbiddenResponse(HttpServletRequest request, HttpServletResponse response, Throwable exception) throws IOException {
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setStatus(HttpStatus.FORBIDDEN.value());
response.getOutputStream().write(om.writeValueAsBytes(exception.body()));
response.getOutputStream().write(om.writeValueAsBytes(ApiUtils.error(exception.getMessage(), HttpStatus.FORBIDDEN.value())));
}
}

0 comments on commit 90e16fa

Please sign in to comment.