[prev in list] [next in list] [prev in thread] [next in thread]
List: htmlunit-user
Subject: Re: [Htmlunit-user] Is it possible to set content-type as multipart/form-data in HTTPHEader and POST
From: Vasudevan Comandur <vcomandur () gmail ! com>
Date: 2018-04-09 18:53:54
Message-ID: CAEcJAuTysegcMd1z+rUqykws_09v8Gx-oN1qZDPFp_OkpkGvmg () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi All,
I am creating a Web Request object with the URL and the method is set
to POST and setting the FormEncoding Type to MULTIPART.
How do I upload a file?. I know the name of the file and its path. DO I
need create a dummy form with a submit Button?
I appreciate your help.
Regards
Vasu
On 25 January 2018 at 01:11, Ronald Brill <rbri@rbri.de> wrote:
> yourWebRequest.setEncodingType(FormEncodingType.MULTIPART);
>
> Hope the same methods are available in your old version also
>
> RBRi
>
> On Thu, 25 Jan 2018 01:08:33 +0530 Vasudevan Comandur wrote:
> >
> >Hi Ronald,
> >
> > I am constructing my own WebRequest with HTTPMethod set to POST.
> >
> > I construct the NameValue Pair and POST the request. I see HTMLUnit
> set
> >the content-type to x-form-encoded in this case.
> >
> > However, I want the similar feature to construct a
> >multi-part/formencoded content-type in HTMLUnit. Is it possible?
> >
> > I have another question. For one of the sites, the client(javascript)
> >is setting a cookie value and sending it to the server. Is it possible
> > in HTMLUnit to add that cookie to the cookie manager of Webclient
> >using addCookie Method?. Will that work. Because, such a call does
> > not set the Cookie in HTMLUnit in later version. Earlier versions of
> >HtmlUnit 2.9, I was able to do that.
> >
> > Looking forward to your reply.
> >
> >Regards
> > Vasu
> >
> >
> >
> >
> >On 25 January 2018 at 00:57, Ronald Brill <rbri@rbri.de> wrote:
> >
> >> Hi Vasu,
> >>
> >> i'm not sure that i got your point.
> >> Do you like
> >> * to manipulate the form before clicking the submit button or
> >> * have you created your own WebRequest and like to change the encoding
> >> type?
> >>
> >> Maybe you can illustrate your ide with some (pseudo) code
> >>
> >> RBRi
> >>
> >> BTW: 2.29 and 2.30 is on the way
> >>
> >>
> >> >Hi,
> >> >
> >> > I have been using htmlunit 2.23 version. I wanted to know if it is
> >> >possible to set
> >> > the content-type as multipart/form-data in HTTPRequestHEader and
> post a
> >> >form.
> >> >
> >> > Is it possible to achieve the above scenario without creating a
> sample
> >> >html file
> >> > and click on the submit button?
> >> >
> >> > Thanks for your input & suggestions in advance.
> >> >
> >> >Regards
> >> > Vasu
> >>
> >>
> >
> >
>
>
[Attachment #5 (text/html)]
<div dir="ltr">Hi All,<div><br></div><div> I am creating a Web Request object \
with the URL and the method is set to POST and setting the FormEncoding Type to \
MULTIPART.</div><div><br></div><div> How do I upload a file?. I know the name of \
the file and its path. DO I need create a dummy form with a submit \
Button?</div><div><br></div><div> I appreciate your \
help.</div><div><br></div><div>Regards</div><div> Vasu</div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On 25 January 2018 at 01:11, Ronald \
Brill <span dir="ltr"><<a href="mailto:rbri@rbri.de" \
target="_blank">rbri@rbri.de</a>></span> wrote:<br><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">yourWebRequest.<wbr>setEncodingType(<wbr>FormEncodingType.MULTIPART);<br>
<br>
Hope the same methods are available in your old version also<br>
<br>
RBRi<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, 25 Jan 2018 01:08:33 +0530 Vasudevan Comandur wrote:<br>
><br>
>Hi Ronald,<br>
><br>
> I am constructing my own WebRequest with HTTPMethod set to POST.<br>
><br>
> I construct the NameValue Pair and POST the request. I see HTMLUnit set<br>
>the content-type to x-form-encoded in this case.<br>
><br>
> However, I want the similar feature to construct a<br>
>multi-part/formencoded content-type in HTMLUnit. Is it possible?<br>
><br>
> I have another question. For one of the sites, the client(javascript)<br>
>is setting a cookie value and sending it to the server. Is it possible<br>
> in HTMLUnit to add that cookie to the cookie manager of Webclient<br>
>using addCookie Method?. Will that work. Because, such a call does<br>
> not set the Cookie in HTMLUnit in later version. Earlier versions of<br>
>HtmlUnit 2.9, I was able to do that.<br>
><br>
> Looking forward to your reply.<br>
><br>
>Regards<br>
> Vasu<br>
><br>
><br>
><br>
><br>
>On 25 January 2018 at 00:57, Ronald Brill <<a \
href="mailto:rbri@rbri.de">rbri@rbri.de</a>> wrote:<br> ><br>
>> Hi Vasu,<br>
>><br>
>> i'm not sure that i got your point.<br>
>> Do you like<br>
>> * to manipulate the form before clicking the submit button or<br>
>> * have you created your own WebRequest and like to change the encoding<br>
>> type?<br>
>><br>
>> Maybe you can illustrate your ide with some (pseudo) code<br>
>><br>
>> RBRi<br>
>><br>
>> BTW: 2.29 and 2.30 is on the way<br>
>><br>
>><br>
>> >Hi,<br>
>> ><br>
>> > I have been using htmlunit 2.23 version. I wanted to know if it \
is<br> >> >possible to set<br>
>> > the content-type as multipart/form-data in HTTPRequestHEader and \
post a<br> >> >form.<br>
>> ><br>
>> > Is it possible to achieve the above scenario without creating a \
sample<br> >> >html file<br>
>> > and click on the submit button?<br>
>> ><br>
>> > Thanks for your input & suggestions in advance.<br>
>> ><br>
>> >Regards<br>
>> > Vasu<br>
>><br>
>><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic