[Seaside] Rest and POST method

Olivier Auverlot olivier.auverlot at gmail.com
Tue Apr 5 07:29:11 UTC 2011


Hi Philippe,

I work with the Seaside One-Click image and the HTTP server is Comanche.

*******************************************************
First test: with form data
*******************************************************

-- the postForm method --------------------------------

postForm
<POST>
<Consumes: 'application/x-www-form-urlencoded'>
<Path: '/postform'>

     Transcript show: self requestContext request postFields.

-- REQUEST --------------------------------

POST /MonAppRest/postform HTTP/1.1
Content-Type: application/x-www-form-urlencoded

user=olivier&id=23

-- RESPONSE --------------------------------

HTTP/1.1 200 OK
Date: Tue, 05 Apr 2011 07:13:01 GMT
Connection: close
Server: KomHttpServer/7.1.3 (Mac OS)
Content-Type: text/html
Content-Length: 0

-- Result  --------------------------------
a WARequestFields('id'->'23' 'user'->'olivier')

*******************************************************
Second test: with XML data
*******************************************************

-- the postXML method --------------------------------

postXML
     "detection de l'envoi de données XML"
<POST>
<Consumes: 'text/xml'>
<Path: '/postxml'>

     self requestContext inspect.

     Transcript show: 'postXML'.

-- REQUEST --------------------------------

POST /MonAppRest/postxml HTTP/1.1
Content-Type: text/xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<agent>
<nom>auverlot</nom>
</agent>

-- RESPONSE --------------------------------

HTTP/1.1 200 OK
Date: Tue, 05 Apr 2011 07:08:01 GMT
Connection: close
Server: KomHttpServer/7.1.3 (Mac OS)
Content-Type: text/html
Content-Length: 0

-- Result  --------------------------------
a WARequestFields()

WARequestFields is empty but it seems logical because that is not a form 
that is submited. I tried to read data thru rawBody but it is empty also.

For my project, I need to exchange XML data and probably LDIF data. If 
there are no solutions, I will be forced to use another programming 
solution (perl or java) :-( D'OH!!!.

Do you think that it's possible to implement a mecanism to access of the 
body of a request send with a POST method ?

Thank for your help.

Best regards
Olivier ;-)

www.auverlot.fr

Le 05/04/11 08:59, Philippe Marschall a écrit :
> 2011/4/4 Olivier Auverlot<olivier.auverlot at gmail.com>:
>> Philippe, thank for your response.
>>
>> ok, that works for the content type application/x-www-form-urlencoded but I
>> need to receive xml data. With another content type like text/plain or
>> text/xml, the data seems to be not parsed. postFields or rawBody are empty.
> I would expect #postFields to be empty since it can't be parsed as
> application/x-www-form-urlencoded or multipart/form-data. Which server
> do you use in which version? Do you have dump of the request?
>
> Cheers
> Philippe
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list