@Setup(mode=SINGLETON, priority=1000) @Supports(value="application/json") public class DocumentModelJsonReaderLegacy extends Object implements Reader<DocumentModel>
DocumentModel
Json reading to the old marshaller: JSONDocumentModelReader.
It's enable if system property nuxeo.document.json.legacy=true or if request header X-NXDocumentJsonLegacy=true.
Modifier and Type | Field and Description |
---|---|
static String |
CONF_DOCUMENT_JSON_LEGACY |
static String |
HEADER_DOCUMENT_JSON_LEGACY |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Class<?> clazz,
Type genericType,
javax.ws.rs.core.MediaType mediatype)
Checks if this marshaller can handle the marshalling request.
|
static void |
pushInstanceIfNeeded(RenderingContext ctx,
javax.servlet.http.HttpServletRequest request,
javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders) |
DocumentModel |
read(Class<?> clazz,
Type genericType,
javax.ws.rs.core.MediaType mediaType,
InputStream in)
Read the entity from in
InputStream using mediatype format. |
public static final String CONF_DOCUMENT_JSON_LEGACY
public static final String HEADER_DOCUMENT_JSON_LEGACY
public static void pushInstanceIfNeeded(RenderingContext ctx, javax.servlet.http.HttpServletRequest request, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
public boolean accept(Class<?> clazz, Type genericType, javax.ws.rs.core.MediaType mediatype)
Marshaller
Please note it's useless to check that clazz is an instance of EntityType or if generic type and entity type are
compatible (unlike JAX-RS which just checks the clazz, not the generic type). It's also useless to check
Supports
is compatible with mediatype. This is already done by the MarshallerRegistry
This method implementation can use injected properties. So you can check the current RenderingContext
to
accept or reject a marshalling request.
accept
in interface Marshaller<DocumentModel>
clazz
- The type to marshall.genericType
- The generic type to marshall.mediatype
- The managed mimetype.public DocumentModel read(Class<?> clazz, Type genericType, javax.ws.rs.core.MediaType mediaType, InputStream in) throws IOException
Reader
InputStream
using mediatype format.
This method implementation can use injected properties.
read
in interface Reader<DocumentModel>
clazz
- The requested marshalled class.genericType
- The requested marshalled generic type.in
- The input of this marshaller.IOException
- If some error append while reading entity from in.Copyright © 2018 Nuxeo. All rights reserved.