-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#16 Log messaging headers
- Loading branch information
Showing
11 changed files
with
62 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lsd-interceptors/src/main/java/io/lsdconsulting/interceptors/http/LsdOkHttpInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
lsd-interceptors/src/main/java/io/lsdconsulting/interceptors/messaging/HtmlRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.lsdconsulting.interceptors.messaging; | ||
|
||
import org.springframework.messaging.MessageHeaders; | ||
|
||
import static j2html.TagCreator.*; | ||
import static java.lang.System.lineSeparator; | ||
import static java.util.stream.Collectors.joining; | ||
import static org.apache.commons.lang3.StringUtils.isEmpty; | ||
|
||
public class HtmlRenderer { | ||
public static String renderHtmlFor(MessageHeaders messageHeaders, String prettyBody) { | ||
return p( | ||
p(h4("Message Headers"), code(prettyPrintHeaders(messageHeaders))) | ||
, isEmpty(prettyBody) | ||
? p() | ||
: p(h4("Body"), code(prettyBody) | ||
) | ||
).render(); | ||
} | ||
|
||
private static String prettyPrintHeaders(MessageHeaders requestHeaders) { | ||
return requestHeaders.entrySet().stream().map(entry -> | ||
entry.getKey() + ": " + entry.getValue()) | ||
.collect(joining(lineSeparator())); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...est/java/io/lsdconsulting/interceptors/http/common/DefaultHttpInteractionHandlerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters