-
Notifications
You must be signed in to change notification settings - Fork 271
Open
Description
We have implemented custom sink for logbook logging(version 2.13.0):
@Bean
Sink customizedLogbookSink(HttpLogFormatter formatter, HttpLogWriter writer) {
return new CustomSink(formatter, writer);
}
Within this class is is possibe to get HttpRequest from zalando library but we want to have get original HttpServletRequest which is wrapped in 3rd level via delegate method.
Is possible to simply get this class if exists and get access to its attributes? For this moment when debuging it following code works for me but it can depend in concrete release or configuration:
if (request instanceof ForwardingHttpRequest) {//FilteredHttpRequest
HttpRequest delegate1 = ((ForwardingHttpRequest) request).delegate();
if (delegate1 instanceof ForwardingHttpRequest) {//CachingHttpRequest
HttpRequest delegate2 = ((ForwardingHttpRequest) delegate1).delegate();
if (delegate2 instanceof HttpServletRequest) {//RemoteRequest
HttpServletRequest servletRequest = ((HttpServletRequest) delegate2);
Object attribute = servletRequest.getAttribute("importantAttributeKey");
System.out.println(attribute);
}
}
}
thanks
DidierLoiseau
Metadata
Metadata
Assignees
Labels
No labels