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
Modifier and TypeFieldDescriptionstatic final org.springframework.http.MediaType
Fields inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
protected Type
protected Object
readInternal
(Class<?> clazz, org.springframework.http.HttpInputMessage inputMessage) void
setFastJsonConfig
(FastJsonConfig fastJsonConfig) protected boolean
void
write
(Object o, Type type, org.springframework.http.MediaType contentType, org.springframework.http.HttpOutputMessage outputMessage) protected void
writeInternal
(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
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
canRead, canWrite, getSupportedMediaTypes, getSupportedMediaTypes, read, write
-
Field Details
-
APPLICATION_JAVASCRIPT
public static final org.springframework.http.MediaType APPLICATION_JAVASCRIPT
-
-
Constructor Details
-
FastJsonHttpMessageConverter
public FastJsonHttpMessageConverter()Can serialize/deserialize all types.
-
-
Method Details
-
getFastJsonConfig
- Returns:
- the fastJsonConfig.
-
setFastJsonConfig
- Parameters:
fastJsonConfig
- the fastJsonConfig to set.
-
supports
- Specified by:
supports
in classorg.springframework.http.converter.AbstractHttpMessageConverter<Object>
-
canRead
public boolean canRead(Type type, Class<?> contextClass, org.springframework.http.MediaType mediaType) - Specified by:
canRead
in interfaceorg.springframework.http.converter.GenericHttpMessageConverter<Object>
-
canWrite
- Specified by:
canWrite
in 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:
read
in interfaceorg.springframework.http.converter.GenericHttpMessageConverter<Object>
- Throws:
IOException
org.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:
write
in interfaceorg.springframework.http.converter.GenericHttpMessageConverter<Object>
- Throws:
IOException
org.springframework.http.converter.HttpMessageNotWritableException
-
readInternal
protected Object readInternal(Class<?> clazz, org.springframework.http.HttpInputMessage inputMessage) throws IOException, org.springframework.http.converter.HttpMessageNotReadableException - Specified by:
readInternal
in classorg.springframework.http.converter.AbstractHttpMessageConverter<Object>
- Throws:
IOException
org.springframework.http.converter.HttpMessageNotReadableException
-
writeInternal
protected void writeInternal(Object object, org.springframework.http.HttpOutputMessage outputMessage) throws IOException, org.springframework.http.converter.HttpMessageNotWritableException - Specified by:
writeInternal
in classorg.springframework.http.converter.AbstractHttpMessageConverter<Object>
- Throws:
IOException
org.springframework.http.converter.HttpMessageNotWritableException
-
getType
-