Gitlab - Argos ALM by PALO IT
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
http-reactive-ms
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Julian Pulido
http-reactive-ms
Commits
454f187b
Commit
454f187b
authored
Sep 11, 2023
by
Miguel Galindo Rodriguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added log for correlation id
parent
8be3a154
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
src/main/java/com/example/http/reactive/handler/LogWebFilter.java
.../java/com/example/http/reactive/handler/LogWebFilter.java
+26
-0
No files found.
src/main/java/com/example/http/reactive/handler/LogWebFilter.java
0 → 100644
View file @
454f187b
package
com.example.http.reactive.handler
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.WebFilter
;
import
org.springframework.web.server.WebFilterChain
;
import
reactor.core.publisher.Mono
;
@Slf4j
@Component
public
class
LogWebFilter
implements
WebFilter
{
private
static
String
correlationIdHeader
=
"X-Correlation-Id"
;
@Override
public
Mono
<
Void
>
filter
(
ServerWebExchange
exchange
,
WebFilterChain
chain
)
{
if
(
exchange
.
getRequest
().
getHeaders
().
containsKey
(
correlationIdHeader
))
{
List
<
String
>
correlationId
=
exchange
.
getRequest
().
getHeaders
().
get
(
correlationIdHeader
);
log
.
info
(
"External Correlation Id:[{}]"
,
correlationId
);
exchange
.
getResponse
().
getHeaders
().
addAll
(
correlationIdHeader
,
correlationId
);
}
return
chain
.
filter
(
exchange
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment