Package swiss.trustbroker.waf
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
ConstructorsConstructorDescriptionCatchAllAndOpTraceFilter(GlobalExceptionHandler globalExceptionHandler, TrustBrokerProperties trustBrokerProperties) -
Method Summary
Modifier and TypeMethodDescriptionvoiddoFilter(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, initMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.Filter
destroy
-
Constructor Details
-
CatchAllAndOpTraceFilter
public CatchAllAndOpTraceFilter(GlobalExceptionHandler globalExceptionHandler, TrustBrokerProperties trustBrokerProperties)
-
-
Method Details
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) - Specified by:
doFilterin interfacejakarta.servlet.Filter- Overrides:
doFilterin classswiss.trustbroker.common.tracing.RequestContextFilter
-