@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| 限定符和类型 | 字段和说明 |
|---|---|
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).
|
| 构造器和说明 |
|---|
FastJsonProvider()
Can serialize/deserialize all types.
|
FastJsonProvider(Class<?>[] clazzes)
Only serialize/deserialize all types in clazzes.
|
FastJsonProvider(String charset)
已过时。
|
| 限定符和类型 | 方法和说明 |
|---|---|
Charset |
getCharset()
已过时。
|
String |
getDateFormat()
已过时。
|
FastJsonConfig |
getFastJsonConfig() |
SerializerFeature[] |
getFeatures()
已过时。
|
SerializeFilter[] |
getFilters()
已过时。
|
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. always return -1 to denote "not known".
|
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)
已过时。
|
void |
setDateFormat(String dateFormat)
已过时。
|
void |
setFastJsonConfig(FastJsonConfig fastJsonConfig) |
void |
setFeatures(SerializerFeature... features)
已过时。
|
void |
setFilters(SerializeFilter... filters)
已过时。
|
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 在接口中 javax.ws.rs.ext.MessageBodyWriter<Object>public long getSize(Object t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
getSize 在接口中 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 在接口中 javax.ws.rs.ext.MessageBodyWriter<Object>IOExceptionjavax.ws.rs.WebApplicationExceptionpublic boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
isReadable 在接口中 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 在接口中 javax.ws.rs.ext.MessageBodyReader<Object>IOExceptionjavax.ws.rs.WebApplicationExceptionCopyright © 2012–2020 Alibaba Group. All rights reserved.