Skip to content

Commit

Permalink
DRAW-262 fix: Api Logging Filter UrlFilter 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
comforest committed Aug 24, 2024
1 parent 49a2e43 commit f03dca4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.xorker.draw.log

import org.springframework.boot.web.servlet.FilterRegistrationBean
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.core.Ordered

@Configuration
class ApiLoggerFilterConfig {
@Bean
fun apiLogFilter(filter: ApiLoggingFilter): FilterRegistrationBean<ApiLoggingFilter> {
val bean = FilterRegistrationBean<ApiLoggingFilter>()

bean.filter = filter
bean.order = Ordered.HIGHEST_PRECEDENCE
bean.urlPatterns = listOf("/api/*")

return bean
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,14 @@ import jakarta.servlet.Filter
import jakarta.servlet.FilterChain
import jakarta.servlet.ServletRequest
import jakarta.servlet.ServletResponse
import jakarta.servlet.annotation.WebFilter
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import org.slf4j.MDC
import org.springframework.core.Ordered
import org.springframework.core.annotation.Order
import org.springframework.stereotype.Component
import org.springframework.web.util.ContentCachingRequestWrapper
import org.springframework.web.util.ContentCachingResponseWrapper

@Component
@WebFilter(urlPatterns = ["/api/*"])
@Order(Ordered.HIGHEST_PRECEDENCE)
class ApiLoggingFilter(
private val objectMapper: ObjectMapper,
) : Filter {
Expand Down

0 comments on commit f03dca4

Please sign in to comment.