1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
41 import javax.activation.DataHandler; |
41 import javax.activation.DataHandler; |
42 import javax.xml.ws.WebServiceException; |
42 import javax.xml.ws.WebServiceException; |
43 import javax.xml.ws.handler.MessageContext; |
43 import javax.xml.ws.handler.MessageContext; |
44 import javax.xml.ws.handler.Handler; |
44 import javax.xml.ws.handler.Handler; |
45 import java.util.*; |
45 import java.util.*; |
|
46 import java.util.Map.Entry; |
46 |
47 |
47 /** |
48 /** |
48 * @author Rama Pulavarthi |
49 * @author Rama Pulavarthi |
49 */ |
50 */ |
50 public class ServerMessageHandlerTube extends HandlerTube{ |
51 public class ServerMessageHandlerTube extends HandlerTube{ |
80 |
81 |
81 void callHandlersOnResponse(MessageUpdatableContext context, boolean handleFault) { |
82 void callHandlersOnResponse(MessageUpdatableContext context, boolean handleFault) { |
82 //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message |
83 //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message |
83 Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); |
84 Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); |
84 AttachmentSet attSet = context.packet.getMessage().getAttachments(); |
85 AttachmentSet attSet = context.packet.getMessage().getAttachments(); |
85 for(String cid : atts.keySet()){ |
86 for (Entry<String, DataHandler> entry : atts.entrySet()) { |
|
87 String cid = entry.getKey(); |
86 if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice |
88 if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice |
87 Attachment att = new DataHandlerAttachment(cid, atts.get(cid)); |
89 Attachment att = new DataHandlerAttachment(cid, atts.get(cid)); |
88 attSet.add(att); |
90 attSet.add(att); |
89 } |
91 } |
90 } |
92 } |