}
public List<FileMessage> attachFiles(Long id, Map<File, String> files,
String fieldName, boolean attach) throws HttpResponseException,
MimeTypeException, IOException {
URLBuilder builder = new URLBuilder(getDc().getHostname());
builder.add(getDc().getEndpoint());
builder.add(getAlias());
builder.add(id);
builder.add("attach_file");
MultipartEntity entity = EntityUtils.getMultipartEntity(files);
entity.addPart("field_name", new StringBody(fieldName));
entity.addPart("attach", new StringBody((attach ? "1" : "0")));
HttpPost method = new HttpPost(builder.toURI());
method.setEntity(entity);
ResponseHandler<String> handler = new BasicResponseHandler();
String response = getDc().getHttpClient().execute(method, handler);