You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Thomas Gschwind (JIRA)" <ji...@apache.org> on 2010/06/21 14:10:23 UTC

[jira] Issue Comment Edited: (CXF-2825) Multipart Header not Handled Correctly

    [ https://issues.apache.org/jira/browse/CXF-2825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12880795#action_12880795 ] 

Thomas Gschwind edited comment on CXF-2825 at 6/21/10 8:07 AM:
---------------------------------------------------------------

Hi Sergey!

I just ran into the same problem with 2.2.9.

> att.setHeader(key, handler.getHeader(key));
is necessary because otherwise the headers would not be copied over correctly from the handler into the newly created attachment.

Here is the old context:
AttachmentImpl att = new AttachmentImpl(handler.getContentId(), handler.getDataHandler());
for (String key : handler.getHeaders().keySet()) {
  att.setHeader(key, att.getHeader(key));
}

This would merely iterate over the keys of the headers of the handler (see the for statement) and create headers with these keys (att.setHeader) in the newly created attachment with the values also taken from the newly created attachment (att.getHeader).

Thanks for fixing,
Thomas


      was (Author: thg):
    Hi Sergey!

I just ran into the same problem with 2.2.9.

> att.setHeader(key, handler.getHeader(key));
is necessary because otherwise the headers would not be copied over correctly from the handler into the newly created attachment.

Here is the old context:
> AttachmentImpl att = new AttachmentImpl(handler.getContentId(), handler.getDataHandler());
> for (String key : handler.getHeaders().keySet()) {
>     att.setHeader(key, att.getHeader(key));
> }
This would merely iterate over the keys of the headers of the handler (see the for statement) and create headers with these keys (att.setHeader) in the newly created attachment with the values also taken from the newly created attachment (att.getHeader).

Thanks for fixing,
Thomas

  
> Multipart Header not Handled Correctly
> --------------------------------------
>
>                 Key: CXF-2825
>                 URL: https://issues.apache.org/jira/browse/CXF-2825
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.5
>         Environment: Redhat Enterprise Linux 5.3
> Apache Tomcat 5.5
> JDK 6.0
> Intel x86
>            Reporter: Loh Kok Jeng
>         Attachments: AttachmentImpl.patch, MessageContextImpl.patch
>
>
> Multipart attachment headers other than Content-ID, Content-Type, Content-Transfer-Encoding, are not handled correctly.  Often, the headers will be set to all lower case with null value.  E.g.: content-location: null.
> apache-cxf-2.2.5\rt\core\src\main\java\org\apache\cxf\attachment\AttachmentImpl.java
> 59c59,60
> <         headers.put(name.toLowerCase(), value);
> ---
> >         //headers.put(name.toLowerCase(), value);
> >         headers.put(name, value);
> apache-cxf-2.2.5\rt\frontend\jaxrs\src\main\java\org\apache\cxf\jaxrs\ext\MessageContextImpl.java
> 146,147c146,147
> <             Attachment handler = (Attachment)handlers.get(i);
> <             AttachmentImpl att = new AttachmentImpl(handler.getContentId(), handler.getDataHandler());
> ---
> >             Attachment handler = (Attachment)handlers.get(i);
> >             AttachmentImpl att = new AttachmentImpl(handler.getContentId(),  handler.getDataHandler());
> 148,149c149,150
> <                 att.setHeader(key, att.getHeader(key));
> ---
> >                 att.setHeader(key, handler.getHeader(key));

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.