throw new IllegalArgumentException("No valid file 'null'!");
}
// Deploy need to be multipart
// file content must be posted as multipart/form-data
FileDataBodyPart filePart = new FileDataBodyPart("id", file);
FormDataMultiPart formpart = new FormDataMultiPart();
if (application != null) {
formpart = formpart.field("name", application);
}
if (contextroot != null) {
formpart = formpart.field("contextroot", contextroot);
}
if (description != null) {
formpart = formpart.field("description", description);
}
MultiPart multipart = formpart.field("force", "true")
.bodyPart(filePart);
return handleJsonResponse(managementResource.path("applications/application")
.request(MediaType.APPLICATION_JSON)
.post(Entity.entity(multipart, multipart.getMediaType()), Response.class));