hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sunitha yellasinganamala <sunithayel...@gmail.com>
Subject Re: Missing start boundary error while using PostMethod and MultipartRequestEntity
Date Thu, 07 Jan 2010 19:26:34 GMT
Hi Oleg,

I tried to use 4.1 but looks like it is not there on maven repository. I
used mvn to get the latest version and apparently could only find 3.1 in mvn
repository.
I understand that I have another option of downloading the jar and add to
classpath manually.
Let me know if it is already available on mvn repo and the dependencies if
it is.

Thanks
Sunitha

On Thu, Jan 7, 2010 at 4:20 AM, Oleg Kalnichevski <olegk@apache.org> wrote:

> On Wed, 2010-01-06 at 16:41 -0800, sunitha yellasinganamala wrote:
> > Hi All,
> >
> > I am using apache commons httpClient PostMethod in conjunction with
> > MultipartRequestEntity to upload a file.
> > I am getting a 500 status code and when I print the Response Body I see
> the
> > following error:
> > " javax.ws.rs.WebApplicationException:
> > org.jvnet.mimepull.MIMEParsingException: Missing start boundary
> >     at
> >
> com.sun.jersey.multipart.impl.MultiPartReader.readFrom(MultiPartReader.java:203)
> > ....
> > "
> >
> > Can anyone provide any pointers on why this is cause?
> >
>
> For your own good consider upgrading to HttpClient 4.0.1 HttpClient 3.x
> is nearing end of life. I, for one, have no interest supporting it
> anymore.
>
> Oleg
>
>
> > Here is how my code looks like:
> >             HttpClient client = new HttpClient();
> >             PostMethod method = new PostMethod(url);
> >            method.addRequestHeader("Content-Type",
> "multipart/form-data");
> >            method.addParameter("name", "somename here");
> >
> >         try {
> >             Part[] parts = {
> >                     new StringPart("file","workflow.xml"),
> >                     new FilePart(targetFile.getName(), targetFile ,
> > "application/octet-stream","") };
> >             method.setRequestEntity(new MultipartRequestEntity(parts,
> > method.getParams()));
> >
> >             } catch (FileNotFoundException e) {
> >             // TODO Auto-generated catch block
> >             e.printStackTrace();
> >         }
> > int statusCode = client.executeMethod(method);
> >
> >
> >
> > Thanks
> > Sunitha
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message