@Provider
@Produces(value={"application/x-www-form-urlencoded","application/json"})
@Consumes(value={"application/x-www-form-urlencoded","application/json"})
public class FastJsonProvider
extends Object
implements javax.ws.rs.ext.MessageBodyReader<Object>, javax.ws.rs.ext.MessageBodyWriter<Object>
| 构造器和说明 |
|---|
FastJsonProvider()
Can serialize/deserialize all types.
|
FastJsonProvider(Class<?>[] clazzes)
Only serialize/deserialize all types in clazzes.
|
FastJsonProvider(String charset)
Set charset. the default charset is UTF-8
|
| 限定符和类型 | 方法和说明 |
|---|---|
Charset |
getCharset() |
String |
getDateFormat() |
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 |
setFeatures(SerializerFeature... features) |
void |
setFilters(SerializeFilter... filters) |
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 FastJsonProvider()
public FastJsonProvider(String charset)
public FastJsonProvider(Class<?>[] clazzes)
public Charset getCharset()
public void setCharset(Charset charset)
public String getDateFormat()
public void setDateFormat(String dateFormat)
public SerializerFeature[] getFeatures()
public void setFeatures(SerializerFeature... features)
public SerializeFilter[] getFilters()
public void setFilters(SerializeFilter... filters)
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–2016 Alibaba Group. All rights reserved.