クラス AbstractMDCPutFilter
java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.web.filter.OncePerRequestFilter
org.terasoluna.gfw.web.logging.mdc.AbstractMDCPutFilter
- すべての実装されたインタフェース:
jakarta.servlet.Filter
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.EnvironmentAware
,org.springframework.core.env.EnvironmentCapable
,org.springframework.web.context.ServletContextAware
- 直系の既知のサブクラス:
XTrackMDCPutFilter
public abstract class AbstractMDCPutFilter
extends org.springframework.web.filter.OncePerRequestFilter
Abstract class of Servlet Filter that encloses the values required for log output, in
MDC
.
Key and value are fetched using getMDCKey(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)
and getMDCValue(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)
respectively and stored in MDC
.
-
フィールドの概要
クラスから継承されたフィールド org.springframework.web.filter.OncePerRequestFilter
ALREADY_FILTERED_SUFFIX
クラスから継承されたフィールド org.springframework.web.filter.GenericFilterBean
logger
-
コンストラクタの概要
-
メソッドの概要
修飾子とタイプメソッド説明protected String
cut the given string if the size of it is overmaxMDCValueLength
protected final void
doFilterInternal
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain filterChain) Stores the information inMDC
and calls the next filter in chain.protected abstract String
getMDCKey
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Fetches the key for setting the value inMDC
protected abstract String
getMDCValue
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Returns the value to be stored in inMDC
void
setMaxMDCValueLength
(int maxMDCValueLength) set max value length to put MDCvoid
setRemoveValue
(boolean removeValue) Sets the flag that controls whether the value created by this filter should also be remove fromMDC
.クラスから継承されたメソッド org.springframework.web.filter.OncePerRequestFilter
doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch, shouldNotFilterErrorDispatch
クラスから継承されたメソッド org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
-
コンストラクタの詳細
-
AbstractMDCPutFilter
public AbstractMDCPutFilter()
-
-
メソッドの詳細
-
setRemoveValue
public void setRemoveValue(boolean removeValue) Sets the flag that controls whether the value created by this filter should also be remove fromMDC
.true
should be set if value set in this filter should be remove fromMDC
If this method is not called orfalse
is set in this method, the value set in this filter will be keep inMDC
Points to Note:
Iffalse
is specified here, always use this filter along withMDCClearFilter
which clears the values stored inMDC
.
IfMDCClearFilter
is not used, should be specifiedtrue
.- パラメータ:
removeValue
- Flag that controls whether the value created by this filter should also be remove fromMDC
.
-
setMaxMDCValueLength
public void setMaxMDCValueLength(int maxMDCValueLength) set max value length to put MDC
if specified value is negative, does not cut MDC value.
- パラメータ:
maxMDCValueLength
- max value length to put MDC
-
cutValue
cut the given string if the size of it is overmaxMDCValueLength
- パラメータ:
value
- original value- 戻り値:
- cut value
-
doFilterInternal
protected final void doFilterInternal(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain filterChain) throws jakarta.servlet.ServletException, IOException Stores the information inMDC
and calls the next filter in chain. Information fetching is to be implemented in subclass of this class.- 定義:
doFilterInternal
クラス内org.springframework.web.filter.OncePerRequestFilter
- パラメータ:
request
-HttpServletRequest
response
-HttpServletResponse
filterChain
-FilterChain
- 例外:
jakarta.servlet.ServletException
- IfServletException
occurs in further in the execution chainIOException
- IfIOException
occurs in further in the execution chain- 関連項目:
-
OncePerRequestFilter.doFilterInternal(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.FilterChain)
-
getMDCKey
protected abstract String getMDCKey(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Fetches the key for setting the value inMDC
- パラメータ:
request
-HttpServletRequest
response
-HttpServletResponse
- 戻り値:
- Key to store the value in
MDC
-
getMDCValue
protected abstract String getMDCValue(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Returns the value to be stored in inMDC
- パラメータ:
request
-HttpServletRequest
response
-HttpServletResponse
- 戻り値:
- Value to be stored in
MDC
-