private void doFromSoapMessage(Message message, Object sm) { SOAPMessage m = (SOAPMessage)sm; MessageContentsList list = (MessageContentsList)message.getContent(List.class); if (list == null) { list = new MessageContentsList(); message.setContent(List.class, list); } Object o = m; if (StreamSource.class.isAssignableFrom(type)) { try { try (CachedOutputStream out = new CachedOutputStream()) { XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out); StaxUtils.copy(new DOMSource(m.getSOAPPart()), xsw); xsw.close(); o = new StreamSource(out.getInputStream()); } } catch (Exception e) { throw new Fault(e); } } else if (SAXSource.class.isAssignableFrom(type)) { o = new StaxSource(new W3CDOMStreamReader(m.getSOAPPart())); } else if (Source.class.isAssignableFrom(type)) { o = new DOMSource(m.getSOAPPart()); } list.set(0, o); }
try (CachedOutputStream cos = new CachedOutputStream()) { StaxUtils.copy(obj, cos); source = obj; } else { try (CachedOutputStream cos = new CachedOutputStream()) { StaxUtils.copy(obj, cos); InputStream in = cos.getInputStream();
OutputStream getOut() { if (out == null) { out = new CachedOutputStream(); } return out; }
out = new CachedOutputStream(); message.setContent(OutputStream.class, out); XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
@Override protected void onFirstWrite() throws IOException { if (chunking) { super.onFirstWrite(); } else { wrappedStream = new CachedOutputStream(); } }
InputStream in = inMessage.getContent(InputStream.class); if (in != null) { CachedOutputStream cos = new CachedOutputStream(); IOUtils.copy(in, cos); inMessage.setContent(InputStream.class, cos.getInputStream());
private InputStream getStreamFromReader(XMLStreamReader input) throws IOException { try (CachedOutputStream out = new CachedOutputStream()) { StaxUtils.copy(input, out); return out.getInputStream(); } catch (XMLStreamException ex) { throw new IOException("XMLStreamException:" + ex.getMessage()); } }
private InputStream getInputStream(XMLStreamReader input) throws XMLStreamException, IOException { try (CachedOutputStream out = new CachedOutputStream()) { StaxUtils.copy(input, out); return out.getInputStream(); } } public DOMSource read(XMLStreamReader reader) {
private InputStream getInputStream(XMLStreamReader input) throws XMLStreamException, IOException { try (CachedOutputStream out = new CachedOutputStream()) { StaxUtils.copy(input, out); return out.getInputStream(); } } public DOMSource read(XMLStreamReader reader) {
@Override protected void marshalToWriter(Marshaller ms, Object obj, XMLStreamWriter writer, Annotation[] anns, MediaType mt) throws Exception { CachedOutputStream out = new CachedOutputStream(); marshalToOutputStream(ms, obj, out, anns, mt); StaxUtils.copy(new StreamSource(out.getInputStream()), writer); }
@Override protected void marshalToWriter(Marshaller ms, Object obj, XMLStreamWriter writer, MediaType mt) throws Exception { CachedOutputStream out = new CachedOutputStream(); marshalToOutputStream(ms, obj, out, mt); StaxUtils.copy(new StreamSource(out.getInputStream()), writer); }
public static void restoreForm(FormEncodingProvider<Form> provider, Form form, Message message) throws Exception { CachedOutputStream os = new CachedOutputStream(); writeForm(provider, form, os); message.setContent(InputStream.class, os.getInputStream()); }
public static void restoreForm(FormEncodingProvider<Form> provider, Form form, Message message) throws Exception { CachedOutputStream os = new CachedOutputStream(); writeForm(provider, form, os); message.setContent(InputStream.class, os.getInputStream()); }
private InputStream getInputStream(XMLStreamReader input) throws XMLStreamException, IOException { CachedOutputStream out = new CachedOutputStream(); try { StaxUtils.copy(input, out); return out.getInputStream(); } finally { out.close(); } } public DOMSource read(XMLStreamReader reader) {
protected void transformOS(Message message, OutputStream out) { CachedOutputStream wrapper = new CachedOutputStream(); CachedOutputStreamCallback callback = new XSLTCachedOutputStreamCallback(getXSLTTemplate(), out); wrapper.registerCallback(callback); message.setContent(OutputStream.class, wrapper); }
protected void transformOS(Message message, OutputStream out) { CachedOutputStream wrapper = new CachedOutputStream(); CachedOutputStreamCallback callback = new XSLTCachedOutputStreamCallback(getXSLTTemplate(), out); wrapper.registerCallback(callback); message.setContent(OutputStream.class, wrapper); }
protected void transformOS(Message message, OutputStream out) { CachedOutputStream wrapper = new CachedOutputStream(); CachedOutputStreamCallback callback = new XSLTCachedOutputStreamCallback(getXSLTTemplate(), out); wrapper.registerCallback(callback); message.setContent(OutputStream.class, wrapper); }
protected void transformOS(Message message, OutputStream out) { CachedOutputStream wrapper = new CachedOutputStream(); CachedOutputStreamCallback callback = new XSLTCachedOutputStreamCallback(getXSLTTemplate(), out); wrapper.registerCallback(callback); message.setContent(OutputStream.class, wrapper); }
public void prepare(final Message message) throws IOException { if (!MessageUtils.getContextualBoolean(message, DIRECT_DISPATCH)) { dispatchViaPipe(message); } else { // prepare the stream here CachedOutputStream stream = new CachedOutputStream(); message.setContent(OutputStream.class, stream); //save the original stream message.put(CachedOutputStream.class, stream); stream.holdTempFile(); } }
private InputStream copyIn(InputStream in) throws Exception { try (CachedOutputStream bos = new CachedOutputStream()) { IOUtils.copyAndCloseInput(in, bos); in = bos.getInputStream(); bos.close(); return in; } } private String getStringFromInputStream(InputStream in) throws Exception {