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()); ...
@Override protected void retransmitStream() throws IOException { Boolean b = (Boolean)outMessage.get(HTTPURL_CONNECTION_METHOD_REFLECTION); OutputStream out = connectAndGetOutputStream(b); cachedStream.writeCacheTo(out); } }
try (CachedOutputStream cos = new CachedOutputStream()) { StaxUtils.copy(obj, cos); obj = new StreamSource(cos.getInputStream()); message.setContent(Source.class, new StreamSource(cos.getInputStream())); } catch (Exception e) { throw new Fault(e); source = obj; } else { try (CachedOutputStream cos = new CachedOutputStream()) { StaxUtils.copy(obj, cos); InputStream in = cos.getInputStream(); SOAPMessage msg = initSOAPMessage(in); source = new DOMSource(SAAJUtils.getBody(msg).getFirstChild());
out = new CachedOutputStream(); message.setContent(OutputStream.class, out); XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
@Override public void close() throws IOException { if (buffer != null) { thresholdNotReached(); unBuffer(); } super.close(); }
LoadingByteArrayOutputStream tmp = buffer; buffer = null; super.write(tmp.getRawBytes(), 0, tmp.size()); super.close(); } else if (cachedStream != null) { super.flush(); cachedStream.getOut().close(); cachedStream.closeFlowthroughStream(); } finally { if (cachingForRetransmission && cachedStream != null) { cachedStream.close();
new CacheAndWriteOutputStream(cout); wrappedStream = cachedStream; } else {
public CachedWriter(long threshold) { this.threshold = threshold; currentStream = new LoadingCharArrayWriter(); inmem = true; readBusProperties(); }
public void cacheInput() { if (!cached && (exchange.isOneWay() || isWSAddressingReplyToSpecified(exchange))) { //For one-ways and WS-Addressing invocations with ReplyTo address, //we need to cache the values of the HttpServletRequest //so they can be queried later for things like paths and schemes //and such like that. //Please note, exchange used to always get the "current" message exchange.getInMessage().put(HTTP_REQUEST, new HttpServletRequestSnapshot(req)); } super.cacheInput(); } private boolean isWSAddressingReplyToSpecified(Exchange ex) {
private void enforceLimits() throws IOException { if (maxSize > 0 && totalLength > maxSize) { throw new CacheSizeExceededException(); } if (inmem && totalLength > threshold && currentStream instanceof ByteArrayOutputStream) { createFileOutputStream(); } }
cachedStream.close();
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); }
@Override public void close() throws IOException { if (buffer != null) { thresholdNotReached(); unBuffer(); } super.close(); }
public CachedWriter(long threshold) { this.threshold = threshold; currentStream = new LoadingCharArrayWriter(); inmem = true; readBusProperties(); }
/** * This procedure handles all retransmits, if any. * * @throws IOException */ protected void handleRetransmits() throws IOException { // If we have a cachedStream, we are caching the request. if (cachedStream != null || getClient().isAutoRedirect() && KNOWN_HTTP_VERBS_WITH_NO_CONTENT.contains(getMethod()) || authSupplier != null && authSupplier.requiresRequestCaching()) { if (LOG.isLoggable(Level.FINE) && cachedStream != null) { StringBuilder b = new StringBuilder(4096); b.append("Conduit \"").append(getConduitName()) .append("\" Transmit cached message to: ") .append(url) .append(": "); cachedStream.writeCacheTo(b, 16L * 1024L); LOG.fine(b.toString()); } int maxRetransmits = getMaxRetransmits(); updateCookiesBeforeRetransmit(); int nretransmits = 0; while ((maxRetransmits < 0 || nretransmits < maxRetransmits) && processRetransmit()) { nretransmits++; } } } /**
InputStream in = inMessage.getContent(InputStream.class); if (in != null) { CachedOutputStream cos = new CachedOutputStream(); IOUtils.copy(in, cos); inMessage.setContent(InputStream.class, cos.getInputStream());
@Override public void close() throws IOException { if (buffer != null) { thresholdNotReached(); unBuffer(); } super.close(); }