[Seaside] Re: Rest and POST method

Todd King kizzle42 at gmail.com
Tue Apr 5 14:43:36 UTC 2011


> From: Olivier Auverlot <olivier.auverlot at gmail.com>
> Subject: Re: [Seaside] Rest and POST method
>
> 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 ;-)


I don't want to steer you away for using Seaside-REST (I've been
meaning to look into it myself) - but I've a solution where I just use
the Swazoo server instance for handling my REST endpoints right along
side of my Seaside app.  It's not as integrated a solution as using
only Seaside, but it might be a good fall-back for you in the time
being and it should work with any of the http servers (Swazoo, Zinc,
Commanche, et. al.)

Cheers,

Todd Edwin King


More information about the seaside mailing list