Skip to content

Commit 3ff52a6

Browse files
committed
Consistently override canRead(…) / canWrite(…) in ALPS converter.
This commit has unified the canRead(…) / canWrite(…) call chains to consistently end up in the overload taking a ResolvableType. We now override these to let the ALPS converter only kick in to render Alps instances. Related: GH-2533.
1 parent 36abc9a commit 3ff52a6

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/alps/AlpsJacksonJsonHttpMessageConverter.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,10 @@ public AlpsJacksonJsonHttpMessageConverter(JsonMapper objectMapper,
9292
}
9393

9494
@Override
95-
public boolean canWrite(Class<?> clazz, @Nullable MediaType mediaType) {
96-
return (clazz.isAssignableFrom(Alps.class) || clazz.isAssignableFrom(RootResourceInformation.class))
97-
&& super.canWrite(clazz, mediaType);
98-
}
95+
public boolean canWrite(ResolvableType type, Class<?> clazz, @Nullable MediaType mediaType) {
9996

100-
@Override
101-
public boolean canRead(Class<?> type, @Nullable MediaType mediaType) {
102-
return false;
97+
return (clazz.isAssignableFrom(Alps.class) || clazz.isAssignableFrom(RootResourceInformation.class))
98+
&& super.canWrite(type, clazz, mediaType);
10399
}
104100

105101
@Override

0 commit comments

Comments
 (0)