クラス 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 over maxMDCValueLength
    protected final void
    doFilterInternal(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain filterChain)
    Stores the information in MDC 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 in MDC
    protected abstract String
    getMDCValue(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Returns the value to be stored in in MDC
    void
    setMaxMDCValueLength(int maxMDCValueLength)
    set max value length to put MDC
    void
    setRemoveValue(boolean removeValue)
    Sets the flag that controls whether the value created by this filter should also be remove from MDC.

    クラスから継承されたメソッド 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

    クラスから継承されたメソッド java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • コンストラクタの詳細

    • 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 from MDC.

      true should be set if value set in this filter should be remove from MDC
      If this method is not called or false is set in this method, the value set in this filter will be keep in MDC

      Points to Note:
      If false is specified here, always use this filter along with MDCClearFilter which clears the values stored in MDC.
      If MDCClearFilter is not used, should be specified true.

      パラメータ:
      removeValue - Flag that controls whether the value created by this filter should also be remove from MDC.
    • 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

      protected String cutValue(String value)
      cut the given string if the size of it is over maxMDCValueLength
      パラメータ:
      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 in MDC 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 - If ServletException occurs in further in the execution chain
      IOException - If IOException 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 in MDC
      パラメータ:
      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 in MDC
      パラメータ:
      request - HttpServletRequest
      response - HttpServletResponse
      戻り値:
      Value to be stored in MDC