bodyHeaders.putSingle("Content-Type", bodyMediaType.toString()); if (bodyHeaders.getFirst("Content-Disposition") == null && bodyPart.getContentDisposition() != null) { bodyHeaders.putSingle("Content-Disposition", bodyPart.getContentDisposition().toString());
bodyPart.getContentDisposition(); } catch (final IllegalArgumentException ex) { throw new BadRequestException(ex);
@POST @Consumes(MediaType.MULTIPART_FORM_DATA) public void uploadMultiple(@FormDataParam("file") FormDataBodyPart body){ for(BodyPart part : body.getParent().getBodyParts()){ InputStream is = part.getEntityAs(InputStream.class); ContentDisposition meta = part.getContentDisposition(); doUpload(is, meta); } }
private boolean fileHasCSVExtension(BodyPart bodyPart) { ContentDisposition contentDisposition = bodyPart.getContentDisposition(); return contentDisposition != null && contentDisposition.getFileName() != null && contentDisposition .getFileName().endsWith(".csv"); }
@POST @Path("upload") @Produces(MediaType.TEXT_PLAIN) @Consumes(MediaType.MULTIPART_FORM_DATA) public String uploadMultipleFile( FormDataMultiPart multiform) { BodyPartEntity bodyPartEntity; String uploadedFileLocation; for(BodyPart part: multiform.getBodyParts()){ bodyPartEntity = (BodyPartEntity) part.getEntity(); uploadedFileLocation = "c://test/" + part.getContentDisposition().getFileName(); saveToFile(bodyPartEntity.getInputStream(), uploadedFileLocation); } return "OK"; }
bodyHeaders.putSingle("Content-Type", bodyMediaType.toString()); if (bodyHeaders.getFirst("Content-Disposition") == null && bodyPart.getContentDisposition() != null) { bodyHeaders.putSingle("Content-Disposition", bodyPart.getContentDisposition().toString());
bodyHeaders.putSingle("Content-Type", bodyMediaType.toString()); if (bodyHeaders.getFirst("Content-Disposition") == null && bodyPart.getContentDisposition() != null) { bodyHeaders.putSingle("Content-Disposition", bodyPart.getContentDisposition().toString());
bodyHeaders.putSingle("Content-Type", bodyMediaType.toString()); if (bodyHeaders.getFirst("Content-Disposition") == null && bodyPart.getContentDisposition() != null) { bodyHeaders.putSingle("Content-Disposition", bodyPart.getContentDisposition().toString());
bodyHeaders.putSingle("Content-Type", bodyMediaType.toString()); if (bodyHeaders.getFirst("Content-Disposition") == null && bodyPart.getContentDisposition() != null) { bodyHeaders.putSingle("Content-Disposition", bodyPart.getContentDisposition().toString());
bodyPart.getContentDisposition(); } catch (IllegalArgumentException ex) { logger.error( "readFrom error", ex );
bodyPart.getContentDisposition(); } catch (final IllegalArgumentException ex) { throw new BadRequestException(ex);
bodyPart.getContentDisposition(); } catch (final IllegalArgumentException ex) { throw new BadRequestException(ex);
bodyPart.getContentDisposition(); } catch (final IllegalArgumentException ex) { throw new BadRequestException(ex);
bodyPart.getContentDisposition(); } catch (final IllegalArgumentException ex) { throw new BadRequestException(ex);