CachedOutputStream csnew = (CachedOutputStream) message.getContent(OutputStream.class); String currentEnvelopeMessage = IOUtils.toString(csnew.getInputStream(), "UTF-8"); csnew.flush(); IOUtils.closeQuietly(csnew);
OutputStream os = message.getContent(OutputStream.class); CachedStream cs = new CachedStream(); message.setContent(OutputStream.class, cs); message.getInterceptorChain().doIntercept(message); try { cs.flush(); CachedOutputStream csnew = (CachedOutputStream) message.getContent(OutputStream.class); String soapMessage = IOUtils.toString(csnew.getInputStream()); ...
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); }
StaxUtils.copy(obj, cos); obj = new StreamSource(cos.getInputStream()); message.setContent(Source.class, new StreamSource(cos.getInputStream())); } catch (Exception e) { throw new Fault(e); try (CachedOutputStream cos = new CachedOutputStream()) { StaxUtils.copy(obj, cos); InputStream in = cos.getInputStream(); SOAPMessage msg = initSOAPMessage(in); source = new DOMSource(SAAJUtils.getBody(msg).getFirstChild());
/** * Internal constructor from cached output stream. * * @param os * @throws IOException */ private RewindableInputStream(CachedOutputStream os) throws IOException { super(os.getInputStream()); cachedStream = os; }
public InputStream getInputStream() { try { if (cache != null) { return cache.getInputStream(); } if (delegate == null) { delegate = new DelegatingInputStream(ins); } return delegate; } catch (IOException e) { return null; } }
public InputStream getInputStream() { try { if (cache != null) { return cache.getInputStream(); } if (delegate == null) { delegate = new DelegatingInputStream(ins); } return delegate; } catch (IOException e) { return 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) {
private InputStream getStreamFromReader(XMLStreamReader input) throws IOException { CachedOutputStream out = new CachedOutputStream(); try { StaxUtils.copy(input, out); return out.getInputStream(); } catch (XMLStreamException ex) { throw new IOException("XMLStreamException:" + ex.getMessage()); } finally { out.close(); } }
@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); }
private void cache(DelegatingInputStream input) throws IOException { if (loaded.contains(input)) { return; } loaded.add(input); InputStream origIn = input.getInputStream(); try (CachedOutputStream out = new CachedOutputStream()) { AttachmentUtil.setStreamedAttachmentProperties(message, out); IOUtils.copy(input, out); input.setInputStream(out.getInputStream()); origIn.close(); } }
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) {
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) {
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 {