@SuppressWarnings("unchecked") public MultipartForm(String boundary, Iterable<? extends Part> content) { super(content); this.boundary = boundary; this.content = content; getContentMetadata().setContentType("multipart/form-data; boundary=" + boundary); String boundaryrn = boundary + rn; boolean isRepeatable = true; long contentLength = 0; for (Part part : content) { if (!part.isRepeatable()) isRepeatable = false; contentLength += part.getContentMetadata().getContentLength() + createHeaders(boundaryrn, part).length() + createRn().length(); } contentLength += createFooter(boundary).length(); getContentMetadata().setContentLength(contentLength); this.isRepeatable = isRepeatable; }
@SuppressWarnings("unchecked") public MultipartForm(String boundary, Iterable<? extends Part> content) { super(content); this.boundary = boundary; this.content = content; getContentMetadata().setContentType("multipart/form-data; boundary=" + boundary); String boundaryrn = boundary + rn; boolean isRepeatable = true; long contentLength = 0; for (Part part : content) { if (!part.isRepeatable()) isRepeatable = false; contentLength += part.getContentMetadata().getContentLength() + createHeaders(boundaryrn, part).length() + createRn().length(); } contentLength += createFooter(boundary).length(); getContentMetadata().setContentLength(contentLength); this.isRepeatable = isRepeatable; }
@SuppressWarnings("unchecked") public MultipartForm(String boundary, Iterable<? extends Part> content) { super(content); this.boundary = boundary; this.content = content; getContentMetadata().setContentType("multipart/form-data; boundary=" + boundary); String boundaryrn = boundary + rn; boolean isRepeatable = true; long contentLength = 0; for (Part part : content) { if (!part.isRepeatable()) isRepeatable = false; contentLength += part.getContentMetadata().getContentLength() + createHeaders(boundaryrn, part).length() + createRn().length(); } contentLength += createFooter(boundary).length(); getContentMetadata().setContentLength(contentLength); this.isRepeatable = isRepeatable; }
@SuppressWarnings("unchecked") public MultipartForm(String boundary, Iterable<? extends Part> content) { super(content); getContentMetadata().setContentType("multipart/form-data; boundary=" + boundary); getContentMetadata().setContentLength(0l); String boundaryrn = boundary + rn; isRepeatable = true; InputSupplier<? extends InputStream> chain = join(); for (Part part : content) { if (!part.isRepeatable()) isRepeatable = false; getContentMetadata().setContentLength( getContentMetadata().getContentLength() + part.getContentMetadata().getContentLength()); chain = join(chain, addLengthAndReturnHeaders(boundaryrn, part), part, addLengthAndReturnRn()); } chain = join(chain, addLengthAndReturnFooter(boundary)); this.chain = chain; }
@SuppressWarnings("unchecked") public MultipartForm(String boundary, Iterable<? extends Part> content) { super(content); getContentMetadata().setContentType("multipart/form-data; boundary=" + boundary); getContentMetadata().setContentLength(0l); String boundaryrn = boundary + rn; isRepeatable = true; InputSupplier<? extends InputStream> chain = join(); for (Part part : content) { if (!part.isRepeatable()) isRepeatable = false; getContentMetadata().setContentLength( getContentMetadata().getContentLength() + part.getContentMetadata().getContentLength()); chain = join(chain, addLengthAndReturnHeaders(boundaryrn, part), part, addLengthAndReturnRn()); } chain = join(chain, addLengthAndReturnFooter(boundary)); this.chain = chain; }
@SuppressWarnings("unchecked") public MultipartForm(String boundary, Iterable<? extends Part> content) { super(content); getContentMetadata().setContentType("multipart/form-data; boundary=" + boundary); getContentMetadata().setContentLength(0l); String boundaryrn = boundary + rn; isRepeatable = true; InputSupplier<? extends InputStream> chain = join(); for (Part part : content) { if (!part.isRepeatable()) isRepeatable = false; getContentMetadata().setContentLength( getContentMetadata().getContentLength() + part.getContentMetadata().getContentLength()); chain = join(chain, addLengthAndReturnHeaders(boundaryrn, part), part, addLengthAndReturnRn()); } chain = join(chain, addLengthAndReturnFooter(boundary)); this.chain = chain; }