public void cleanupCache(){ for (CachedOutputStream cache : cacheList) { try { cache.close(); } catch (IOException e) {} } } }
@Override public void handleMessage(Message message) throws Fault { if (cos != null) { try { cos.close(); } catch (IOException e) { } } } });
@Override public void handleMessage(Message message) throws Fault { if (cos != null) { try { cos.close(); } catch (IOException e) { } } } });
public void cleanupCache(){ for (CachedOutputStream cache : cacheList) { try { cache.close(); } catch (IOException e) {} } }
@Override public void close() throws IOException { try { is.close(); } catch (IOException e) { // Ignore } try { cos.close(); } catch (IOException e) { // Ignore } }
@Override public void close() throws IOException { try { is.close(); } catch (IOException e) { // Ignore } try { cos.close(); } catch (IOException e) { // Ignore } } });
public static String getStringFromInputStream(InputStream in) throws Exception { CachedOutputStream bos = new CachedOutputStream(); IOUtils.copy(in, bos); in.close(); bos.close(); return bos.getOut().toString(); }
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(); } }
public static InputStream convertMessageToInputStream(Source src) throws IOException { CachedOutputStream cos = new CachedOutputStream(); try { StaxUtils.copy(src, cos); return cos.getInputStream(); } catch (XMLStreamException e) { IOException ioe = new IOException(e.getMessage()); ioe.initCause(e); throw ioe; } finally { try { cos.close(); } catch (Exception ex) { //ignore } } } }
private void closeOldSavedContent(Message message) { CachedOutputStream saved = (CachedOutputStream)message.get(RMMessageConstants.SAVED_CONTENT); if (saved != null) { saved.releaseTempFileHold(); try { saved.close(); } catch (IOException e) { // ignore } } Closeable closable = (Closeable)message.get("org.apache.cxf.ws.rm.content.closeable"); if (null != closable) { try { closable.close(); } catch (IOException e) { // Ignore } } }
private void releaseSavedMessage() { CachedOutputStream saved = (CachedOutputStream)message.remove(RMMessageConstants.SAVED_CONTENT); if (saved != null) { saved.releaseTempFileHold(); try { saved.close(); } catch (IOException e) { // ignore } } // Any unclosed resources must be closed to release the temp files. Closeable closeable = (Closeable)message.get(RMMessageConstants.ATTACHMENTS_CLOSEABLE); if (closeable != null) { try { closeable.close(); } catch (IOException e) { // ignore } } }
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 void handleOutputStream(final LogEvent event, Message message, CachedOutputStream cos) throws IOException { String encoding = (String) message.get(Message.ENCODING); if (StringUtils.isEmpty(encoding)) { encoding = StandardCharsets.UTF_8.name(); } StringBuilder payload = new StringBuilder(); cos.writeCacheTo(payload, encoding, limit); cos.close(); event.setPayload(payload.toString()); boolean isTruncated = cos.size() > limit && limit != -1; event.setTruncated(isTruncated); event.setFullContentFile(cos.getTempFile()); }
private void cache(DelegatingInputStream input, boolean deleteOnClose) throws IOException { if (loaded.contains(input)) { return; } loaded.add(input); CachedOutputStream out = null; InputStream origIn = input.getInputStream(); try { out = new CachedOutputStream(); AttachmentUtil.setStreamedAttachmentProperties(message, out); IOUtils.copy(input, out); input.setInputStream(out.getInputStream()); origIn.close(); } finally { if (out != null) { out.close(); } } }
private void handleOutputStream(final LogEvent event, Message message, CachedOutputStream cos) throws IOException { String encoding = (String) message.get(Message.ENCODING); if (StringUtils.isEmpty(encoding)) { encoding = StandardCharsets.UTF_8.name(); } StringBuilder payload = new StringBuilder(); cos.writeCacheTo(payload, encoding, limit); cos.close(); event.setPayload(payload.toString()); boolean isTruncated = cos.size() > limit && limit != -1; event.setTruncated(isTruncated); event.setFullContentFile(cos.getTempFile()); }
private void closeConnectionStream(SoapMessage soapMessage) throws IOException { InputStream is = soapMessage.getContent(InputStream.class); if (is != null) { CachedOutputStream bos = new CachedOutputStream(); try { IOUtils.copy(is, bos); } catch (IOException e) { //the is could be already closed for ws-rm, just ignore it. } bos.flush(); is.close(); soapMessage.setContent(InputStream.class, bos.getInputStream()); bos.close(); } }
void send(boolean complete) throws IOException { if (out == null) { return; } if (response.getStatus() >= 400) { int i = response.getStatus(); response.setStatus(200); response.addIntHeader(WebSocketUtils.SC_KEY, i); } out.flush(); out.lockOutputStream(); out.writeCacheTo(delegate); delegate.flush(); out.close(); out = null; }
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 {