use of org.apache.cxf.io.CachedOutputStream in project carbon-business-process by wso2.
the class AttachmentDataHolder method printDebug.
public void printDebug() {
boolean debugLogEnabled = log.isDebugEnabled();
if (log.isDebugEnabled()) {
log.debug("name:" + name);
log.debug("description:" + description);
log.debug("type:" + type);
log.debug("contentType:" + type);
log.debug("scope:" + scope);
CachedOutputStream bos = new CachedOutputStream();
try {
String fileName = bos.getOut().toString();
log.debug("fileName:" + fileName);
bos.close();
} catch (IOException e) {
log.error("Exception occured during reading the file name", e);
}
log.debug("Stream String:" + new String(attachmentArray));
}
}
use of org.apache.cxf.io.CachedOutputStream in project tomee by apache.
the class AttachmentDeserializer method cache.
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();
}
}
use of org.apache.cxf.io.CachedOutputStream in project tomee by apache.
the class FormUtils method restoreForm.
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());
}
use of org.apache.cxf.io.CachedOutputStream in project tomee by apache.
the class XSLTOutInterceptor method transformOS.
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);
}
use of org.apache.cxf.io.CachedOutputStream in project cxf by apache.
the class AttachmentUtilTest method integerAsAttachmentMaxSize.
@Test
public void integerAsAttachmentMaxSize() throws IOException {
CachedOutputStream cos = createMock(CachedOutputStream.class);
cos = testSetStreamedAttachmentProperties(AttachmentDeserializer.ATTACHMENT_MAX_SIZE, Integer.MAX_VALUE, cos);
replay(cos);
cos.setMaxSize(Integer.MAX_VALUE);
cos.setThreshold(102400L);
verify(cos);
}
Aggregations