/** * Sets the control name. * * @param name the control name. */ public void setName(String name) { if (name == null) { throw new IllegalArgumentException(LocalizationMessages.CONTROL_NAME_CANNOT_BE_NULL()); } if (getFormDataContentDisposition() == null) { FormDataContentDisposition contentDisposition; contentDisposition = FormDataContentDisposition.name(name).build(); super.setContentDisposition(contentDisposition); } else { FormDataContentDisposition formDataContentDisposition = FormDataContentDisposition.name(name) .fileName(contentDisposition.getFileName()) .creationDate(contentDisposition.getCreationDate()) .modificationDate(contentDisposition.getModificationDate()) .readDate(contentDisposition.getReadDate()) .size(contentDisposition.getSize()).build(); super.setContentDisposition(formDataContentDisposition); } }
private boolean fileHasCSVExtension(BodyPart bodyPart) { ContentDisposition contentDisposition = bodyPart.getContentDisposition(); return contentDisposition != null && contentDisposition.getFileName() != null && contentDisposition .getFileName().endsWith(".csv"); }
protected void replaceResourceBinaryWithStream(final FedoraBinary result, final InputStream requestBodyStream, final ContentDisposition contentDisposition, final MediaType contentType, final Collection<String> checksums, final String externalHandling, final String externalUrl) throws InvalidChecksumException { final Collection<URI> checksumURIs = checksums == null ? new HashSet<>() : checksums.stream().map(checksum -> checksumURI(checksum)).collect(Collectors.toSet()); final String originalFileName = contentDisposition != null ? contentDisposition.getFileName() : ""; final String originalContentType = contentType != null ? contentType.toString() : ""; if (externalHandling != null) { result.setExternalContent(originalContentType, checksumURIs, originalFileName, externalHandling, externalUrl); } else { result.setContent(requestBodyStream, originalContentType, checksumURIs, originalFileName, storagePolicyDecisionPoint); } }
if (StringUtils.isBlank(body.getContentDisposition().getFileName())) { return Response.status(400).entity("filename cannot be empty.").build(); baseUri == null ? dataSet.getMetadata().getBaseUri() : baseUri.toString(), defaultGraph == null ? dataSet.getMetadata().getBaseUri() : defaultGraph.toString(), body.getContentDisposition().getFileName(), rdfInputStream, Optional.of(Charset.forName(encoding)),
assertTrue("filename should end with .tds", contentDisposition.getFileName().endsWith(".tds"));
/** * Sets the control name. * * @param name the control name. */ public void setName(String name) { if (name == null) { throw new IllegalArgumentException(LocalizationMessages.CONTROL_NAME_CANNOT_BE_NULL()); } if (getFormDataContentDisposition() == null) { FormDataContentDisposition contentDisposition; contentDisposition = FormDataContentDisposition.name(name).build(); super.setContentDisposition(contentDisposition); } else { FormDataContentDisposition formDataContentDisposition = FormDataContentDisposition.name(name) .fileName(contentDisposition.getFileName()) .creationDate(contentDisposition.getCreationDate()) .modificationDate(contentDisposition.getModificationDate()) .readDate(contentDisposition.getReadDate()) .size(contentDisposition.getSize()).build(); super.setContentDisposition(formDataContentDisposition); } }
/** * Sets the control name. * * @param name the control name. */ public void setName(String name) { if (name == null) { throw new IllegalArgumentException(LocalizationMessages.CONTROL_NAME_CANNOT_BE_NULL()); } if (getFormDataContentDisposition() == null) { FormDataContentDisposition contentDisposition; contentDisposition = FormDataContentDisposition.name(name).build(); super.setContentDisposition(contentDisposition); } else { FormDataContentDisposition formDataContentDisposition = FormDataContentDisposition.name(name) .fileName(contentDisposition.getFileName()) .creationDate(contentDisposition.getCreationDate()) .modificationDate(contentDisposition.getModificationDate()) .readDate(contentDisposition.getReadDate()) .size(contentDisposition.getSize()).build(); super.setContentDisposition(formDataContentDisposition); } }
/** * Sets the control name. * * @param name the control name. */ public void setName(String name) { if (name == null) { throw new IllegalArgumentException(LocalizationMessages.CONTROL_NAME_CANNOT_BE_NULL()); } if (getFormDataContentDisposition() == null) { FormDataContentDisposition contentDisposition; contentDisposition = FormDataContentDisposition.name(name).build(); super.setContentDisposition(contentDisposition); } else { FormDataContentDisposition formDataContentDisposition = FormDataContentDisposition.name(name) .fileName(contentDisposition.getFileName()) .creationDate(contentDisposition.getCreationDate()) .modificationDate(contentDisposition.getModificationDate()) .readDate(contentDisposition.getReadDate()) .size(contentDisposition.getSize()).build(); super.setContentDisposition(formDataContentDisposition); } }
/** * Sets the control name. * * @param name the control name. */ public void setName(String name) { if (name == null) { throw new IllegalArgumentException(LocalizationMessages.CONTROL_NAME_CANNOT_BE_NULL()); } if (getFormDataContentDisposition() == null) { FormDataContentDisposition contentDisposition; contentDisposition = FormDataContentDisposition.name(name).build(); super.setContentDisposition(contentDisposition); } else { FormDataContentDisposition formDataContentDisposition = FormDataContentDisposition.name(name) .fileName(contentDisposition.getFileName()) .creationDate(contentDisposition.getCreationDate()) .modificationDate(contentDisposition.getModificationDate()) .readDate(contentDisposition.getReadDate()) .size(contentDisposition.getSize()).build(); super.setContentDisposition(formDataContentDisposition); } }
assertTrue("filename should end with .tds", contentDisposition.getFileName().endsWith(".tds"));