Package com.sun.jersey.json.impl

Examples of com.sun.jersey.json.impl.JSONUnmarshaller


            Unmarshaller u, InputStream entityStream)
            throws JAXBException, IOException {
        final Charset c = getCharset(mediaType);
        if (type.isAnnotationPresent(XmlRootElement.class)) {
            if (u instanceof JSONUnmarshaller) {
                JSONUnmarshaller ju = (JSONUnmarshaller)u;
                ju.setJsonEnabled(true);
                JAXBElement jaxbElem = (JAXBElement)ju.
                        unmarshal(new InputStreamReader(entityStream, c),
                        type);
                return jaxbElem.getValue();
            } else {
                return u.unmarshal(
                        new JsonXmlStreamReader(
                            new InputStreamReader(entityStream, c),
                            JSONHelper.getRootElementName(type)));
            }
        } else {
            if (u instanceof JSONUnmarshaller) {
                // TODO what about the charset ?
                JSONUnmarshaller ju = (JSONUnmarshaller)u;
                ju.setJsonEnabled(true);
                return ju.unmarshal(new StreamSource(entityStream), type).getValue();
            } else {
                return u.unmarshal(
                        new JsonXmlStreamReader(
                            new InputStreamReader(entityStream, c),
                            JSONHelper.getRootElementName(type)), type).getValue();
View Full Code Here


     * @return unmarshaller instance with JSON capabilities
     * @throws javax.xml.bind.JAXBException
     */
    @Override
    public Unmarshaller createUnmarshaller() throws JAXBException {
        return new JSONUnmarshaller(jaxbContext, getJSONConfiguration());
    }
View Full Code Here

TOP

Related Classes of com.sun.jersey.json.impl.JSONUnmarshaller

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.