/** * Check if MTOM is enabled. * <p> * Note that serialization code should use * {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, DataHandler, String, boolean)} * or * {@link XMLStreamWriterUtils#writeDataHandler(XMLStreamWriter, DataHandlerProvider, String, boolean)} * to submit any binary content and let this writer decide whether the content should be written * as base64 encoded character data or using <tt>xop:Include</tt>. This makes optimization * entirely transparent for the caller and there should be no need to check if the writer is * producing MTOM. However, in some cases this is not possible, such as when integrating with * 3rd party libraries. The serialization code should then use * {@link #prepareDataHandler(DataHandler)} so that it can write <tt>xop:Include</tt> elements * directly to the stream. In that case, the code may use the {@link #isOptimized()} method * check if MTOM is enabled at all. * * @return <code>true</code> if MTOM is enabled, <code>false</code> otherwise */ public boolean isOptimized() { return format.isOptimized(); }
if (log.isDebugEnabled()) { log.debug("start getBytes()"); log.debug(" isOptimized=" + format.isOptimized()); log.debug(" isDoingSWA=" + format.isDoingSWA()); try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); if (!format.isOptimized()) { if (format.isDoingSWA()) { writeSwAMessage(msgCtxt, bytesOut, format, false);
out.writeInt(revisionID); out.writeBoolean(ACTIVE_OBJECT); if (outputFormat.isOptimized()) { out.writeBoolean(true); if (log.isDebugEnabled()) { log.debug(correlationIDString + ":writeExternal(): " + "optimized=[" + outputFormat.isOptimized() + "] " + "optimizedContentType " + outputFormat.getContentType() + "] " + "charSetEnc=[" + outputFormat.getCharSetEncoding() + "] " +
out.writeInt(revisionID); out.writeBoolean(ACTIVE_OBJECT); if (outputFormat.isOptimized()) { out.writeBoolean(true); if (log.isDebugEnabled()) { log.debug(correlationIDString + ":writeExternal(): " + "optimized=[" + outputFormat.isOptimized() + "] " + "optimizedContentType " + outputFormat.getContentType() + "] " + "charSetEnc=[" + outputFormat.getCharSetEncoding() + "] " +
log.debug("start writeTo()"); log.debug(" preserve=" + preserve); log.debug(" isOptimized=" + format.isOptimized()); log.debug(" isDoingSWA=" + format.isDoingSWA()); if (!(format.isOptimized()) && format.isDoingSWA()) { writeSwAMessage(msgCtxt, out, format, preserve); } else {
if (isOptimized()) { ct = this.getContentTypeForMTOM(contentType); } else if (isDoingSWA()) {
log.debug("start writeTo()"); log.debug(" preserve=" + preserve); log.debug(" isOptimized=" + format.isOptimized()); log.debug(" isDoingSWA=" + format.isDoingSWA()); if (!(format.isOptimized()) && format.isDoingSWA()) { writeSwAMessage(msgCtxt, out, format, preserve); } else {
if (format.isOptimized() && !isComplete & (isEndDocument || depth == 0)) { log.debug("The XML writing is completed. Now the attachments are written"); isComplete = true;
public byte[] writeBytes() throws AxisFault { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); if (!format.isOptimized()) { OMOutputFormat format2 = new OMOutputFormat(); format2.setCharSetEncoding(charSetEnc); element.serializeAndConsume(bytesOut, format2); return bytesOut.toByteArray(); } else { format.setCharSetEncoding(charSetEnc); format.setDoOptimize(true); element.serializeAndConsume(bytesOut, format); return bytesOut.toByteArray(); } } catch (XMLStreamException e) { throw AxisFault.makeFault(e); } catch (FactoryConfigurationError e) { throw AxisFault.makeFault(e); } }
if (format.isOptimized()) { multipartWriter = new OMMultipartWriter(outStream, format); try {
public OMMultipartWriter(OutputStream out, OMOutputFormat format) { this.format = format; writer = format.getMultipartWriterFactory().createMultipartWriter(out, format.getMimeBoundary()); useCTEBase64 = format != null && Boolean.TRUE.equals( format.getProperty(OMOutputFormat.USE_CTE_BASE64_FOR_NON_TEXTUAL_ATTACHMENTS)); String soapContentType; if (format.isSOAP11()) { soapContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE; } else { soapContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE; } if (format.isOptimized()) { rootPartContentType = "application/xop+xml; charset=" + format.getCharSetEncoding() + "; type=\"" + soapContentType + "\""; } else { rootPartContentType = soapContentType + "; charset=" + format.getCharSetEncoding(); } }
TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream; String contentType = outputFormat.getContentType(); if (!(outputFormat.isDoingSWA() || outputFormat.isOptimized())) { String charsetEncoding = axiomMessage.getCharsetEncoding(); contentType += "; charset=" + charsetEncoding; if (!(outputFormat.isOptimized()) & outputFormat.isDoingSWA()) { writeSwAMessage(outputStream, outputFormat);
TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream; String contentType = outputFormat.getContentType(); if (!(outputFormat.isDoingSWA() || outputFormat.isOptimized())) { String charsetEncoding = axiomMessage.getCharsetEncoding(); contentType += "; charset=" + charsetEncoding; if (!(outputFormat.isOptimized()) & outputFormat.isDoingSWA()) { writeSwAMessage(outputStream, outputFormat);
TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream; String contentType = outputFormat.getContentType(); if (!(outputFormat.isDoingSWA() || outputFormat.isOptimized())) { String charsetEncoding = axiomMessage.getCharsetEncoding(); contentType += "; charset=" + charsetEncoding; if (!(outputFormat.isOptimized()) & outputFormat.isDoingSWA()) { writeSwAMessage(outputStream, outputFormat);
TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream; String contentType = outputFormat.getContentType(); if (!(outputFormat.isDoingSWA() || outputFormat.isOptimized())) { String charsetEncoding = axiomMessage.getCharsetEncoding(); contentType += "; charset=" + charsetEncoding; if (!(outputFormat.isOptimized()) & outputFormat.isDoingSWA()) { writeSwAMessage(outputStream, outputFormat);