@Override public Void call() throws Exception { final MultiPart multiPartInput = new MultiPart(); for (File file : myFiles) { FileDataBodyPart fileDataBodyPart = new FileDataBodyPart(FILE_ATTACHMENT_CONTROL_NAME, file); multiPartInput.bodyPart(fileDataBodyPart); } postFileMultiPart(multiPartInput, attachmentsUri); return null; }
MultivaluedMap<String, Object> headers, OutputStream stream) throws IOException, WebApplicationException { if ((entity.getBodyParts() == null) || (entity.getBodyParts().size() < 1)) { throw new WebApplicationException(new IllegalArgumentException("Must specify at least one body part")); if (entity.getParent() == null) { Object value = headers.getFirst("MIME-Version"); if (value == null) { for (final BodyPart bodyPart : entity.getBodyParts()) {
"Mismatch between mimetypes and input"); multiPart.setMediaType(new MediaType("multipart", "mixed")); multiPart = multiPart.bodyPart(bodyPart);
private ServiceResultIterator makeResults(RequestLogger reqlog, String operation, String entityType, ClientResponse response) { logRequest(reqlog, "%s for %s", operation, entityType); MultiPart entity = response.hasEntity() ? response.getEntity(MultiPart.class) : null; if (entity == null) return null; List<BodyPart> partList = entity.getBodyParts(); if (partList == null || partList.size() == 0) { response.close(); return null; } return new JerseyResultIterator(reqlog, response, partList); }
MultiPart multiPart = new MultiPart(); boolean hasStreamingPart = addParts(multiPart, reqlog, input);
private AtlasImportResult performImportData(BodyPart requestPart, BodyPart filePart) throws AtlasServiceException { MultiPart multipartEntity = new FormDataMultiPart() .bodyPart(requestPart) .bodyPart(filePart); return callAPI(IMPORT, AtlasImportResult.class, multipartEntity); }
final MultiPart multiPart = new FormDataMultiPart() .bodyPart(fileDataBodyPart); multiPart.setMediaType(MULTIPART_FORM_DATA_TYPE); ClientResponse response = webResource .queryParams(queryParams)
for (final BodyPart bodyPart : multiPart.getBodyParts()) {
MultiPart multiPart = new MultiPart(); boolean hasStreamingPart = addParts(multiPart, reqlog, input);
@Override public Void call() throws Exception { final MultiPart multiPartInput = new MultiPart(); for (File file : myFiles) { FileDataBodyPart fileDataBodyPart = new FileDataBodyPart(FILE_ATTACHMENT_CONTROL_NAME, file); multiPartInput.bodyPart(fileDataBodyPart); } postFileMultiPart(multiPartInput, attachmentsUri); return null; }
for (final BodyPart bodyPart : multiPart.getBodyParts()) {
MultiPart multiPart = new MultiPart(); boolean hasStreamingPart = addParts(multiPart, reqlog, input);
@Override public Void call() throws Exception { final MultiPart multiPartInput = new MultiPart(); for (AttachmentInput attachment : myAttachments) { BodyPart bp = new BodyPart(attachment.getInputStream(), MediaType.APPLICATION_OCTET_STREAM_TYPE); FormDataContentDisposition.FormDataContentDispositionBuilder dispositionBuilder = FormDataContentDisposition.name(FILE_ATTACHMENT_CONTROL_NAME); dispositionBuilder.fileName(attachment.getFilename()); final FormDataContentDisposition formDataContentDisposition = dispositionBuilder.build(); bp.setContentDisposition(formDataContentDisposition); multiPartInput.bodyPart(bp); } postFileMultiPart(multiPartInput, attachmentsUri); return null; }
return false; List<BodyPart> partList = entity.getBodyParts(); if (partList == null) return false;
MultiPart multiPart = new MultiPart(); boolean hasStreamingPart = addParts(multiPart, reqlog, new String[] { metadataMimetype, contentMimetype },
@Override public Void call() throws Exception { final MultiPart multiPartInput = new MultiPart(); for (AttachmentInput attachment : myAttachments) { BodyPart bp = new BodyPart(attachment.getInputStream(), MediaType.APPLICATION_OCTET_STREAM_TYPE); FormDataContentDisposition.FormDataContentDispositionBuilder dispositionBuilder = FormDataContentDisposition.name(FILE_ATTACHMENT_CONTROL_NAME); dispositionBuilder.fileName(attachment.getFilename()); final FormDataContentDisposition formDataContentDisposition = dispositionBuilder.build(); bp.setContentDisposition(formDataContentDisposition); multiPartInput.bodyPart(bp); } postFileMultiPart(multiPartInput, attachmentsUri); return null; }