Package org.springframework.data.web
Class ProjectingJackson2HttpMessageConverter
java.lang.Object
org.springframework.http.converter.AbstractHttpMessageConverter<T>
org.springframework.http.converter.AbstractGenericHttpMessageConverter<Object>
org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
org.springframework.data.web.ProjectingJackson2HttpMessageConverter
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanClassLoaderAware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.http.converter.GenericHttpMessageConverter<Object>
,org.springframework.http.converter.HttpMessageConverter<Object>
public class ProjectingJackson2HttpMessageConverter
extends org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
implements org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware
HttpMessageConverter
implementation to enable projected JSON binding to interfaces annotated with
ProjectedPayload
.- Since:
- 1.13
- Author:
- Oliver Gierke, Christoph Strobl
-
Field Summary
Fields inherited from class org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
defaultObjectMapper
Fields inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
logger
-
Constructor Summary
ConstructorDescriptionCreates a newProjectingJackson2HttpMessageConverter
using a defaultObjectMapper
.ProjectingJackson2HttpMessageConverter
(com.fasterxml.jackson.databind.ObjectMapper mapper) Creates a newProjectingJackson2HttpMessageConverter
for the givenObjectMapper
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
void
setBeanClassLoader
(ClassLoader classLoader) void
setBeanFactory
(org.springframework.beans.factory.BeanFactory beanFactory) Methods inherited from class org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
getMediaTypesForProblemDetail, setJsonPrefix, setPrefixJson, writePrefix
Methods inherited from class org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
canRead, customizeReader, customizeWriter, getCharset, getContentLength, getDefaultContentType, getJavaType, getJsonEncoding, getObjectMapper, getObjectMappersForType, getSupportedMediaTypes, logWarningIfNecessary, readInternal, registerObjectMappersForType, setObjectMapper, setPrettyPrint, setSupportedMediaTypes, writeInternal, writeSuffix
Methods inherited from class org.springframework.http.converter.AbstractGenericHttpMessageConverter
canWrite, supports, write, writeInternal
Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
addDefaultHeaders, canRead, canWrite, getDefaultCharset, getSupportedMediaTypes, read, setDefaultCharset, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.http.converter.HttpMessageConverter
getSupportedMediaTypes, read, write
-
Constructor Details
-
ProjectingJackson2HttpMessageConverter
public ProjectingJackson2HttpMessageConverter()Creates a newProjectingJackson2HttpMessageConverter
using a defaultObjectMapper
. -
ProjectingJackson2HttpMessageConverter
public ProjectingJackson2HttpMessageConverter(com.fasterxml.jackson.databind.ObjectMapper mapper) Creates a newProjectingJackson2HttpMessageConverter
for the givenObjectMapper
.- Parameters:
mapper
- must not be null.
-
-
Method Details
-
setBeanClassLoader
- Specified by:
setBeanClassLoader
in interfaceorg.springframework.beans.factory.BeanClassLoaderAware
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Throws:
org.springframework.beans.BeansException
-
canRead
public boolean canRead(Type type, @Nullable Class<?> contextClass, @Nullable org.springframework.http.MediaType mediaType) - Specified by:
canRead
in interfaceorg.springframework.http.converter.GenericHttpMessageConverter<Object>
- Overrides:
canRead
in classorg.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
-
canWrite
- Specified by:
canWrite
in interfaceorg.springframework.http.converter.HttpMessageConverter<Object>
- Overrides:
canWrite
in classorg.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
-
read
public Object read(Type type, @Nullable Class<?> contextClass, org.springframework.http.HttpInputMessage inputMessage) throws IOException, org.springframework.http.converter.HttpMessageNotReadableException - Specified by:
read
in interfaceorg.springframework.http.converter.GenericHttpMessageConverter<Object>
- Overrides:
read
in classorg.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
- Throws:
IOException
org.springframework.http.converter.HttpMessageNotReadableException
-