Package com.thoughtworks.xstream.io.xml

Examples of com.thoughtworks.xstream.io.xml.QNameMap


        if(! MessageProperties.CONTENT_TYPE_JSON.equalsIgnoreCase(contentType))
            throw new MessageConversionException("Cannot understand a message of type "+contentType);

        try {
            ByteArrayInputStream inStream = new ByteArrayInputStream(body);
            StaxReader reader = new StaxReader(new QNameMap(), this.inputFactory.createXMLStreamReader(inStream, getEncoding()));
            return this.objectMapper.unmarshal(reader);
        } catch (XMLStreamException ex) {
            String typeId = (String) messageProperties.getHeaders().get(DefaultClassMapper.DEFAULT_CLASSID_FIELD_NAME);
            LOG.error("XMLStreamException trying to unmarshal message of type {}", typeId, ex);
            throw new MessageConversionException("Could not unmarshal message of type "+typeId, ex);
View Full Code Here


  }

  @Override
  protected void marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) throws XmlMappingException {
    try {
      doMarshal(graph, new StaxWriter(new QNameMap(), streamWriter, this.nameCoder), null);
    }
    catch (XMLStreamException ex) {
      throw convertXStreamException(ex, true);
    }
  }
View Full Code Here

    }
  }

  @Override
  protected Object unmarshalXmlStreamReader(XMLStreamReader streamReader) throws XmlMappingException {
        return doUnmarshal(new StaxReader(new QNameMap(), streamReader, this.nameCoder), null);
  }
View Full Code Here

        return new XStream();
    }

    protected HierarchicalStreamWriter createHierarchicalStreamWriter(Exchange exchange, Object body, OutputStream stream) throws XMLStreamException {
        XMLStreamWriter xmlWriter = getStaxConverter().createXMLStreamWriter(stream);
        return new StaxWriter(new QNameMap(), xmlWriter);
    }
View Full Code Here

        return new StaxWriter(new QNameMap(), xmlWriter);
    }

    protected HierarchicalStreamReader createHierarchicalStreamReader(Exchange exchange, InputStream stream) throws XMLStreamException {
        XMLStreamReader xmlReader = getStaxConverter().createXMLStreamReader(stream);
        return new StaxReader(new QNameMap(), xmlReader);
    }
View Full Code Here

  private XStream xstream;

  private List<Class> typesToEnhance = new ArrayList<Class>();

  public XmlMediaType() {
    QNameMap qnameMap = new QNameMap();
    QName qname = new QName("http://www.w3.org/2005/Atom", "atom");
    qnameMap.registerMapping(qname, DefaultRelation.class);
    helper = new XStreamHelper(new StaxDriver(qnameMap));
  }
View Full Code Here

   */
  protected static class SchemaTypeUsingStaxProvider extends StaxDriver {

    public SchemaTypeUsingStaxProvider() {
      super();
      map = new QNameMap();
      map.setDefaultNamespace(KITE9_NAMESPACE);
    }
View Full Code Here

    protected Message createMessage(Object object, MessageProperties messageProperties) {
        try {
            byte[] body = null;
            if(object != null) {
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                StaxWriter writer = new StaxWriter(new QNameMap(), this.outputFactory.createXMLStreamWriter(outStream));
                this.objectMapper.marshal(object, writer);
                body = outStream.toByteArray();
            }
           
            messageProperties.setContentType(MessageProperties.CONTENT_TYPE_JSON);
View Full Code Here

        if(! MessageProperties.CONTENT_TYPE_JSON.equalsIgnoreCase(contentType))
            throw new MessageConversionException("Cannot understand a message of type "+contentType);

        try {
            ByteArrayInputStream inStream = new ByteArrayInputStream(body);
            StaxReader reader = new StaxReader(new QNameMap(), this.inputFactory.createXMLStreamReader(inStream, messageEncoding));
            return this.objectMapper.unmarshal(reader);
        } catch (XMLStreamException ex) {
            String typeId = (String) messageProperties.getHeaders().get(DefaultClassMapper.DEFAULT_CLASSID_FIELD_NAME);
            LOG.error("XMLStreamException trying to unmarshal message of type {}", typeId, ex);
            throw new MessageConversionException("Could not unmarshal message of type "+typeId, ex);
View Full Code Here

    protected Message createMessage(Object object, MessageProperties messageProperties) {
        try {
            byte[] body = null;
            if(object != null) {
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                StaxWriter writer = new StaxWriter(new QNameMap(), this.outputFactory.createXMLStreamWriter(outStream));
                this.objectMapper.marshal(object, writer);
                body = outStream.toByteArray();
            }
           
            messageProperties.setContentType(MessageProperties.CONTENT_TYPE_JSON);
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.io.xml.QNameMap

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.