Class DSpaceAPIRequestLoggingFilter

java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.web.filter.OncePerRequestFilter
org.springframework.web.filter.AbstractRequestLoggingFilter
org.dspace.app.rest.utils.DSpaceAPIRequestLoggingFilter
All Implemented Interfaces:
javax.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

public class DSpaceAPIRequestLoggingFilter extends org.springframework.web.filter.AbstractRequestLoggingFilter
This class setup the basic attributes in Mapped Diagnostic Context useful for trouble-shooting of the DSpace Server Webapp and make sure to include a first log entry for all the request nothing which is the referer. This logging filter can be modified at runtime altering the value of the logging.server.* configuration properties to include more details about the incoming request (payload, headers, query string, client info) The MDC attributes are as follow: - an unique randomly generated UUID is assigned to every request (requestID) - the correlation ID provided by friendly client applications (such as our angular UI), if specified as X-Correlation-ID (correlationID)
Author:
Andrea Bollini (andrea.bollini at 4science.it)
  • Field Summary

    Fields inherited from class org.springframework.web.filter.AbstractRequestLoggingFilter

    DEFAULT_AFTER_MESSAGE_PREFIX, DEFAULT_AFTER_MESSAGE_SUFFIX, DEFAULT_BEFORE_MESSAGE_PREFIX, DEFAULT_BEFORE_MESSAGE_SUFFIX

    Fields inherited from class org.springframework.web.filter.OncePerRequestFilter

    ALREADY_FILTERED_SUFFIX

    Fields inherited from class org.springframework.web.filter.GenericFilterBean

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    afterRequest(javax.servlet.http.HttpServletRequest request, String message)
     
    protected void
    beforeRequest(javax.servlet.http.HttpServletRequest request, String message)
     
    protected int
     
    protected boolean
     
    protected boolean
     
    protected boolean
     
    protected boolean
     
    protected boolean
    shouldLog(javax.servlet.http.HttpServletRequest request)
     

    Methods inherited from class org.springframework.web.filter.AbstractRequestLoggingFilter

    createMessage, doFilterInternal, getHeaderPredicate, getMessagePayload, setAfterMessagePrefix, setAfterMessageSuffix, setBeforeMessagePrefix, setBeforeMessageSuffix, setHeaderPredicate, setIncludeClientInfo, setIncludeHeaders, setIncludePayload, setIncludeQueryString, setMaxPayloadLength, shouldNotFilterAsyncDispatch

    Methods inherited from class org.springframework.web.filter.OncePerRequestFilter

    doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterErrorDispatch

    Methods inherited from class org.springframework.web.filter.GenericFilterBean

    addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DSpaceAPIRequestLoggingFilter

      public DSpaceAPIRequestLoggingFilter()
  • Method Details

    • shouldLog

      protected boolean shouldLog(javax.servlet.http.HttpServletRequest request)
      Overrides:
      shouldLog in class org.springframework.web.filter.AbstractRequestLoggingFilter
    • isIncludePayload

      protected boolean isIncludePayload()
      Overrides:
      isIncludePayload in class org.springframework.web.filter.AbstractRequestLoggingFilter
    • isIncludeHeaders

      protected boolean isIncludeHeaders()
      Overrides:
      isIncludeHeaders in class org.springframework.web.filter.AbstractRequestLoggingFilter
    • isIncludeQueryString

      protected boolean isIncludeQueryString()
      Overrides:
      isIncludeQueryString in class org.springframework.web.filter.AbstractRequestLoggingFilter
    • isIncludeClientInfo

      protected boolean isIncludeClientInfo()
      Overrides:
      isIncludeClientInfo in class org.springframework.web.filter.AbstractRequestLoggingFilter
    • getMaxPayloadLength

      protected int getMaxPayloadLength()
      Overrides:
      getMaxPayloadLength in class org.springframework.web.filter.AbstractRequestLoggingFilter
    • beforeRequest

      protected void beforeRequest(javax.servlet.http.HttpServletRequest request, String message)
      Specified by:
      beforeRequest in class org.springframework.web.filter.AbstractRequestLoggingFilter
    • afterRequest

      protected void afterRequest(javax.servlet.http.HttpServletRequest request, String message)
      Specified by:
      afterRequest in class org.springframework.web.filter.AbstractRequestLoggingFilter