Entity parent = multipart.getParent();
if (parent == null)
throw new IllegalArgumentException(
"Missing parent entity in multipart");
Header header = parent.getHeader();
if (header == null)
throw new IllegalArgumentException(
"Missing header in parent entity");
ContentTypeField contentType = (ContentTypeField) header
.getField(FieldName.CONTENT_TYPE);
if (contentType == null)
throw new IllegalArgumentException(
"Content-Type field not specified");