[
https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477654#comment-13477654
]
Jinhua Wang commented on CXF-4570:
----------------------------------
Snippet code for copying attachment from cxf to jdk simulation.
{code}
import java.util.Iterator;
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.MimeHeader;
import javax.xml.soap.SOAPMessage;
public class JDKAttachmentTest {
private static final String STR_CONTENT_ID = "Content-ID";
public static void main(String[] args) throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
AttachmentPart attachmentPart =
soapMessage.createAttachmentPart();
attachmentPart.setContentId("foo");
attachmentPart.addMimeHeader(STR_CONTENT_ID, "<foo>");
soapMessage.addAttachmentPart(attachmentPart);
Iterator<?> attIterator = soapMessage.getAttachments();
while(attIterator.hasNext()){
AttachmentPart att = (AttachmentPart)attIterator.next();
Iterator<?> headerIterator = att.getAllMimeHeaders();
while(headerIterator.hasNext()){
MimeHeader header =
(MimeHeader)headerIterator.next();
System.out.println(header.getName() + ":" +
header.getValue());
}
}
}
}
{code}
output:
{code}
Content-ID:foo
Content-ID:<foo>
{code}
> Attachment Header Content-ID conversion
> ---------------------------------------
>
> Key: CXF-4570
> URL: https://issues.apache.org/jira/browse/CXF-4570
> Project: CXF
> Issue Type: Bug
> Components: JAX-WS Runtime
> Reporter: Jinhua Wang
> Attachments: AttachmentUtil.java.patch
>
>
> I have a migrating problem for headers in attachment.
> For example, the message sent out contains Content-ID:<foo>,
> Content-ID header value is "<foo>" instead of "foo" at server side.
> When creating attachment of the following code:
> org.apache.cxf.attachment.AttachmentUtil.createAttachment(InputStream,
> InternetHeaders)
> There's a id conversion at first. But in the following header processing,
> there's no id conversion for Content-ID.
> Since Content-ID conversion is needed for id("new AttachmentImpl(id)"), I
> think it is also useful for headers.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira