Class DocumentModelJsonReaderLegacy

    • Method Detail

      • pushInstanceIfNeeded

        public static void pushInstanceIfNeeded​(RenderingContext ctx,
                                                javax.servlet.http.HttpServletRequest request,
                                                javax.ws.rs.core.MultivaluedMap<String,​String> httpHeaders)
      • accept

        public boolean accept​(Class<?> clazz,
                              Type genericType,
                              javax.ws.rs.core.MediaType mediatype)
        Description copied from interface: Marshaller
        Checks if this marshaller can handle the marshalling request.

        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.

        Specified by:
        accept in interface Marshaller<DocumentModel>
        Parameters:
        clazz - The type to marshall.
        genericType - The generic type to marshall.
        mediatype - The managed mimetype.
        Returns:
        true if this converter handle the request, false otherwise.
      • read

        public DocumentModel read​(Class<?> clazz,
                                  Type genericType,
                                  javax.ws.rs.core.MediaType mediaType,
                                  InputStream in)
                           throws IOException
        Description copied from interface: Reader
        Read the entity from in InputStream using mediatype format.

        This method implementation can use injected properties.

        Specified by:
        read in interface Reader<DocumentModel>
        Parameters:
        clazz - The requested marshalled class.
        genericType - The requested marshalled generic type.
        mediaType - The input media type.
        in - The input of this marshaller.
        Throws:
        IOException - If some error append while reading entity from in.