Skip to content

Commit

Permalink
Correct typo for filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chavjoh committed Feb 3, 2024
1 parent e3d786b commit 2a5f1b3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ with the following MDC fields set:
Additional logging features can be activated using properties of the annotation:

```java
@Logged(requestBody = {LOG, MDC}, responseBody = {LOG, MDC}, filersBody = {YourBodyFilter.class})
@Logged(requestBody = {LOG, MDC}, responseBody = {LOG, MDC}, filtersBody = {YourBodyFilter.class})
```

* **requestBody**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/chavaillaz/jakarta/rs/Logged.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*
* @return The list of filters to be applied
*/
Class<? extends LoggedBodyFilter>[] filersBody() default {};
Class<? extends LoggedBodyFilter>[] filtersBody() default {};

/**
* Type of logging to be applied to the request and response body.
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/chavaillaz/jakarta/rs/LoggedFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ protected Set<LogType> responseBodyLogging() {
*
* @return The list of filters to be applied
*/
protected Set<LoggedBodyFilter> filersBody() {
protected Set<LoggedBodyFilter> filtersBody() {
return getAnnotation()
.map(Logged::filersBody)
.map(Logged::filtersBody)
.stream()
.flatMap(Stream::of)
.map(this::instantiateFilter)
Expand All @@ -299,7 +299,7 @@ protected Set<LoggedBodyFilter> filersBody() {
* @return The payload filtered
*/
protected String filterBody(String payload) {
for (LoggedBodyFilter filter : filersBody()) {
for (LoggedBodyFilter filter : filtersBody()) {
payload = filter.filterBody(payload);
}
return payload;
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/chavaillaz/jakarta/rs/LoggedFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,21 +239,21 @@ String getMdcLogged(LoggedField key) {
.orElse(null);
}

@Logged(requestBody = {LogType.MDC, LogType.LOG}, responseBody = {LogType.MDC, LogType.LOG}, filersBody = {SensitiveBodyFilter.class})
@Logged(requestBody = {LogType.MDC, LogType.LOG}, responseBody = {LogType.MDC, LogType.LOG}, filtersBody = {SensitiveBodyFilter.class})
interface AnnotatedResource {

void inherit();

@Logged(requestBody = {LogType.MDC, LogType.LOG}, responseBody = {LogType.MDC, LogType.LOG}, filersBody = SensitiveBodyFilter.class)
@Logged(requestBody = {LogType.MDC, LogType.LOG}, responseBody = {LogType.MDC, LogType.LOG}, filtersBody = SensitiveBodyFilter.class)
void bodyAsMdcAndLogWithFilter();

@Logged(requestBody = {LogType.MDC, LogType.LOG}, responseBody = {LogType.MDC, LogType.LOG})
void bodyAsMdcAndLog();

@Logged(requestBody = LogType.MDC, responseBody = LogType.MDC, filersBody = SensitiveBodyFilter.class)
@Logged(requestBody = LogType.MDC, responseBody = LogType.MDC, filtersBody = SensitiveBodyFilter.class)
void bodyAsMdcWithFilter();

@Logged(requestBody = LogType.LOG, responseBody = LogType.LOG, filersBody = SensitiveBodyFilter.class)
@Logged(requestBody = LogType.LOG, responseBody = LogType.LOG, filtersBody = SensitiveBodyFilter.class)
void bodyAsLogWithFilter();

@Logged(requestBody = LogType.MDC, responseBody = LogType.MDC)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public UserLoggedFilter() {
@Override
protected Optional<Logged> getAnnotation() {
// Need to give the base configuration to the parent
// But could also overwrite requestBodyLogging, responseBodyLogging and filersBody
// But could also overwrite requestBodyLogging, responseBodyLogging and filtersBody
return getAnnotation(resourceInfo, UserLogged.class)
.map(UserLogged::logging);
}
Expand Down

0 comments on commit 2a5f1b3

Please sign in to comment.