Package org.apache.axiom.om.impl

Examples of org.apache.axiom.om.impl.MTOMXMLStreamWriter


            }
        }
    }

    public void serialize(Writer writerTarget, OMOutputFormat format) throws XMLStreamException {
        MTOMXMLStreamWriter writer =
            new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writerTarget));
        writer.setOutputFormat(format);
        serialize(writer);
        writer.flush();
        writer.close();
    }
View Full Code Here


                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                OMOutputFormat format = new OMOutputFormat();
                String charSetEncoding = (String) mc.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
                charSetEncoding = (charSetEncoding == null) ? "UTF-8" : charSetEncoding;
                format.setCharSetEncoding(charSetEncoding);
                MTOMXMLStreamWriter writer  = new MTOMXMLStreamWriter(baos, format);
                msg.outputTo(writer, false);
                writer.flush();
                text =  baos.toString(charSetEncoding);
            } catch (Throwable t) {
                if (log.isDebugEnabled()) {
                    log.debug("Cannot access message as string", t);
                }
View Full Code Here

  public void writeTo(java.io.Writer writer) throws IOException {
    try {     
      OMOutputFormat outputFormat = new OMOutputFormat();
      if (this.getCharsetEncoding() != null)
        outputFormat.setCharSetEncoding(this.getCharsetEncoding());
      MTOMXMLStreamWriter omwriter =
        new MTOMXMLStreamWriter(
          StAXUtils.createXMLStreamWriter(writer));
      omwriter.setOutputFormat(outputFormat);
      this.internalSerialize(omwriter);
      omwriter.flush();   
    } catch (XMLStreamException e) {
      throw new FOMException(e);
    }
  }
View Full Code Here

  public void writeTo(java.io.Writer writer) throws IOException {
    try {     
      OMOutputFormat outputFormat = new OMOutputFormat();
      if (this.getCharsetEncoding() != null)
        outputFormat.setCharSetEncoding(this.getCharsetEncoding());
      MTOMXMLStreamWriter omwriter =
        new MTOMXMLStreamWriter(
          StAXUtils.createXMLStreamWriter(writer));
      omwriter.setOutputFormat(outputFormat);
      this.internalSerialize(omwriter);
      omwriter.flush();   
    } catch (XMLStreamException e) {
      throw new FOMException(e);
    }
  }
View Full Code Here

        return fac.createOMElement(txtFileDS, BaseConstants.DEFAULT_TEXT_WRAPPER);
    }

    @Override
    public void serialize(OutputStream out, OMOutputFormat format) throws XMLStreamException {
        XMLStreamWriter writer = new MTOMXMLStreamWriter(out, format);
        serialize(writer);
        writer.flush();
    }
View Full Code Here

        writer.flush();
    }

    @Override
    public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
        MTOMXMLStreamWriter xmlWriter =
            new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer));
        xmlWriter.setOutputFormat(format);
        serialize(xmlWriter);
        xmlWriter.flush();
    }
View Full Code Here

        } else {
            try {
                OMOutputFormat outputFormat = new OMOutputFormat();
                if (this.getCharsetEncoding() != null)
                    outputFormat.setCharSetEncoding(this.getCharsetEncoding());
                MTOMXMLStreamWriter omwriter = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer));
                omwriter.setOutputFormat(outputFormat);
                this.internalSerialize(omwriter);
                omwriter.flush();
            } catch (XMLStreamException e) {
                throw new FOMException(e);
            }
        }
    }
View Full Code Here

            writeOutput(writer2);
        } else {
            //check whether we have a MTOMXMLStreamWriter. if so
            //we can optimize the writing!
            if (writer2 instanceof MTOMXMLStreamWriter) {
                MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
                if (writer.isOptimized()) {
                    if (contentID == null) {
                        contentID = writer.getNextContentId();
                    }
                    // send binary as MTOM optimised
                    this.attribute = new OMAttributeImpl("href",
                                                         new OMNamespaceImpl("", ""),
                                                         "cid:" + getContentID(), this.factory);
                    this.serializeStartpart(writer);
                    writer.writeOptimized(this);
                    writer.writeEndElement();
                } else {
                    //do normal base64
                    writeOutput(writer);
                }
            } else {
View Full Code Here

    protected void checkParent(OMElement parent) throws SOAPProcessingException {
        // here do nothing as SOAPEnvelope doesn't have a parent !!!
    }

    protected void internalSerialize(XMLStreamWriter writer2, boolean cache) throws XMLStreamException {
        MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
        if (!writer.isIgnoreXMLDeclaration()) {
            String charSetEncoding = writer.getCharSetEncoding();
            String xmlVersion = writer.getXmlVersion();
            writer.getXmlStreamWriter().writeStartDocument(charSetEncoding == null ?
                    OMConstants.DEFAULT_CHAR_SET_ENCODING : charSetEncoding,
                    xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION : xmlVersion);
        }
        super.internalSerialize(writer, cache);
    }
View Full Code Here

     * @param output
     * @param format
     * @throws XMLStreamException
     */
    public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException {
        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
        internalSerializeAndConsume(writer);
        writer.flush();
    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.impl.MTOMXMLStreamWriter

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.