[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12829675#action_12829675
 ] 

Peter Klotz commented on HTTPCLIENT-317:
----------------------------------------

OK, I fixed the problem with a new sub-class for FormBodyPart that adds the 
Content-ID header called SOAPBodyPart
I only would need someone to commit this, as one cannot use MinimalField 
outside the httpcomponent package, for whatever reason.

---
package org.apache.http.entity.mime;

import org.apache.http.annotation.NotThreadSafe;

import org.apache.http.entity.mime.content.ContentBody;
import org.apache.james.mime4j.descriptor.ContentDescriptor;

/**
 * An extension of the mime4j standard {...@link BodyPart} class that 
 * automatically populates the header with standard fields based 
 * on the content description of the enclosed body.
 * 
 *
 * @since 4.0
 */
@NotThreadSafe // Entity is @NotThreadSafe
public class SOAPBodyPart extends FormBodyPart {

    public SOAPBodyPart(final String name, final ContentBody body) {
        super(name, body);

        generateContentID(body);
    }
    
  protected void generateContentID(final ContentDescriptor desc) 
  {
    StringBuilder buf = new StringBuilder();
    buf.append("<").append(getName()).append(">");
    getHeader().addField(new MinimalField("Content-ID", buf.toString()));
  }
}


> HTTP Client doesn't support multipart/related content-type
> ----------------------------------------------------------
>
>                 Key: HTTPCLIENT-317
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-317
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpMime
>    Affects Versions: 2.0 Final
>         Environment: Operating System: Windows XP
> Platform: PC
>            Reporter: peter
>            Priority: Minor
>             Fix For: 4.0 Beta 2
>
>
> It is not possible to sent data easely as a multipart/related content-type 
> (as 
> discribed in rfc 2387) using Http Client.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to