use of org.apache.cxf.io.CacheSizeExceededException in project cxf by apache.
the class MessageContextImpl method get.
public Object get(Object key) {
String keyValue = key.toString();
if (MultipartBody.INBOUND_MESSAGE_ATTACHMENTS.equals(keyValue) || (MultipartBody.INBOUND_MESSAGE_ATTACHMENTS + ".embedded").equals(keyValue)) {
try {
return createAttachments(key.toString());
} catch (CacheSizeExceededException e) {
m.getExchange().put("cxf.io.cacheinput", Boolean.FALSE);
throw new WebApplicationException(e, 413);
} catch (HeaderSizeExceededException e) {
throw new WebApplicationException(e, 413);
}
}
if (keyValue.equals("WRITE-" + Message.ATTACHMENTS)) {
return m.getExchange().getOutMessage().get(Message.ATTACHMENTS);
}
Message currentMessage = getCurrentMessage();
Object value = currentMessage.get(key);
if (value == null) {
if (Message.class.getName().equals(key)) {
return currentMessage;
}
Exchange exchange = currentMessage.getExchange();
if (exchange != null) {
Message otherMessage = exchange.getInMessage() == currentMessage ? exchange.getOutMessage() : exchange.getInMessage();
if (otherMessage != null) {
value = otherMessage.get(key);
}
if (value == null) {
value = m.getExchange().get(key);
}
}
}
return value;
}
use of org.apache.cxf.io.CacheSizeExceededException in project cxf by apache.
the class AttachmentDataSource method cache.
public void cache(Message message) throws IOException {
if (cache == null) {
cache = new CachedOutputStream();
AttachmentUtil.setStreamedAttachmentProperties(message, cache);
try {
IOUtils.copy(ins, cache);
cache.lockOutputStream();
if (delegate != null) {
delegate.setInputStream(cache.getInputStream());
}
} catch (CacheSizeExceededException cee) {
cache.close();
cache = null;
throw cee;
} catch (IOException cee) {
cache.close();
cache = null;
throw cee;
} finally {
try {
ins.close();
} catch (Exception ex) {
// ignore
}
ins = null;
}
}
}
use of org.apache.cxf.io.CacheSizeExceededException in project tomee by apache.
the class AttachmentDataSource method cache.
public void cache(Message message) throws IOException {
if (cache == null) {
cache = new CachedOutputStream();
AttachmentUtil.setStreamedAttachmentProperties(message, cache);
try {
IOUtils.copyAndCloseInput(ins, cache);
cache.lockOutputStream();
if (delegate != null) {
delegate.setInputStream(cache.getInputStream());
}
} catch (CacheSizeExceededException | IOException cee) {
cache.close();
cache = null;
throw cee;
} finally {
ins = null;
}
}
}
Aggregations