List of usage examples for org.apache.commons.httpclient.methods.multipart FilePart DEFAULT_CHARSET
String DEFAULT_CHARSET
To view the source code for org.apache.commons.httpclient.methods.multipart FilePart DEFAULT_CHARSET.
Click Source Link
From source file:com.tribune.uiautomation.testscripts.Photo.java
private void setParameters(EntityEnclosingMethod method, String newNamespace, String newSlug) throws FileNotFoundException { StringPart namespacePart = newNamespace == null ? new StringPart(NAMESPACE_PARAM, namespace) : new StringPart(NAMESPACE_PARAM, newNamespace); StringPart slugPart = newSlug == null ? new StringPart(SLUG_PARAM, slug) : new StringPart(SLUG_PARAM, newSlug); // next two lines annoying work around for this bug: // https://github.com/rack/rack/issues/186 namespacePart.setContentType(null);//from ww w. ja v a 2s. c om slugPart.setContentType(null); if (file != null) { File f = new File(file); Part[] parts = { namespacePart, slugPart, new FilePart(FILE_PARAM, f, IMAGE_CONTENT_TYPE, FilePart.DEFAULT_CHARSET) }; method.setRequestEntity(new MultipartRequestEntity(parts, method.getParams())); } else { Part[] parts = { namespacePart, slugPart }; method.setRequestEntity(new MultipartRequestEntity(parts, method.getParams())); } }