[Seaside] Rest and POST method
Tobias Pape
Das.Linux at gmx.de
Tue Apr 5 08:34:16 UTC 2011
Am 2011-04-05 um 09:29 schrieb Olivier Auverlot:
> 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.
Probably you can try rawBody. It is used by SqueakSource3 in
a put request, where postFields are naturally not available.:
putMap: fileName ofProject: projectName
<PUT>
<Path: '/{projectName}/{fileName}.mcm'>
"… "
| data |
data := self requestContext request rawBody.
"…"
More information about the seaside
mailing list