void callHandlersOnResponse(MessageUpdatableContext context, boolean handleFault) { //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); AttachmentSet attSet = context.packet.getMessage().getAttachments(); for (Entry<String, DataHandler> entry : atts.entrySet()) { String cid = entry.getKey(); if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice Attachment att = new DataHandlerAttachment(cid, atts.get(cid)); attSet.add(att); } } try { //SERVER-SIDE processor.callHandlersResponse(HandlerProcessor.Direction.OUTBOUND, context, handleFault); } catch (WebServiceException wse) { //no rewrapping throw wse; } catch (RuntimeException re) { throw re; } }
/** * Optimization hint for the derived class to check * if we may have some attachments. */ @Override protected boolean hasAttachments() { return !getAttachments().isEmpty(); }
private Data dereferenceAttachments(String cidRef) throws URIReferenceException{ AttachmentSet attachments = securityContext.getAttachmentSet(); if(attachments == null || attachments.isEmpty()){ throw new URIReferenceException ("Attachment Resource with Identifier "+cidRef+" was not found"); } Attachment attachment = attachments.get(cidRef); AttachmentData attachData = new AttachmentData(attachment); return attachData; }
@Override public String addSwaRefAttachment(DataHandler data) { String cid = encodeCid(null); Attachment att = new DataHandlerAttachment(cid, data); attachments.add(att); cid = "cid:" + cid; return cid; }
public Attachment getAttachment(String uri) { Attachment attachment = null; if (uri.startsWith("cid:")) { uri = uri.substring("cid:".length()); attachment = attachments.get(uri); } return attachment; }
@Override public String addSwaRefAttachment(DataHandler data) { String cid = encodeCid(null); Attachment att = new DataHandlerAttachment(cid, data); attachments.add(att); cid = "cid:" + cid; return cid; }
@Override public byte[] getAttachmentAsByteArray(String cid) { Attachment a = attachments.get(stripScheme(cid)); if(a==null) throw new WebServiceException(EncodingMessages.NO_SUCH_CONTENT_ID(cid)); return a.asByteArray(); }
void callHandlersOnResponse(MessageUpdatableContext context, boolean handleFault) { //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); AttachmentSet attSet = context.packet.getMessage().getAttachments(); for (Map.Entry<String, DataHandler> entry : atts.entrySet()) { String cid = entry.getKey(); if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice Attachment att = new DataHandlerAttachment(cid, atts.get(cid)); attSet.add(att); } } try { //SERVER-SIDE processor.callHandlersResponse(HandlerProcessor.Direction.OUTBOUND, context, handleFault); } catch (WebServiceException wse) { //no rewrapping throw wse; } catch (RuntimeException re) { throw re; } }
/** * Optimization hint for the derived class to check * if we may have some attachments. */ @Override protected boolean hasAttachments() { return !getAttachments().isEmpty(); }
@Override public String addSwaRefAttachment(DataHandler data) { String cid = encodeCid(null); Attachment att = new DataHandlerAttachment(cid, data); attachments.add(att); cid = "cid:" + cid; return cid; }
@Override public DataHandler getAttachmentAsDataHandler(String cid) { Attachment a = attachments.get(stripScheme(cid)); if(a==null) throw new WebServiceException(EncodingMessages.NO_SUCH_CONTENT_ID(cid)); return a.asDataHandler(); }
void callHandlersOnResponse(MessageUpdatableContext context, boolean handleFault) { //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); AttachmentSet attSet = context.packet.getMessage().getAttachments(); for (Entry<String, DataHandler> entry : atts.entrySet()) { String cid = entry.getKey(); if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice Attachment att = new DataHandlerAttachment(cid, atts.get(cid)); attSet.add(att); } } try { //SERVER-SIDE processor.callHandlersResponse(HandlerProcessor.Direction.OUTBOUND, context, handleFault); } catch (WebServiceException wse) { //no rewrapping throw wse; } catch (RuntimeException re) { throw re; } }
/** * Optimization hint for the derived class to check * if we may have some attachments. */ @Override protected boolean hasAttachments() { return !getAttachments().isEmpty(); }
void fillIn(Object[] methodArgs, Message msg) { String contentId = getContentId(); Object obj = getter.get(methodArgs[methodPos]); DataHandler dh = (obj instanceof DataHandler) ? (DataHandler)obj : new DataHandler(obj,mimeType); Attachment att = new DataHandlerAttachment(contentId, dh); msg.getAttachments().add(att); } }
@Override public byte[] getAttachmentAsByteArray(String cid) { Attachment a = attachments.get(stripScheme(cid)); if(a==null) throw new WebServiceException(EncodingMessages.NO_SUCH_CONTENT_ID(cid)); return a.asByteArray(); }
void callHandlersOnResponse(MessageUpdatableContext context, boolean handleFault) { //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); AttachmentSet attSet = context.packet.getMessage().getAttachments(); for (Map.Entry<String, DataHandler> entry : atts.entrySet()) { String cid = entry.getKey(); if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice Attachment att = new DataHandlerAttachment(cid, atts.get(cid)); attSet.add(att); } } try { //SERVER-SIDE processor.callHandlersResponse(HandlerProcessor.Direction.OUTBOUND, context, handleFault); } catch (WebServiceException wse) { //no rewrapping throw wse; } catch (RuntimeException re) { throw re; } }
public void fillIn(Object[] methodArgs, Object returnValue, Message msg) { String contentId = getContentId(); Object obj = (methodPos == -1) ? returnValue : getter.get(methodArgs[methodPos]); DataHandler dh = (obj instanceof DataHandler) ? (DataHandler)obj : new DataHandler(obj,mimeType); Attachment att = new DataHandlerAttachment(contentId, dh); msg.getAttachments().add(att); } }
@Override public DataHandler getAttachmentAsDataHandler(String cid) { Attachment a = attachments.get(stripScheme(cid)); if(a==null) throw new WebServiceException(EncodingMessages.NO_SUCH_CONTENT_ID(cid)); return a.asDataHandler(); }
void callHandlersOnResponse(MessageUpdatableContext context, boolean handleFault) { //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); AttachmentSet attSet = context.packet.getMessage().getAttachments(); for (Entry<String, DataHandler> entry : atts.entrySet()) { String cid = entry.getKey(); if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice Attachment att = new DataHandlerAttachment(cid, atts.get(cid)); attSet.add(att); } } try { //SERVER-SIDE processor.callHandlersResponse(HandlerProcessor.Direction.OUTBOUND, context, handleFault); } catch (WebServiceException wse) { //no rewrapping throw wse; } catch (RuntimeException re) { throw re; } }