Java Code Examples for com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory#create()
The following examples show how to use
com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory#create() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XMLCodec.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public ContentType encode(Packet packet, OutputStream out) { String encoding = (String) packet.invocationProperties .get(XMLConstants.OUTPUT_XML_CHARACTER_ENCODING); XMLStreamWriter writer = null; if (encoding != null && encoding.length() > 0) { writer = XMLStreamWriterFactory.create(out, encoding); } else { writer = XMLStreamWriterFactory.create(out); } try { if (packet.getMessage().hasPayload()){ writer.writeStartDocument(); packet.getMessage().writePayloadTo(writer); writer.flush(); } } catch (XMLStreamException e) { throw new WebServiceException(e); } return contentType; }
Example 2
Source File: XMLCodec.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public ContentType encode(Packet packet, OutputStream out) { String encoding = (String) packet.invocationProperties .get(XMLConstants.OUTPUT_XML_CHARACTER_ENCODING); XMLStreamWriter writer = null; if (encoding != null && encoding.length() > 0) { writer = XMLStreamWriterFactory.create(out, encoding); } else { writer = XMLStreamWriterFactory.create(out); } try { if (packet.getMessage().hasPayload()){ writer.writeStartDocument(); packet.getMessage().writePayloadTo(writer); writer.flush(); } } catch (XMLStreamException e) { throw new WebServiceException(e); } return contentType; }
Example 3
Source File: XMLCodec.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public ContentType encode(Packet packet, OutputStream out) { String encoding = (String) packet.invocationProperties .get(XMLConstants.OUTPUT_XML_CHARACTER_ENCODING); XMLStreamWriter writer = null; if (encoding != null && encoding.length() > 0) { writer = XMLStreamWriterFactory.create(out, encoding); } else { writer = XMLStreamWriterFactory.create(out); } try { if (packet.getMessage().hasPayload()){ writer.writeStartDocument(); packet.getMessage().writePayloadTo(writer); writer.flush(); } } catch (XMLStreamException e) { throw new WebServiceException(e); } return contentType; }
Example 4
Source File: XMLCodec.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public ContentType encode(Packet packet, OutputStream out) { String encoding = (String) packet.invocationProperties .get(XMLConstants.OUTPUT_XML_CHARACTER_ENCODING); XMLStreamWriter writer = null; if (encoding != null && encoding.length() > 0) { writer = XMLStreamWriterFactory.create(out, encoding); } else { writer = XMLStreamWriterFactory.create(out); } try { if (packet.getMessage().hasPayload()){ writer.writeStartDocument(); packet.getMessage().writePayloadTo(writer); writer.flush(); } } catch (XMLStreamException e) { throw new WebServiceException(e); } return contentType; }
Example 5
Source File: XMLCodec.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public ContentType encode(Packet packet, OutputStream out) { String encoding = (String) packet.invocationProperties .get(XMLConstants.OUTPUT_XML_CHARACTER_ENCODING); XMLStreamWriter writer = null; if (encoding != null && encoding.length() > 0) { writer = XMLStreamWriterFactory.create(out, encoding); } else { writer = XMLStreamWriterFactory.create(out); } try { if (packet.getMessage().hasPayload()){ writer.writeStartDocument(); packet.getMessage().writePayloadTo(writer); writer.flush(); } } catch (XMLStreamException e) { throw new WebServiceException(e); } return contentType; }
Example 6
Source File: XMLCodec.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public ContentType encode(Packet packet, OutputStream out) { String encoding = (String) packet.invocationProperties .get(XMLConstants.OUTPUT_XML_CHARACTER_ENCODING); XMLStreamWriter writer = null; if (encoding != null && encoding.length() > 0) { writer = XMLStreamWriterFactory.create(out, encoding); } else { writer = XMLStreamWriterFactory.create(out); } try { if (packet.getMessage().hasPayload()){ writer.writeStartDocument(); packet.getMessage().writePayloadTo(writer); writer.flush(); } } catch (XMLStreamException e) { throw new WebServiceException(e); } return contentType; }
Example 7
Source File: StreamSOAPCodec.java From hottub with GNU General Public License v2.0 | 5 votes |
public ContentType encode(Packet packet, OutputStream out) { if (packet.getMessage() != null) { String encoding = getPacketEncoding(packet); packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); XMLStreamWriter writer = XMLStreamWriterFactory.create(out, encoding); try { packet.getMessage().writeTo(writer); writer.flush(); } catch (XMLStreamException e) { throw new WebServiceException(e); } XMLStreamWriterFactory.recycle(writer); } return getContentType(packet); }
Example 8
Source File: StreamSOAPCodec.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public ContentType encode(Packet packet, OutputStream out) { if (packet.getMessage() != null) { String encoding = getPacketEncoding(packet); packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); XMLStreamWriter writer = XMLStreamWriterFactory.create(out, encoding); try { packet.getMessage().writeTo(writer); writer.flush(); } catch (XMLStreamException e) { throw new WebServiceException(e); } XMLStreamWriterFactory.recycle(writer); } return getContentType(packet); }
Example 9
Source File: Packet.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append(super.toString()); String content; try { Message msg = getMessage(); if (msg != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLStreamWriter xmlWriter = XMLStreamWriterFactory.create(baos, "UTF-8"); msg.copy().writeTo(xmlWriter); xmlWriter.flush(); xmlWriter.close(); baos.flush(); XMLStreamWriterFactory.recycle(xmlWriter); byte[] bytes = baos.toByteArray(); //message = Messages.create(XMLStreamReaderFactory.create(null, new ByteArrayInputStream(bytes), "UTF-8", true)); content = new String(bytes, "UTF-8"); } else { content = "<none>"; } } catch (Throwable t) { throw new WebServiceException(t); } buf.append(" Content: ").append(content); return buf.toString(); }
Example 10
Source File: StreamSOAPCodec.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public ContentType encode(Packet packet, OutputStream out) { if (packet.getMessage() != null) { String encoding = getPacketEncoding(packet); packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); XMLStreamWriter writer = XMLStreamWriterFactory.create(out, encoding); try { packet.getMessage().writeTo(writer); writer.flush(); } catch (XMLStreamException e) { throw new WebServiceException(e); } XMLStreamWriterFactory.recycle(writer); } return getContentType(packet); }
Example 11
Source File: StreamSOAPCodec.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public ContentType encode(Packet packet, OutputStream out) { if (packet.getMessage() != null) { String encoding = getPacketEncoding(packet); packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); XMLStreamWriter writer = XMLStreamWriterFactory.create(out, encoding); try { packet.getMessage().writeTo(writer); writer.flush(); } catch (XMLStreamException e) { throw new WebServiceException(e); } XMLStreamWriterFactory.recycle(writer); } return getContentType(packet); }
Example 12
Source File: Packet.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append(super.toString()); String content; try { Message msg = getMessage(); if (msg != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLStreamWriter xmlWriter = XMLStreamWriterFactory.create(baos, "UTF-8"); msg.copy().writeTo(xmlWriter); xmlWriter.flush(); xmlWriter.close(); baos.flush(); XMLStreamWriterFactory.recycle(xmlWriter); byte[] bytes = baos.toByteArray(); //message = Messages.create(XMLStreamReaderFactory.create(null, new ByteArrayInputStream(bytes), "UTF-8", true)); content = new String(bytes, "UTF-8"); } else { content = "<none>"; } } catch (Throwable t) { throw new WebServiceException(t); } buf.append(" Content: ").append(content); return buf.toString(); }
Example 13
Source File: Packet.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append(super.toString()); String content; try { Message msg = getMessage(); if (msg != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLStreamWriter xmlWriter = XMLStreamWriterFactory.create(baos, "UTF-8"); msg.copy().writeTo(xmlWriter); xmlWriter.flush(); xmlWriter.close(); baos.flush(); XMLStreamWriterFactory.recycle(xmlWriter); byte[] bytes = baos.toByteArray(); //message = Messages.create(XMLStreamReaderFactory.create(null, new ByteArrayInputStream(bytes), "UTF-8", true)); content = new String(bytes, "UTF-8"); } else { content = "<none>"; } } catch (Throwable t) { throw new WebServiceException(t); } buf.append(" Content: ").append(content); return buf.toString(); }
Example 14
Source File: StreamSOAPCodec.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public ContentType encode(Packet packet, OutputStream out) { if (packet.getMessage() != null) { String encoding = getPacketEncoding(packet); packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); XMLStreamWriter writer = XMLStreamWriterFactory.create(out, encoding); try { packet.getMessage().writeTo(writer); writer.flush(); } catch (XMLStreamException e) { throw new WebServiceException(e); } XMLStreamWriterFactory.recycle(writer); } return getContentType(packet); }
Example 15
Source File: StreamSOAPCodec.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public ContentType encode(Packet packet, OutputStream out) { if (packet.getMessage() != null) { String encoding = getPacketEncoding(packet); packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); XMLStreamWriter writer = XMLStreamWriterFactory.create(out, encoding); try { packet.getMessage().writeTo(writer); writer.flush(); } catch (XMLStreamException e) { throw new WebServiceException(e); } XMLStreamWriterFactory.recycle(writer); } return getContentType(packet); }
Example 16
Source File: Packet.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append(super.toString()); String content; try { Message msg = getMessage(); if (msg != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLStreamWriter xmlWriter = XMLStreamWriterFactory.create(baos, "UTF-8"); msg.copy().writeTo(xmlWriter); xmlWriter.flush(); xmlWriter.close(); baos.flush(); XMLStreamWriterFactory.recycle(xmlWriter); byte[] bytes = baos.toByteArray(); //message = Messages.create(XMLStreamReaderFactory.create(null, new ByteArrayInputStream(bytes), "UTF-8", true)); content = new String(bytes, "UTF-8"); } else { content = "<none>"; } } catch (Throwable t) { throw new WebServiceException(t); } buf.append(" Content: ").append(content); return buf.toString(); }
Example 17
Source File: Packet.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append(super.toString()); String content; try { Message msg = getMessage(); if (msg != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLStreamWriter xmlWriter = XMLStreamWriterFactory.create(baos, "UTF-8"); msg.copy().writeTo(xmlWriter); xmlWriter.flush(); xmlWriter.close(); baos.flush(); XMLStreamWriterFactory.recycle(xmlWriter); byte[] bytes = baos.toByteArray(); //message = Messages.create(XMLStreamReaderFactory.create(null, new ByteArrayInputStream(bytes), "UTF-8", true)); content = new String(bytes, "UTF-8"); } else { content = "<none>"; } } catch (Throwable t) { throw new WebServiceException(t); } buf.append(" Content: ").append(content); return buf.toString(); }
Example 18
Source File: MtomCodec.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public ContentType encode(Packet packet, OutputStream out) throws IOException { ContentTypeImpl ctImpl = (ContentTypeImpl) this.getStaticContentType(packet); String boundary = ctImpl.getBoundary(); String rootId = ctImpl.getRootId(); if(packet.getMessage() != null){ try { String encoding = getPacketEncoding(packet); packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); String actionParameter = getActionParameter(packet, version); String soapXopContentType = getSOAPXopContentType(encoding, version, actionParameter); writeln("--"+boundary, out); writeMimeHeaders(soapXopContentType, rootId, out); //mtom attachments that need to be written after the root part List<ByteArrayBuffer> mtomAttachments = new ArrayList<ByteArrayBuffer>(); MtomStreamWriterImpl writer = new MtomStreamWriterImpl( XMLStreamWriterFactory.create(out, encoding), mtomAttachments, boundary, mtomFeature); packet.getMessage().writeTo(writer); XMLStreamWriterFactory.recycle(writer); writeln(out); for(ByteArrayBuffer bos : mtomAttachments){ bos.write(out); } // now write out the attachments in the message that weren't // previously written writeNonMtomAttachments(packet.getMessage().getAttachments(), out, boundary); //write out the end boundary writeAsAscii("--"+boundary, out); writeAsAscii("--", out); } catch (XMLStreamException e) { throw new WebServiceException(e); } } //now create the boundary for next encode() call // createConteTypeHeader(); return ctImpl; }
Example 19
Source File: MtomCodec.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public ContentType encode(Packet packet, OutputStream out) throws IOException { ContentTypeImpl ctImpl = (ContentTypeImpl) this.getStaticContentType(packet); String boundary = ctImpl.getBoundary(); String rootId = ctImpl.getRootId(); if(packet.getMessage() != null){ try { String encoding = getPacketEncoding(packet); packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); String actionParameter = getActionParameter(packet, version); String soapXopContentType = getSOAPXopContentType(encoding, version, actionParameter); writeln("--"+boundary, out); writeMimeHeaders(soapXopContentType, rootId, out); //mtom attachments that need to be written after the root part List<ByteArrayBuffer> mtomAttachments = new ArrayList<ByteArrayBuffer>(); MtomStreamWriterImpl writer = new MtomStreamWriterImpl( XMLStreamWriterFactory.create(out, encoding), mtomAttachments, boundary, mtomFeature); packet.getMessage().writeTo(writer); XMLStreamWriterFactory.recycle(writer); writeln(out); for(ByteArrayBuffer bos : mtomAttachments){ bos.write(out); } // now write out the attachments in the message that weren't // previously written writeNonMtomAttachments(packet.getMessage().getAttachments(), out, boundary); //write out the end boundary writeAsAscii("--"+boundary, out); writeAsAscii("--", out); } catch (XMLStreamException e) { throw new WebServiceException(e); } } //now create the boundary for next encode() call // createConteTypeHeader(); return ctImpl; }
Example 20
Source File: MtomCodec.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public ContentType encode(Packet packet, OutputStream out) throws IOException { ContentTypeImpl ctImpl = (ContentTypeImpl) this.getStaticContentType(packet); String boundary = ctImpl.getBoundary(); String rootId = ctImpl.getRootId(); if(packet.getMessage() != null){ try { String encoding = getPacketEncoding(packet); packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); String actionParameter = getActionParameter(packet, version); String soapXopContentType = getSOAPXopContentType(encoding, version, actionParameter); writeln("--"+boundary, out); writeMimeHeaders(soapXopContentType, rootId, out); //mtom attachments that need to be written after the root part List<ByteArrayBuffer> mtomAttachments = new ArrayList<ByteArrayBuffer>(); MtomStreamWriterImpl writer = new MtomStreamWriterImpl( XMLStreamWriterFactory.create(out, encoding), mtomAttachments, boundary, mtomFeature); packet.getMessage().writeTo(writer); XMLStreamWriterFactory.recycle(writer); writeln(out); for(ByteArrayBuffer bos : mtomAttachments){ bos.write(out); } // now write out the attachments in the message that weren't // previously written writeNonMtomAttachments(packet.getMessage().getAttachments(), out, boundary); //write out the end boundary writeAsAscii("--"+boundary, out); writeAsAscii("--", out); } catch (XMLStreamException e) { throw new WebServiceException(e); } } //now create the boundary for next encode() call // createConteTypeHeader(); return ctImpl; }