Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Missing initial multi part boundary

Hi,

On Tue, Jul 29, 2014 at 4:45 PM, Federico Fortini
<federico.fortini@xxxxxxxxx> wrote:
> Hello I'm tryng to uploading a file on an embedded Jetty 9.2.1 server.
>
> I use jetty HttpClient class, to upload in HTTPS.
>
> --------------------------------------------------------
>             SslContextFactory sslContextFactory = new
> SslContextFactory(true);
>             //HttpClientTransportOverHTTP t = new
> HttpClientTransportOverHTTP();
>             httpClient = new HttpClient( sslContextFactory);
>
>
> ---------------------------------------------------------
>
>
>         Request r =
> httpClient.newRequest("https://localhost:8000/UploadService);
>         r.header(HttpHeader.CONTENT_TYPE, "multipart/form-data");
>         r.file(Paths.get(aFileArrToUpload[0].getAbsolutePath()),
> "application/pdf");
>         Enumeration keys = aParameters.keys();
>         while(keys.hasMoreElements()){
>             String vParName = (String)keys.nextElement();
>             String vParvalue = aParameters.getProperty(vParName);
>             r.param(vParName, vParvalue);
>         }
>         r.method(HttpMethod.POST);
>         ContentResponse response = r.send();

Request.file() does not upload via multipart; it just uploads the file
as plain content bytes.
If you need multipart upload, there is this feature request:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=419966.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.


Back to the top