You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Jinhua Wang (JIRA)" <ji...@apache.org> on 2012/10/16 05:43:02 UTC

[jira] [Created] (CXF-4570) Attachment Header Content-ID conversion

Jinhua Wang created CXF-4570:
--------------------------------

             Summary: 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

[jira] [Commented] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Aki Yoshida (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477752#comment-13477752 ] 

Aki Yoshida commented on CXF-4570:
----------------------------------

org.apache.cxf.attachment.AttachmentDeserializerTest's testDeserializerSwA uses this create attachment method and this is not getting any issue (only the bracketed id is placed in the headers and when this message is reserialized, you see only the bracketed content id). So, I don't know why you are getting the unbracketed one. So, I am not sure if AttachmentUtil itself really has some issue.

                
> 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

[jira] [Updated] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp updated CXF-4570:
-----------------------------

    Fix Version/s: 2.5.7
    
> 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
>            Assignee: Daniel Kulp
>             Fix For: 2.5.7, 2.6.4, 2.7.1
>
>         Attachments: 04.png, 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

[jira] [Resolved] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang resolved CXF-4570.
-------------------------------

    Resolution: Won't Fix
    
> 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

[jira] [Reopened] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang reopened CXF-4570:
------------------------------


Hello
If keep the exact headers, we will get two header named "Content-ID" with different values.
For example, the message contains "Content-ID:<foo>"
headers in jdk Attachment object is
{code}
Content-ID:foo
Content-ID:<foo>
{code}

It is caused by the following code:
method: *org.apache.cxf.binding.soap.saaj.SAAJInInterceptor.handleMessage(SoapMessage)*
{code}
AttachmentPart ap = soapMessage.createAttachmentPart(a.getDataHandler());
ap.setContentId(a.getId());	// 1. jdk invoke setMimeHeader("Content-ID", paramString);
Iterator<String> i = a.getHeaderNames();
while (i != null && i.hasNext()) {
	String h = i.next();
	String val = a.getHeader(h);
	ap.addMimeHeader(h, val);	// 2. jdk invoke headers.addHeader(paramString1, paramString2);
}
soapMessage.addAttachmentPart(ap);
{code}
"*ap.setContentId(a.getId())*" set "Content-ID" header with "foo".
"*ap.addMimeHeader(h, val)*"  add "Content-ID" header with "<foo>"

It is confused to get headers with the same header name but different header values.
I think there is somtehing wrong in *create attachment for cxf* or *copy header to jdk attachment*.

                
> 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

[jira] [Commented] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
    [ 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

[jira] [Commented] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477479#comment-13477479 ] 

Freeman Fang commented on CXF-4570:
-----------------------------------

OK, as this behavior is from spec, we need keep it as is.

                
> 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

[jira] [Commented] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477209#comment-13477209 ] 

Daniel Kulp commented on CXF-4570:
----------------------------------



Personally, I'm against this change.   Per various specs (such as SAAJ), the Headers map for the attachment should be the exact headers that are passing in the mime part on the wire.  
                
> 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

[jira] [Updated] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4570:
-----------------------------

    Attachment: AttachmentUtil.java.patch
    
> 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

[jira] [Resolved] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-4570.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.7.1
                   2.6.4
         Assignee: Daniel Kulp


Cleaned up the SAAJIn/Out stuff a little to only call the setContentID if a getContentID call returns null after setting all the headers.   Thus, this should fix the double header issue.
                
> 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
>            Assignee: Daniel Kulp
>             Fix For: 2.6.4, 2.7.1
>
>         Attachments: 04.png, 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

[jira] [Commented] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477784#comment-13477784 ] 

Jinhua Wang commented on CXF-4570:
----------------------------------

There are two attachment implementation classes, one is from cxf framework and another if from jdk. "Content-ID" is stored in *id* field in cxf implementation. On the contrary "Content-ID" is stroed in "headers" in jdk implementation.
*org.apache.cxf.attachment.AttachmentImpl*(cxf framework)
{code}
private String id;
private Map<String, String> headers = new HashMap<String, String>();
{code}

*com.sun.xml.internal.messaging.saaj.soap.AttachmentPartImpl*
{code}
private final MimeHeaders headers;
public void setMimeHeader(String paramString1, String paramString2) {
    this.headers.setHeader(paramString1, paramString2);
  }

  public void addMimeHeader(String paramString1, String paramString2) {
    this.headers.addHeader(paramString1, paramString2);
  }
{code}
*javax.xml.soap.MimeHeaders*
{code}
private Vector headers;
{code}

When copying content from cxf attachment to jdk attachment, both "Content-ID" values are copied to *Vector headers*.


                
> 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

[jira] [Updated] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4570:
-----------------------------

    Attachment: 04.png

org.apache.cxf.attachment.AttachmentImpl instance when running test org.apache.cxf.attachment.AttachmentDeserializerTest.testDeserializerSwA()
                
> 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: 04.png, 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

[jira] [Comment Edited] (CXF-4570) Attachment Header Content-ID conversion

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477785#comment-13477785 ] 

Jinhua Wang edited comment on CXF-4570 at 10/17/12 11:10 AM:
-------------------------------------------------------------

Attachment *04.png* is for org.apache.cxf.attachment.AttachmentImpl instance when running test org.apache.cxf.attachment.AttachmentDeserializerTest.testDeserializerSwA()
                
      was (Author: ivywjhua):
    org.apache.cxf.attachment.AttachmentImpl instance when running test org.apache.cxf.attachment.AttachmentDeserializerTest.testDeserializerSwA()
                  
> 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: 04.png, 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