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>
- Direct Known Subclasses:
FastJsonHttpMessageConverter4,FastJsonpHttpMessageConverter4
public class FastJsonHttpMessageConverter extends org.springframework.http.converter.AbstractHttpMessageConverter<Object> implements org.springframework.http.converter.GenericHttpMessageConverter<Object>
Fastjson for Spring MVC Converter.Compatible Spring MVC version 3.2+
- Since:
- 1.2.10
Supported return type:
Simple object: ObjectWith property filter :FastJsonContainer[Object]
Jsonp :MappingFastJsonValue[Object]
Jsonp with property filter: MappingFastJsonValue[FastJsonContainer[Object]] - 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 Deprecated Methods Modifier and Type Method Description voidaddSerializeFilter(SerializeFilter filter)Deprecated.booleancanRead(Type type, Class<?> contextClass, org.springframework.http.MediaType mediaType)booleancanWrite(Type type, Class<?> clazz, org.springframework.http.MediaType mediaType)CharsetgetCharset()Deprecated.StringgetDateFormat()Deprecated.FastJsonConfiggetFastJsonConfig()SerializerFeature[]getFeatures()Deprecated.SerializeFilter[]getFilters()Deprecated.Objectread(Type type, Class<?> contextClass, org.springframework.http.HttpInputMessage inputMessage)voidsetCharset(Charset charset)Deprecated.voidsetDateFormat(String dateFormat)Deprecated.voidsetFastJsonConfig(FastJsonConfig fastJsonConfig)voidsetFeatures(SerializerFeature... features)Deprecated.voidsetFilters(SerializeFilter... filters)Deprecated.voidwrite(Object o, Type type, org.springframework.http.MediaType contentType, org.springframework.http.HttpOutputMessage outputMessage)-
Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
canRead, canWrite, getDefaultCharset, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, write
-
-
-
-
Method Detail
-
getFastJsonConfig
public FastJsonConfig getFastJsonConfig()
- Returns:
- the fastJsonConfig.
- Since:
- 1.2.11
-
setFastJsonConfig
public void setFastJsonConfig(FastJsonConfig fastJsonConfig)
- Parameters:
fastJsonConfig- the fastJsonConfig to set.- Since:
- 1.2.11
-
getCharset
@Deprecated public Charset getCharset()
Deprecated.Gets charset.- Returns:
- the charset
- See Also:
FastJsonConfig.getCharset()
-
setCharset
@Deprecated public void setCharset(Charset charset)
Deprecated.Sets charset.- Parameters:
charset- the charset- See Also:
FastJsonConfig.setCharset(Charset)
-
getDateFormat
@Deprecated public String getDateFormat()
Deprecated.Gets date format.- Returns:
- the date format
- See Also:
FastJsonConfig.getDateFormat()
-
setDateFormat
@Deprecated public void setDateFormat(String dateFormat)
Deprecated.Sets date format.- Parameters:
dateFormat- the date format- See Also:
FastJsonConfig.setDateFormat(String)
-
getFeatures
@Deprecated public SerializerFeature[] getFeatures()
Deprecated.Get features serializer feature [].- Returns:
- the serializer feature []
- See Also:
FastJsonConfig.getSerializerFeatures()
-
setFeatures
@Deprecated public void setFeatures(SerializerFeature... features)
Deprecated.Sets features.- Parameters:
features- the features- See Also:
FastJsonConfig.setSerializerFeatures(SerializerFeature...)
-
getFilters
@Deprecated public SerializeFilter[] getFilters()
Deprecated.Get filters serialize filter [].- Returns:
- the serialize filter []
- See Also:
FastJsonConfig.getSerializeFilters()
-
setFilters
@Deprecated public void setFilters(SerializeFilter... filters)
Deprecated.Sets filters.- Parameters:
filters- the filters- See Also:
FastJsonConfig.setSerializeFilters(SerializeFilter...)
-
addSerializeFilter
@Deprecated public void addSerializeFilter(SerializeFilter filter)
Deprecated.Add serialize filter.- Parameters:
filter- the filter- See Also:
FastJsonConfig.setSerializeFilters(SerializeFilter...)
-
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
-
-