com.alibaba.fastjson.support.spring
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 and Description static org.springframework.http.MediaType
APPLICATION_JAVASCRIPT
Constructor Summary
Constructors Constructor and Description FastJsonHttpMessageConverter()
Can serialize/deserialize all types.
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description void
addSerializeFilter(SerializeFilter filter)
Deprecated.boolean
canRead(Type type, Class<?> contextClass, org.springframework.http.MediaType mediaType)
boolean
canWrite(Type type, Class<?> clazz, org.springframework.http.MediaType mediaType)
Charset
getCharset()
Deprecated.String
getDateFormat()
Deprecated.FastJsonConfig
getFastJsonConfig()
SerializerFeature[]
getFeatures()
Deprecated.SerializeFilter[]
getFilters()
Deprecated.Object
read(Type type, Class<?> contextClass, org.springframework.http.HttpInputMessage inputMessage)
void
setCharset(Charset charset)
Deprecated.void
setDateFormat(String dateFormat)
Deprecated.void
setFastJsonConfig(FastJsonConfig fastJsonConfig)
void
setFeatures(SerializerFeature... features)
Deprecated.void
setFilters(SerializeFilter... filters)
Deprecated.void
write(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
-
Field Detail
APPLICATION_JAVASCRIPT
public static final org.springframework.http.MediaType APPLICATION_JAVASCRIPT
Constructor Detail
FastJsonHttpMessageConverter
public FastJsonHttpMessageConverter()
Can serialize/deserialize all types.
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:
-
canRead
in interfaceorg.springframework.http.converter.GenericHttpMessageConverter<Object>
canWrite
public boolean canWrite(Type type, Class<?> clazz, org.springframework.http.MediaType mediaType)
- 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
Copyright © 2012–2021 Alibaba Group. All rights reserved.