use of com.sun.xml.ws.api.message.AttachmentSet in project metro-jax-ws by eclipse-ee4j.
the class ServerMessageHandlerTube method callHandlersOnResponse.
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 (RuntimeException wse) {
// no rewrapping
throw wse;
}
}
use of com.sun.xml.ws.api.message.AttachmentSet in project metro-jax-ws by eclipse-ee4j.
the class MessageContextImpl method get.
public Object get(Object key) {
if (key == null)
return null;
Object value = asMapIncludingInvocationProperties.get(key);
// add the attachments from the Message to the corresponding attachment property
if (key.equals(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS) || key.equals(MessageContext.INBOUND_MESSAGE_ATTACHMENTS)) {
Map<String, DataHandler> atts = (Map<String, DataHandler>) value;
if (atts == null)
atts = new HashMap<>();
AttachmentSet attSet = packet.getMessage().getAttachments();
for (Attachment att : attSet) {
String cid = att.getContentId();
if (!cid.contains("@jaxws.sun.com")) {
Object a = atts.get(cid);
if (a == null) {
a = atts.get("<" + cid + ">");
if (a == null)
atts.put(att.getContentId(), att.asDataHandler());
}
} else {
atts.put(att.getContentId(), att.asDataHandler());
}
}
return atts;
}
return value;
}
use of com.sun.xml.ws.api.message.AttachmentSet in project metro-jax-ws by eclipse-ee4j.
the class ServerLogicalHandlerTube method callHandlersOnResponse.
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();
Attachment att = new DataHandlerAttachment(cid, atts.get(cid));
attSet.add(att);
}
try {
// SERVER-SIDE
processor.callHandlersResponse(HandlerProcessor.Direction.OUTBOUND, context, handleFault);
} catch (RuntimeException wse) {
// no rewrapping
throw wse;
}
}
use of com.sun.xml.ws.api.message.AttachmentSet in project metro-jax-ws by eclipse-ee4j.
the class ResponseContext method get.
public Object get(Object key) {
if (packet.supports(key))
// strongly typed
return packet.get(key);
if (packet.getHandlerScopePropertyNames(true).contains(key))
// no such application-scope property
return null;
Object value = packet.invocationProperties.get(key);
// add the attachments from the Message to the corresponding attachment property
if (key.equals(MessageContext.INBOUND_MESSAGE_ATTACHMENTS)) {
Map<String, DataHandler> atts = (Map<String, DataHandler>) value;
if (atts == null)
atts = new HashMap<>();
AttachmentSet attSet = packet.getMessage().getAttachments();
for (Attachment att : attSet) {
atts.put(att.getContentId(), att.asDataHandler());
}
return atts;
}
return value;
}
Aggregations