* java.util.HashMap)
*/
public void uploadFile(Endpoint authBean, File serverFile, FileServiceData dataSource, HashMap<String, String> params) throws CloneNotSupportedException {
String name = params.get("file");
if(StringUtil.isEmpty(name)){
throw new FacesExceptionEx(new NullPointerException(), "Name of file being uploaded may not be null");
}
int dot = name.lastIndexOf('.');
String ext = null;
if(dot > -1){
ext = name.substring(dot + 1); //add one for the dot!
}
if(StringUtil.isEmpty(ext)){
throw new FacesExceptionEx(new NullPointerException(), "Extension of file being uploaded may not be null");
}
try {
final String uploadUrl = "/files_put/dropbox/";
String path = dataSource.getCurrentDirectory();
if(StringUtil.isNotEmpty(path)){
name = ExtLibUtil.concatPath(path, name, '/');
}
name = ExtLibUtil.concatPath(uploadUrl, name, '/');
String uploadURL = getDropBoxApiVersion(authBean) + name;
DropboxService svc = (DropboxService)createClientService(authBean, uploadURL);
svc.setMimeForUpload(MIME.getMIMETypeFromExtension(ext));
svc.post(uploadURL, params, null, serverFile,null);
} catch (ClientServicesException e) {
throw new FacesExceptionEx(e);
}
}