Examples of JettisonMappedXmlDriver


Examples of com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver

    }

    protected XStream getXStream() throws Exception {
        XStream xstream;
        if (format.equals("json")) {
            xstream = new XStream(new JettisonMappedXmlDriver());
        } else if (format.equals("xml")) {
            xstream = new XStream();
        } else {
            throw new Exception("Unknown format: " + format);
        }
View Full Code Here

Examples of com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver

                case JMS_OBJECT_XML:
                    in = new XppReader(new StringReader(text), XppFactory.createDefaultParser());
                    msg = createObjectMessage(in);
                    break;
                case JMS_OBJECT_JSON:
                    in = new JettisonMappedXmlDriver().createReader(new StringReader(text));
                    msg = createObjectMessage(in);
                    break;
                case JMS_MAP_XML:
                    in = new XppReader(new StringReader(text), XppFactory.createDefaultParser());
                    msg = createMapMessage(in);
                    break;
                case JMS_MAP_JSON:
                    in = new JettisonMappedXmlDriver().createReader(new StringReader(text));
                    msg = createMapMessage(in);
                    break;
                default:
                    throw new Exception("Unkown transformation: " + transformation);
                }
View Full Code Here

Examples of com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver

    protected String marshall(Serializable object, String transformation)
            throws JMSException {
        StringWriter buffer = new StringWriter();
        HierarchicalStreamWriter out;
        if (transformation.toLowerCase(Locale.ENGLISH).endsWith("json")) {
            out = new JettisonMappedXmlDriver(new Configuration(), false).createWriter(buffer);
        } else {
            out = new PrettyPrintWriter(buffer);
        }
        getXStream().marshal(object, out);
        return buffer.toString();
View Full Code Here

Examples of com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver

    protected String marshallAdvisory(final DataStructure ds, String transformation) {

        StringWriter buffer = new StringWriter();
        HierarchicalStreamWriter out;
        if (transformation.toLowerCase(Locale.ENGLISH).endsWith("json")) {
            out = new JettisonMappedXmlDriver().createWriter(buffer);
        } else {
            out = new PrettyPrintWriter(buffer);
        }

        XStream xstream = getXStream();
View Full Code Here

Examples of com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver

    assertXpathExists("/flights/string", result);
  }

  @Test
  public void jettisonDriver() throws Exception {
    marshaller.setStreamDriver(new JettisonMappedXmlDriver());
    Writer writer = new StringWriter();
    marshaller.marshal(flight, new StreamResult(writer));
    assertEquals("Invalid result", "{\"flight\":{\"flightNumber\":42}}", writer.toString());
    Object o = marshaller.unmarshal(new StreamSource(new StringReader(writer.toString())));
    assertTrue("Unmarshalled object is not Flights", o instanceof Flight);
View Full Code Here

Examples of com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver

import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import com.thoughtworks.xstream.mapper.Mapper;

public class XStreamJSon {
    public static XStream newJSonMarshaller() {
        JettisonMappedXmlDriver jet = new JettisonMappedXmlDriver();
        XStream xstream = new XStream( jet );

        XStreamHelper.setAliases( xstream );

        xstream.alias( "commands",
View Full Code Here

Examples of com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver

import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import com.thoughtworks.xstream.mapper.Mapper;

public class XStreamJSon {
    public static XStream newJSonMarshaller() {
        JettisonMappedXmlDriver jet = new JettisonMappedXmlDriver();
        XStream xstream = new XStream( jet );

        XStreamHelper.setAliases( xstream );

        xstream.alias( "commands",
View Full Code Here

Examples of com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver

        // create OBError and serizalize it using JSON
        OBError error = new OBError();
        error.setType("Error");
        error.setTitle("Error");
        error.setMessage(strResult);
        XStream xs = new XStream(new JettisonMappedXmlDriver());
        xs.alias("OBError", OBError.class);
        strResult = xs.toXML(error);
      }

      out.print(strResult);
View Full Code Here

Examples of org.apache.activemq.util.JettisonMappedXmlDriver

        case JMS_OBJECT_XML:
          in = new XppReader(new StringReader(text));
          msg = createObjectMessage(in);
          break;
        case JMS_OBJECT_JSON:
          in = new JettisonMappedXmlDriver().createReader(new StringReader(text));
          msg = createObjectMessage(in);
          break;
        case JMS_MAP_XML:
          in = new XppReader(new StringReader(text));
          msg = createMapMessage(in);
          break;
        case JMS_MAP_JSON:
          in = new JettisonMappedXmlDriver().createReader(new StringReader(text));
          msg = createMapMessage(in);
          break;
        default:
          throw new Exception("Unkown transformation: " + transformation);
        }
View Full Code Here

Examples of org.apache.activemq.util.JettisonMappedXmlDriver

  protected String marshall(Serializable object, String transformation)
      throws JMSException {
    StringWriter buffer = new StringWriter();
    HierarchicalStreamWriter out;
    if (transformation.toLowerCase().endsWith("json")) {
      out = new JettisonMappedXmlDriver(new Configuration(), false).createWriter(buffer);
    } else {
      out = new PrettyPrintWriter(buffer);
    }
    getXStream().marshal(object, out);
    return buffer.toString();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.