Java Code Examples for com.sun.xml.internal.ws.api.message.Attachment

The following examples show how to use com.sun.xml.internal.ws.api.message.Attachment. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: ServerSOAPHandlerTube.java    License: GNU General Public License v2.0 6 votes vote down vote up
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;

        }
    }
 
Example #2
Source Project: jdk8u60   Author: chenghanpeng   File: EndpointMessageContextImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
@SuppressWarnings("element-type-mismatch")
public Object get(Object key) {
    if (packet.supports(key)) {
        return packet.get(key);    // strongly typed
    }
    if (packet.getHandlerScopePropertyNames(true).contains(key)) {
        return null;            // no such application-scope property
    }
    Object value =  packet.invocationProperties.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<String, DataHandler>();
        AttachmentSet attSet = packet.getMessage().getAttachments();
        for(Attachment att : attSet){
            atts.put(att.getContentId(), att.asDataHandler());
        }
        return atts;
    }
    return value;
}
 
Example #3
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: ServerSOAPHandlerTube.java    License: GNU General Public License v2.0 6 votes vote down vote up
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;

        }
    }
 
Example #4
Source Project: openjdk-8   Author: bpupadhyaya   File: MimeMultipartParser.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses the entire stream and returns all MIME parts except root MIME part.
 *
 * @return Map<String, StreamAttachment> for all attachment parts
 */
public @NotNull Map<String, Attachment> getAttachmentParts() {
    if (!gotAll) {
        MIMEPart rootPart = (start != null) ? message.getPart(start) : message.getPart(0);
        List<MIMEPart> parts = message.getAttachments();
        for(MIMEPart part : parts) {
            if (part != rootPart) {
                String cid = part.getContentId();
                if (!attachments.containsKey(cid)) {
                    PartAttachment attach = new PartAttachment(part);
                    attachments.put(attach.getContentId(), attach);
                }
            }
        }
        gotAll = true;
    }
    return attachments;
}
 
Example #5
Source Project: hottub   Author: dsrg-uoft   File: MimeAttachmentSet.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Nullable
public Attachment get(String contentId) {
    Attachment att;
    /**
     * First try to get the Attachment from internal map, maybe this attachment
     * is added by the user.
     */
    att = atts.get(contentId);
    if(att != null)
        return att;
    try {
        /**
         * Attachment is not found in the internal map, now do look in
         * the mpp, if found add to the internal Attachment map.
         */
        att = mpp.getAttachmentPart(contentId);
        if(att != null){
            atts.put(contentId, att);
        }
    } catch (IOException e) {
        throw new WebServiceException(EncodingMessages.NO_SUCH_CONTENT_ID(contentId), e);
    }
    return att;
}
 
Example #6
Source Project: jdk8u60   Author: chenghanpeng   File: ResponseContext.java    License: GNU General Public License v2.0 6 votes vote down vote up
public Object get(Object key) {
    if(packet.supports(key))
        return packet.get(key);    // strongly typed

    if(packet.getHandlerScopePropertyNames(true).contains(key))
        return null;            // no such application-scope property

    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<String, DataHandler>();
        AttachmentSet attSet = packet.getMessage().getAttachments();
        for(Attachment att : attSet){
            atts.put(att.getContentId(), att.asDataHandler());
        }
        return atts;
    }
    return value;
}
 
Example #7
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: EndpointArgumentsBuilder.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void readRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
    boolean foundAttachment = false;
    // TODO not to loop
    for (Attachment att : msg.getAttachments()) {
        String part = getWSDLPartName(att);
        if (part == null) {
            continue;
        }
        if(part.equals(pname) || part.equals(pname1)){
            foundAttachment = true;
            mapAttachment(att, args);
            break;
        }
    }
    if (!foundAttachment) {
        throw new WebServiceException("Missing Attachment for "+pname);
    }
}
 
Example #8
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: ServerMessageHandlerTube.java    License: GNU General Public License v2.0 6 votes vote down vote up
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;

    }
}
 
Example #9
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: ServerMessageHandlerTube.java    License: GNU General Public License v2.0 6 votes vote down vote up
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;

    }
}
 
Example #10
Source Project: openjdk-8   Author: bpupadhyaya   File: MtomCodec.java    License: GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("resource")
private void writeNonMtomAttachments(AttachmentSet attachments,
        OutputStream out, String boundary) throws IOException {

    for (Attachment att : attachments) {

        DataHandler dh = att.asDataHandler();
        if (dh instanceof StreamingDataHandler) {
            StreamingDataHandler sdh = (StreamingDataHandler) dh;
            // If DataHandler has href Content-ID, it is MTOM, so skip.
            if (sdh.getHrefCid() != null)
                continue;
        }

        // build attachment frame
        writeln("--" + boundary, out);
        writeMimeHeaders(att.getContentType(), att.getContentId(), out);
        att.writeTo(out);
        writeln(out); // write \r\n
    }
}
 
Example #11
Source Project: jdk8u60   Author: chenghanpeng   File: MimeAttachmentSet.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Nullable
public Attachment get(String contentId) {
    Attachment att;
    /**
     * First try to get the Attachment from internal map, maybe this attachment
     * is added by the user.
     */
    att = atts.get(contentId);
    if(att != null)
        return att;
    try {
        /**
         * Attachment is not found in the internal map, now do look in
         * the mpp, if found add to the internal Attachment map.
         */
        att = mpp.getAttachmentPart(contentId);
        if(att != null){
            atts.put(contentId, att);
        }
    } catch (IOException e) {
        throw new WebServiceException(EncodingMessages.NO_SUCH_CONTENT_ID(contentId), e);
    }
    return att;
}
 
Example #12
Source Project: jdk8u60   Author: chenghanpeng   File: ServerSOAPHandlerTube.java    License: GNU General Public License v2.0 6 votes vote down vote up
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;

        }
    }
 
Example #13
Source Project: openjdk-8-source   Author: keerath   File: MimeAttachmentSet.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Nullable
public Attachment get(String contentId) {
    Attachment att;
    /**
     * First try to get the Attachment from internal map, maybe this attachment
     * is added by the user.
     */
    att = atts.get(contentId);
    if(att != null)
        return att;
    try {
        /**
         * Attachment is not found in the internal map, now do look in
         * the mpp, if found add to the internal Attachment map.
         */
        att = mpp.getAttachmentPart(contentId);
        if(att != null){
            atts.put(contentId, att);
        }
    } catch (IOException e) {
        throw new WebServiceException(EncodingMessages.NO_SUCH_CONTENT_ID(contentId), e);
    }
    return att;
}
 
Example #14
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: AttachmentMarshallerImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public String addSwaRefAttachment(DataHandler data) {
    String cid = encodeCid(null);
    Attachment att = new DataHandlerAttachment(cid, data);
    attachments.add(att);
    cid = "cid:" + cid;
    return cid;
}
 
Example #15
Source Project: hottub   Author: dsrg-uoft   File: SwACodec.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
    // TODO: handle attachments correctly
    Attachment root = mpp.getRootPart();
    Codec rootCodec = getMimeRootCodec(packet);
    if (rootCodec instanceof RootOnlyCodec) {
        ((RootOnlyCodec)rootCodec).decode(root.asInputStream(),root.getContentType(),packet, new MimeAttachmentSet(mpp));
    } else {
        rootCodec.decode(root.asInputStream(),root.getContentType(),packet);
        Map<String, Attachment> atts = mpp.getAttachmentParts();
        for(Map.Entry<String, Attachment> att : atts.entrySet()) {
            packet.getMessage().getAttachments().add(att.getValue());
        }
    }
}
 
Example #16
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: MimeCodec.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void writeCustomMimeHeaders(Attachment att, OutputStream out) throws IOException {
    if (att instanceof AttachmentEx) {
        Iterator<AttachmentEx.MimeHeader> allMimeHeaders = ((AttachmentEx) att).getMimeHeaders();
        while (allMimeHeaders.hasNext()) {
            AttachmentEx.MimeHeader mh = allMimeHeaders.next();
            String name = mh.getName();

            if (!"Content-Type".equalsIgnoreCase(name) && !"Content-Id".equalsIgnoreCase(name)) {
                writeln(name +": " + mh.getValue(), out);
            }
        }
    }
}
 
Example #17
Source Project: TencentKona-8   Author: Tencent   File: MimeAttachmentSet.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Expensive operation.
 */
public Iterator<Attachment> iterator() {
    /**
     * Browse thru all the attachments in the mpp, add them to #atts,
     * then return whether its empty.
     */
    Map<String, Attachment> attachments = mpp.getAttachmentParts();
    for(Map.Entry<String, Attachment> att : attachments.entrySet()) {
        if(atts.get(att.getKey()) == null){
            atts.put(att.getKey(), att.getValue());
        }
    }

    return atts.values().iterator();
}
 
Example #18
Source Project: hottub   Author: dsrg-uoft   File: MimeMultipartParser.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method can be called to get a matching MIME attachment part for the
 * given contentId. It parses the stream until it finds a matching part.
 *
 * @return StreamAttachment attachment for contentId
 *         null if there is no attachment for contentId
 */
public @Nullable Attachment getAttachmentPart(String contentId) throws IOException {
    //first see if this attachment is already parsed, if so return it
    Attachment attach = attachments.get(contentId);
    if (attach == null) {
        MIMEPart part = message.getPart(contentId);
        attach = new PartAttachment(part);
        attachments.put(contentId, attach);
    }
    return attach;
}
 
Example #19
Source Project: openjdk-8   Author: bpupadhyaya   File: AttachmentUnmarshallerImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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();
}
 
Example #20
Source Project: TencentKona-8   Author: Tencent   File: ResponseBuilder.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object readResponse(Message msg, Object[] args) throws JAXBException, XMLStreamException {
    // TODO not to loop
    for (Attachment att : msg.getAttachments()) {
        String part = getWSDLPartName(att);
        if (part == null) {
            continue;
        }
        if(part.equals(pname) || part.equals(pname1)){
            return mapAttachment(att, args);
        }
    }
    return null;
}
 
Example #21
Source Project: openjdk-8   Author: bpupadhyaya   File: MessageFiller.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #22
Source Project: jdk8u60   Author: chenghanpeng   File: MimeCodec.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void writeCustomMimeHeaders(Attachment att, OutputStream out) throws IOException {
    if (att instanceof AttachmentEx) {
        Iterator<AttachmentEx.MimeHeader> allMimeHeaders = ((AttachmentEx) att).getMimeHeaders();
        while (allMimeHeaders.hasNext()) {
            AttachmentEx.MimeHeader mh = allMimeHeaders.next();
            String name = mh.getName();

            if (!"Content-Type".equalsIgnoreCase(name) && !"Content-Id".equalsIgnoreCase(name)) {
                writeln(name +": " + mh.getValue(), out);
            }
        }
    }
}
 
Example #23
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: MessageFiller.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void fillIn(Object[] methodArgs, Object returnValue, Message msg) {
    String contentId = getContentId();
    Object obj = (methodPos == -1) ? returnValue : getter.get(methodArgs[methodPos]);
    if (obj != null) {
        Attachment att = new ByteArrayAttachment(contentId,(byte[])obj,mimeType);
        msg.getAttachments().add(att);
    }
}
 
Example #24
Source Project: TencentKona-8   Author: Tencent   File: MessageFiller.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #25
Source Project: openjdk-8   Author: bpupadhyaya   File: MessageContextImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
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<String, DataHandler>();
        AttachmentSet attSet = packet.getMessage().getAttachments();
        for(Attachment att : attSet){
            String cid = att.getContentId();
            if (cid.indexOf("@jaxws.sun.com") == -1) {
                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;
}
 
Example #26
Source Project: openjdk-8-source   Author: keerath   File: MtomCodec.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public int next() throws XMLStreamException {
    int event = reader.next();
    if (event == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals(XOP_LOCALNAME) && reader.getNamespaceURI().equals(XOP_NAMESPACEURI)) {
        //its xop reference, take the URI reference
        String href = reader.getAttributeValue(null, "href");
        try {
            xopHref = href;
            Attachment att = getAttachment(href);
            if(att != null){
                DataHandler dh = att.asDataHandler();
                if (dh instanceof StreamingDataHandler) {
                    ((StreamingDataHandler)dh).setHrefCid(att.getContentId());
                }
                base64AttData = new Base64Data();
                base64AttData.set(dh);
            }
            xopReferencePresent = true;
        } catch (IOException e) {
            throw new WebServiceException(e);
        }
        //move to the </xop:Include>
        XMLStreamReaderUtil.nextElementContent(reader);
        return XMLStreamConstants.CHARACTERS;
    }
    if(xopReferencePresent){
        xopReferencePresent = false;
        base64EncodedText = null;
        xopHref = null;
    }
    return event;
}
 
Example #27
Source Project: TencentKona-8   Author: Tencent   File: DispatchImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected AttachmentSet setOutboundAttachments() {
    HashMap<String, DataHandler> attachments = (HashMap<String, DataHandler>)
            getRequestContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);

    if (attachments != null) {
        List<Attachment> alist = new ArrayList();
        for (Map.Entry<String, DataHandler> att : attachments.entrySet()) {
            DataHandlerAttachment dha = new DataHandlerAttachment(att.getKey(), att.getValue());
            alist.add(dha);
        }
        return new AttachmentSetImpl(alist);
    }
    return new AttachmentSetImpl();
}
 
Example #28
Source Project: openjdk-8-source   Author: keerath   File: MtomCodec.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Attachment getAttachment(String cid) throws IOException {
    if (cid.startsWith("cid:"))
        cid = cid.substring(4, cid.length());
    if (cid.indexOf('%') != -1) {
        cid = decodeCid(cid);
        return mimeMP.getAttachmentPart(cid);
    }
    return mimeMP.getAttachmentPart(cid);
}
 
Example #29
Source Project: TencentKona-8   Author: Tencent   File: MessageFiller.java    License: GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #30
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: MessageContextImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
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<String, DataHandler>();
        AttachmentSet attSet = packet.getMessage().getAttachments();
        for(Attachment att : attSet){
            String cid = att.getContentId();
            if (cid.indexOf("@jaxws.sun.com") == -1) {
                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;
}