Class CatchAllAndOpTraceFilter

java.lang.Object
swiss.trustbroker.common.tracing.RequestContextFilter
swiss.trustbroker.waf.CatchAllAndOpTraceFilter
All Implemented Interfaces:
jakarta.servlet.Filter

@Component @Order(-2147483647) public class CatchAllAndOpTraceFilter extends swiss.trustbroker.common.tracing.RequestContextFilter
Springify OpTrace filter and add a UUID and client IP in a thread-local so: - GlobalException catcher can send UUID to the user to find the logs - Logback via the logging.pattern.console: ... [%X{clientIp:-}] [%X{traceId:-}] ... can annotate all log lines. Note that not annotating the fields with clientIp=x and traceId=y is to save some bytes we log. UUID and IP address searches work quite well this way.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CatchAllAndOpTraceFilter(GlobalExceptionHandler globalExceptionHandler, TrustBrokerProperties trustBrokerProperties)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain)
     

    Methods inherited from class swiss.trustbroker.common.tracing.RequestContextFilter

    getCalledMethod, getClientId, getTraceId, getUserName, init

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface jakarta.servlet.Filter

    destroy
  • Constructor Details

  • Method Details

    • doFilter

      public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain)
      Specified by:
      doFilter in interface jakarta.servlet.Filter
      Overrides:
      doFilter in class swiss.trustbroker.common.tracing.RequestContextFilter