// Set up the event pipeline factory.
bootstrap.setPipelineFactory(new HttpUploadClientPipelineFactory(ssl));
// setup the factory: here using a mixed memory/disk based on size threshold
HttpDataFactory factory = new DefaultHttpDataFactory(
DefaultHttpDataFactory.MINSIZE); // Disk if size exceed MINSIZE
DiskFileUpload.deleteOnExitTemporaryFile = true; // should delete file on exit (in normal exit)
DiskFileUpload.baseDirectory = null; // system temp directory
DiskAttribute.deleteOnExitTemporaryFile = true; // should delete file on exit (in normal exit)
DiskAttribute.baseDirectory = null; // system temp directory
// Simple Get form: no factory used (not usable)
List<Entry<String, String>> headers =
formget(bootstrap, host, port, get, uriSimple);
if (headers == null) {
factory.cleanAllHttpDatas();
return;
}
// Simple Post form: factory used for big attributes
List<InterfaceHttpData> bodylist =
formpost(bootstrap, host, port, uriSimple, file, factory, headers);
if (bodylist == null) {
factory.cleanAllHttpDatas();
return;
}
// Multipart Post form: factory used
formpostmultipart(bootstrap, host, port, uriFile, factory, headers, bodylist);
// Shut down executor threads to exit.
bootstrap.releaseExternalResources();
// Really clean all temporary files if they still exist
factory.cleanAllHttpDatas();
}