public static void setStreamedAttachmentProperties(Message message, CachedOutputStream bos) throws IOException { Object directory = message.getContextualProperty(AttachmentDeserializer.ATTACHMENT_DIRECTORY); if (directory != null) { if (directory instanceof File) { bos.setOutputDir((File)directory); } else { bos.setOutputDir(new File((String)directory)); } } Object threshold = message.getContextualProperty(AttachmentDeserializer.ATTACHMENT_MEMORY_THRESHOLD); if (threshold != null) { if (threshold instanceof Long) { bos.setThreshold((Long)threshold); } else { bos.setThreshold(Long.parseLong((String)threshold)); } } else if (!CachedOutputStream.isThresholdSysPropSet()) { // Use the default AttachmentDeserializer Threshold only if there is no system property defined bos.setThreshold(AttachmentDeserializer.THRESHOLD); } Object maxSize = message.getContextualProperty(AttachmentDeserializer.ATTACHMENT_MAX_SIZE); if (maxSize != null) { if (maxSize instanceof Long) { bos.setMaxSize((Long) maxSize); } else { bos.setMaxSize(Long.parseLong((String)maxSize)); } } }
if (threshold != null) { if (threshold instanceof Long) { bos.setThreshold((Long)threshold); } else { bos.setThreshold(Long.valueOf((String)threshold)); bos.setThreshold(AttachmentDeserializer.THRESHOLD);
if (threshold != null) { if (threshold instanceof Long) { bos.setThreshold((Long)threshold); } else { bos.setThreshold(Long.valueOf((String)threshold)); bos.setThreshold(AttachmentDeserializer.THRESHOLD);
public static void setStreamedAttachmentProperties(Message message, CachedOutputStream bos) throws IOException { Object directory = message.getContextualProperty(AttachmentDeserializer.ATTACHMENT_DIRECTORY); if (directory != null) { if (directory instanceof File) { bos.setOutputDir((File)directory); } else { bos.setOutputDir(new File((String)directory)); } } Object threshold = message.getContextualProperty(AttachmentDeserializer.ATTACHMENT_MEMORY_THRESHOLD); if (threshold != null) { if (threshold instanceof Long) { bos.setThreshold((Long)threshold); } else { bos.setThreshold(Long.parseLong((String)threshold)); } } else if (!CachedOutputStream.isThresholdSysPropSet()) { // Use the default AttachmentDeserializer Threshold only if there is no system property defined bos.setThreshold(AttachmentDeserializer.THRESHOLD); } Object maxSize = message.getContextualProperty(AttachmentDeserializer.ATTACHMENT_MAX_SIZE); if (maxSize != null) { if (maxSize instanceof Long) { bos.setMaxSize((Long) maxSize); } else { bos.setMaxSize(Long.parseLong((String)maxSize)); } } }
private void handleInputStream(Message message, InputStream is) throws IOException { CachedOutputStream bos = new CachedOutputStream(); if (threshold > 0) { bos.setThreshold(threshold); } // use the appropriate input stream and restore it later InputStream bis = is instanceof DelegatingInputStream ? ((DelegatingInputStream)is).getInputStream() : is; // only copy up to the limit since that's all we need to log // we can stream the rest IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit); bos.flush(); bis = new SequenceInputStream(bos.getInputStream(), bis); // restore the delegating input stream or the input stream if (is instanceof DelegatingInputStream) { ((DelegatingInputStream)is).setInputStream(bis); } else { message.setContent(InputStream.class, bis); } message.setContent(CachedOutputStream.class, bos); }
private void handleInputStream(Message message, InputStream is) throws IOException { CachedOutputStream bos = new CachedOutputStream(); if (threshold > 0) { bos.setThreshold(threshold); } // use the appropriate input stream and restore it later InputStream bis = is instanceof DelegatingInputStream ? ((DelegatingInputStream)is).getInputStream() : is; // only copy up to the limit since that's all we need to log // we can stream the rest IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit); bos.flush(); bis = new SequenceInputStream(bos.getInputStream(), bis); // restore the delegating input stream or the input stream if (is instanceof DelegatingInputStream) { ((DelegatingInputStream)is).setInputStream(bis); } else { message.setContent(InputStream.class, bis); } message.setContent(CachedOutputStream.class, bos); }
CachedOutputStream bos = new CachedOutputStream(); if (threshold > 0) { bos.setThreshold(threshold);
CachedOutputStream bos = new CachedOutputStream(); if (threshold > 0) { bos.setThreshold(threshold);
CachedOutputStream bos = new CachedOutputStream(); if (threshold > 0) { bos.setThreshold(threshold);
protected void logInputStream(Message message, InputStream is, LoggingMessage buffer, String encoding, String ct) { CachedOutputStream bos = new CachedOutputStream(); if (threshold > 0) { bos.setThreshold(threshold);
CachedOutputStream bos = new CachedOutputStream(); if (threshold > 0) { bos.setThreshold(threshold);