bootstrap.releaseExternalResources();
return;
}
// Prepare the HTTP request.
HttpRequest request = new DefaultHttpRequest(
HttpVersion.HTTP_1_1, HttpMethod.POST, uriFile.toASCIIString());
// Use the PostBody encoder
HttpPostRequestEncoder bodyRequestEncoder = null;
try {
bodyRequestEncoder = new HttpPostRequestEncoder(factory,
request, true); // true => multipart
} catch (NullPointerException e) {
// should not be since no null args
e.printStackTrace();
} catch (ErrorDataEncoderException e) {
// test if method is a POST method
e.printStackTrace();
}
// it is legal to add directly header or cookie into the request until finalize
for (Entry<String, String> entry : headers) {
request.setHeader(entry.getKey(), entry.getValue());
}
// add Form attribute from previous request in formpost()
try {
bodyRequestEncoder.setBodyHttpDatas(bodylist);