Java Code Examples for org.apache.http.entity.mime.FormBodyPart#getHeader()
The following examples show how to use
org.apache.http.entity.mime.FormBodyPart#getHeader() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultipartForm.java From iaf with Apache License 2.0 | 5 votes |
/** * Write the multipart header fields; depends on the style. */ protected void formatMultipartHeader( final FormBodyPart part, final OutputStream out) throws IOException { // For strict, we output all fields with MIME-standard encoding. final Header header = part.getHeader(); for (final MinimalField field: header) { writeField(field, out); } }
Example 2
Source File: MultipartEntityBuilder.java From iaf with Apache License 2.0 | 5 votes |
public MultipartEntityBuilder addPart(FormBodyPart bodyPart) { if (bodyPart == null) { return this; } if (this.bodyParts == null) { this.bodyParts = new ArrayList<FormBodyPart>(); } if(mtom) { Header header = bodyPart.getHeader(); String contentID; String fileName = bodyPart.getBody().getFilename(); header.removeFields("Content-Disposition"); if(fileName == null) { contentID = "<"+bodyPart.getName()+">"; } else { bodyPart.addField("Content-Disposition", "attachment; name=\""+bodyPart.getName()+"\"; filename=\""+fileName+"\""); contentID = "<"+fileName+">"; } bodyPart.addField("Content-ID", contentID); if(firstPart == null) firstPart = contentID; } this.bodyParts.add(bodyPart); return this; }