[ 
https://issues.apache.org/jira/browse/CAMEL-10492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15701561#comment-15701561
 ] 

Fabrizio Spataro commented on CAMEL-10492:
------------------------------------------

I have found a bug into this code. 

I am trying to fix it!

{code:java}

final class AttachmentHttpBinding extends DefaultHttpBinding {
..................
protected void populateAttachments(HttpServletRequest request, HttpMessage 
message) {
        try {
            Collection<Part> parts = request.getParts();
            for (Part part : parts) {
                DataSource ds = new PartDataSource(part);
                Attachment attachment = new DefaultAttachment(ds);
                for (String headerName : part.getHeaderNames()) {
                    for (String headerValue : part.getHeaders(headerName)) {
                        attachment.addHeader(headerName, headerValue);
                    }
                }
                message.addAttachmentObject(part.getName(), attachment);
            }
        } catch (Exception e) {
            throw new RuntimeCamelException("Cannot populate attachments", e);
        }
    }
...............
}
{code}

> Camel Servlet, attachment object is empty
> -----------------------------------------
>
>                 Key: CAMEL-10492
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10492
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-http-common, camel-servlet
>    Affects Versions: 2.18.0
>            Reporter: Fabrizio Spataro
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: Future
>
>         Attachments: camel-example-servlet-attachment.zip
>
>
> I send a multipart form data to my camel servlet, before camel 2.18 
> attachment object is ok now is empty!
> Now i have an *header* every form field but every field is java.lang.String
> So, I can not post any binary file.
> This is my web.xml filter
> {code:xml}
>       <filter>
>               <filter-name>MultipartFilter</filter-name>
>               
> <filter-class>org.eclipse.jetty.servlets.MultiPartFilter</filter-class>
>       </filter>
>       <filter-mapping>
>               <filter-name>MultipartFilter</filter-name>
>               <servlet-name>CamelServlet</servlet-name>
>       </filter-mapping>
> {code}
> Into zip file, you can found an example.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to