Reading http post data using Zinc

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Reading http post data using Zinc

Pharo Smalltalk Users mailing list
Hi Guys,
I'm posting from an http form and I'm wondering how to read data from the
post. It seems the request should give a ZnMultiPartFormDataEntity, but I
can't find how to use it.

Can you help me please?
Davide




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
Reply | Threaded
Open this post in threaded view
|

Re: Reading http post data using Zinc

Sven Van Caekenberghe-2
Hi Davide,

> On 16 Jun 2021, at 23:17, Davide Varvello via Pharo-users <[hidden email]> wrote:
>
> Hi Guys,
> I'm posting from an http form and I'm wondering how to read data from the
> post. It seems the request should give a ZnMultiPartFormDataEntity, but I
> can't find how to use it.
>
> Can you help me please?
> Davide
>
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

It depends on how the form is posted (there are two approaches).

A working example of both can be found in ZnDefaultServerDelegate>>#formTest2: and #formTest3:

ZnServerTest>>#testFormTest2: and #testFormTest3: exercise this functionality

Basically, you just take the entity from the request and use it.

HTH,

Sven

Reply | Threaded
Open this post in threaded view
|

Re: Reading http post data using Zinc

Pharo Smalltalk Users mailing list
Hi Sven,
I'm sending a FormData, so the right code is in
ZnDefaultServerDelegate>>#formTest3: that you pointed out. Thank you very
much.



To help other people of the list, I summarize that in case of multipart
form-data you have to read the entity and its parts, for example:
(aRequest entity partNamed: #myPartName) fieldValueString.
       
or also:
aRequest entity parts first fieldName.
aRequest entity parts first fieldValue


Cheers
Davide



Sven Van Caekenberghe-2 wrote
> Hi Davide,
>
>> On 16 Jun 2021, at 23:17, Davide Varvello via Pharo-users &lt;

> pharo-users@.pharo

> &gt; wrote:
>>
>> Hi Guys,
>> I'm posting from an http form and I'm wondering how to read data from the
>> post. It seems the request should give a ZnMultiPartFormDataEntity, but I
>> can't find how to use it.
>>
>> Can you help me please?
>> Davide
>>
>>
>>
>>
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
> It depends on how the form is posted (there are two approaches).
>
> A working example of both can be found in
> ZnDefaultServerDelegate>>#formTest2: and #formTest3:
>
> ZnServerTest>>#testFormTest2: and #testFormTest3: exercise this
> functionality
>
> Basically, you just take the entity from the request and use it.
>
> HTH,
>
> Sven





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html