@Provider @Consumes(value="*/*") @Produces(value="*/*") public class FastJsonProvider extends Object implements javax.ws.rs.ext.MessageBodyReader<Object>, javax.ws.rs.ext.MessageBodyWriter<Object>
MessageBodyReader
,
MessageBodyWriter
Modifier and Type | Field and Description |
---|---|
static Class<?>[] |
DEFAULT_UNREADABLES
These are classes that we never use for reading
(never try to deserialize instances of these types).
|
static Class<?>[] |
DEFAULT_UNWRITABLES
These are classes that we never use for writing
(never try to serialize instances of these types).
|
Constructor and Description |
---|
FastJsonProvider()
Can serialize/deserialize all types.
|
FastJsonProvider(Class<?>[] clazzes)
Only serialize/deserialize all types in clazzes.
|
FastJsonProvider(String charset)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Charset |
getCharset()
Deprecated.
|
String |
getDateFormat()
Deprecated.
|
FastJsonConfig |
getFastJsonConfig() |
SerializerFeature[] |
getFeatures()
Deprecated.
|
SerializeFilter[] |
getFilters()
Deprecated.
|
long |
getSize(Object t,
Class<?> type,
Type genericType,
Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType)
Method that JAX-RS container calls to try to figure out serialized length
of given value.
|
boolean |
isReadable(Class<?> type,
Type genericType,
Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType)
Method that JAX-RS container calls to try to check whether values of
given type (and media type) can be deserialized by this provider.
|
boolean |
isWriteable(Class<?> type,
Type genericType,
Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType)
Method that JAX-RS container calls to try to check whether given value
(of specified type) can be serialized by this provider.
|
Object |
readFrom(Class<Object> type,
Type genericType,
Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType,
javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders,
InputStream entityStream)
Method that JAX-RS container calls to deserialize given value.
|
void |
setCharset(Charset charset)
Deprecated.
|
void |
setDateFormat(String dateFormat)
Deprecated.
|
void |
setFastJsonConfig(FastJsonConfig fastJsonConfig) |
void |
setFeatures(SerializerFeature... features)
Deprecated.
|
void |
setFilters(SerializeFilter... filters)
Deprecated.
|
FastJsonProvider |
setPretty(boolean p)
Set pretty format
|
void |
writeTo(Object obj,
Class<?> type,
Type genericType,
Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType,
javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders,
OutputStream entityStream)
Method that JAX-RS container calls to serialize given value.
|
public static final Class<?>[] DEFAULT_UNREADABLES
public static final Class<?>[] DEFAULT_UNWRITABLES
public FastJsonProvider()
public FastJsonProvider(Class<?>[] clazzes)
@Deprecated public FastJsonProvider(String charset)
charset
- the charsetFastJsonConfig.setCharset(Charset)
public FastJsonConfig getFastJsonConfig()
public void setFastJsonConfig(FastJsonConfig fastJsonConfig)
fastJsonConfig
- the fastJsonConfig to set.public FastJsonProvider setPretty(boolean p)
@Deprecated public Charset getCharset()
FastJsonConfig.getCharset()
@Deprecated public void setCharset(Charset charset)
charset
- the charsetFastJsonConfig.setCharset(Charset)
@Deprecated public String getDateFormat()
FastJsonConfig.getDateFormat()
@Deprecated public void setDateFormat(String dateFormat)
dateFormat
- the date formatFastJsonConfig.setDateFormat(String)
@Deprecated public SerializerFeature[] getFeatures()
FastJsonConfig.getFeatures()
@Deprecated public void setFeatures(SerializerFeature... features)
features
- the featuresFastJsonConfig.setFeatures(Feature...)
@Deprecated public SerializeFilter[] getFilters()
FastJsonConfig.getSerializeFilters()
@Deprecated public void setFilters(SerializeFilter... filters)
filters
- the filtersFastJsonConfig.setSerializeFilters(SerializeFilter...)
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
isWriteable
in interface javax.ws.rs.ext.MessageBodyWriter<Object>
public long getSize(Object t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
getSize
in interface javax.ws.rs.ext.MessageBodyWriter<Object>
public void writeTo(Object obj, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws IOException, javax.ws.rs.WebApplicationException
writeTo
in interface javax.ws.rs.ext.MessageBodyWriter<Object>
IOException
javax.ws.rs.WebApplicationException
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
isReadable
in interface javax.ws.rs.ext.MessageBodyReader<Object>
public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, InputStream entityStream) throws IOException, javax.ws.rs.WebApplicationException
readFrom
in interface javax.ws.rs.ext.MessageBodyReader<Object>
IOException
javax.ws.rs.WebApplicationException
Copyright © 2012–2022 Alibaba Group. All rights reserved.