ResponseBodyAdvice implementation that adds support for Jackson's
@JsonView annotation declared on a Spring MVC @RequestMapping
or @ExceptionHandler method.
The serialization view specified in the annotation will be passed in to the
org.
which will then use it to serialize the response body.
Note that despite @JsonView allowing for more than one class to
be specified, the use for a response body advice is only supported with
exactly one class argument. Consider the use of a composite interface.
com.fasterxml.jackson.annotation.JsonView , com.fasterxml.jackson.databind.ObjectMapper#writerWithView(Class)
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | beforeBodyWriteInternal(MappingJacksonValue bodyContainer, MediaType contentType, MethodParameter returnType, ServerHttpRequest request, ServerHttpResponse response)
Implements abstract org. Invoked only if the converter type is |
| public boolean | supports(MethodParameter
the return type returnType, Class<? extends HttpMessageConverter<?>> the selected converter type converterType)
Implements org. Whether this component supports the given controller method return type
and the selected |
| JsonViewResponseBodyAdvice | back to summary |
|---|---|
| public JsonViewResponseBodyAdvice() | |
| beforeBodyWriteInternal | back to summary |
|---|---|
| protected void beforeBodyWriteInternal(MappingJacksonValue bodyContainer, MediaType contentType, MethodParameter returnType, ServerHttpRequest request, ServerHttpResponse response) Implements abstract org. Invoked only if the converter type is
| |
| supports | back to summary |
|---|---|
| public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) Implements org. Doc from org. Whether this component supports the given controller method return type
and the selected
| |