You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2018/04/04 12:11:00 UTC

[jira] [Resolved] (HTTPASYNC-137) ZeroCopyPost not working with content type multipart/form-data

     [ https://issues.apache.org/jira/browse/HTTPASYNC-137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPASYNC-137.
-----------------------------------------
    Resolution: Invalid

Zero copy transfer can only work with content stored in a physical file. If you want to use zero copy for multipart upload, you need to save the entire multipart message body into a file and manually add a content-type header with the correct boundary attribute.

Oleg   

> ZeroCopyPost not working with content type multipart/form-data
> --------------------------------------------------------------
>
>                 Key: HTTPASYNC-137
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-137
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>            Reporter: Sarat
>            Priority: Major
>
> Team,
> I have requirement to have a client to upload a file to a restful service.
> File upload = new File("C:/Demo/download/Sample.zip");
> ZeroCopyPost httpost = new ZeroCopyPost("http://localhost:8080/FileUploadService/services/fileservice/upload/zip", upload,
> ContentType.create("multipart/form-data"));
> eroCopyConsumer<File> consumer = new ZeroCopyConsumer<File>(upload) {
>  @Override
>  protected File process(
>  final HttpResponse response,
>  final File file,
>  final ContentType contentType) throws Exception {
>  if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
>  throw new ClientProtocolException("Upload failed: " + response.getStatusLine());
>  }
>  return file;
>  }
> };
> Future<File> future = httpclient.execute(httpost,consumer,null);
>  
> Getting exception at rest service, "org.apache.cxf.interceptor.Fault: Couldn't determine the boundary from the message!"
>  
> Note:Working fine with  other clients. But i have requirement to use nio.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org