Class FastJsonHttpMessageConverter
- java.lang.Object
-
- org.springframework.http.converter.AbstractHttpMessageConverter<Object>
-
- com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter
-
- All Implemented Interfaces:
org.springframework.http.converter.GenericHttpMessageConverter<Object>,org.springframework.http.converter.HttpMessageConverter<Object>
public class FastJsonHttpMessageConverter extends org.springframework.http.converter.AbstractHttpMessageConverter<Object> implements org.springframework.http.converter.GenericHttpMessageConverter<Object>
Fastjson for Spring MVC Converter.Compatible fastjson 1.2.x
- Since:
- 2.0.2
- Author:
- VictorZeng
- See Also:
AbstractHttpMessageConverter,GenericHttpMessageConverter
-
-
Field Summary
Fields Modifier and Type Field Description static org.springframework.http.MediaTypeAPPLICATION_JAVASCRIPT
-
Constructor Summary
Constructors Constructor Description FastJsonHttpMessageConverter()Can serialize/deserialize all types.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanRead(Type type, Class<?> contextClass, org.springframework.http.MediaType mediaType)booleancanWrite(Type type, Class<?> clazz, org.springframework.http.MediaType mediaType)FastJsonConfiggetFastJsonConfig()protected TypegetType(Type type, Class<?> contextClass)Objectread(Type type, Class<?> contextClass, org.springframework.http.HttpInputMessage inputMessage)protected ObjectreadInternal(Class<?> clazz, org.springframework.http.HttpInputMessage inputMessage)voidsetFastJsonConfig(FastJsonConfig fastJsonConfig)protected booleansupports(Class<?> clazz)voidwrite(Object o, Type type, org.springframework.http.MediaType contentType, org.springframework.http.HttpOutputMessage outputMessage)protected voidwriteInternal(Object object, org.springframework.http.HttpOutputMessage outputMessage)-
Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
addDefaultHeaders, canRead, canRead, canWrite, canWrite, getContentLength, getDefaultCharset, getDefaultContentType, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, write
-
-
-
-
Method Detail
-
getFastJsonConfig
public FastJsonConfig getFastJsonConfig()
- Returns:
- the fastJsonConfig.
-
setFastJsonConfig
public void setFastJsonConfig(FastJsonConfig fastJsonConfig)
- Parameters:
fastJsonConfig- the fastJsonConfig to set.
-
supports
protected boolean supports(Class<?> clazz)
- Specified by:
supportsin classorg.springframework.http.converter.AbstractHttpMessageConverter<Object>
-
canRead
public boolean canRead(Type type, Class<?> contextClass, org.springframework.http.MediaType mediaType)
- Specified by:
canReadin interfaceorg.springframework.http.converter.GenericHttpMessageConverter<Object>
-
canWrite
public boolean canWrite(Type type, Class<?> clazz, org.springframework.http.MediaType mediaType)
- Specified by:
canWritein interfaceorg.springframework.http.converter.GenericHttpMessageConverter<Object>
-
read
public Object read(Type type, Class<?> contextClass, org.springframework.http.HttpInputMessage inputMessage) throws IOException, org.springframework.http.converter.HttpMessageNotReadableException
- Specified by:
readin interfaceorg.springframework.http.converter.GenericHttpMessageConverter<Object>- Throws:
IOExceptionorg.springframework.http.converter.HttpMessageNotReadableException
-
write
public void write(Object o, Type type, org.springframework.http.MediaType contentType, org.springframework.http.HttpOutputMessage outputMessage) throws IOException, org.springframework.http.converter.HttpMessageNotWritableException
- Specified by:
writein interfaceorg.springframework.http.converter.GenericHttpMessageConverter<Object>- Throws:
IOExceptionorg.springframework.http.converter.HttpMessageNotWritableException
-
readInternal
protected Object readInternal(Class<?> clazz, org.springframework.http.HttpInputMessage inputMessage) throws IOException, org.springframework.http.converter.HttpMessageNotReadableException
- Specified by:
readInternalin classorg.springframework.http.converter.AbstractHttpMessageConverter<Object>- Throws:
IOExceptionorg.springframework.http.converter.HttpMessageNotReadableException
-
writeInternal
protected void writeInternal(Object object, org.springframework.http.HttpOutputMessage outputMessage) throws IOException, org.springframework.http.converter.HttpMessageNotWritableException
- Specified by:
writeInternalin classorg.springframework.http.converter.AbstractHttpMessageConverter<Object>- Throws:
IOExceptionorg.springframework.http.converter.HttpMessageNotWritableException
-
-