Re: [Xsltforms-support] XSLTForms and REST
Brought to you by:
alain-couthures
From: Efraim F. <efr...@gm...> - 2011-02-11 15:59:05
|
Hi, On 02/11/2011 08:06 AM, Grégoire COLBERT wrote: > Le 05/01/2011 23:38, Stephen Cameron a écrit : >> >> Hello All, >> >> I have been reading up on REST, there is quite a bit more to it than >> I first imagined. >> >> Its essential to be able to read and set header information in the >> client, such as to read the "Location" header in a POST response to >> extract a newly generated resource id. >> >> I'm wondering if anyone has looked at this in respect of XSLTForms? >> > > Hi Stephen! > > I'm facing the same question! I would like to read the HTTP status > code from XSLTForms. Have you succeeded in doing this? There are essentially 2 ways (that I know of) to set headers: One of them is to set a session cookie, which is passed back in the response header and automatically passed in the request header of subsequent HTTP requests. It's somewhat un-REST-like in the strict sense, but you can use a REST-like design on the server side and treat the information in it like any other header-based information. The advantage of them is that your client side web application doesn't have to pass internal variables between pages. The second is the xf:header element as a child of the xf:submission element. It does work in XSLTForms. To get response codes, the XForms spec says that you should be able to catch xf:submit-done or xf:submit-error and use the event() function to get the response codes and reasons, as described in http://www.w3.org/TR/xforms11/#submit . As far as I could tell, it doesn't work in XSLTForms. One way to work around the latter issue is to catch the error in your server side script before it returns and send back some XML describing the error/error code to the client, which can then handle xforms-submit-done differently if it receives the error code (the conditional xf:action/@if is helpful here). It's ugly, but it does work. Hope this helps, -- --- Efraim Feinstein Lead Developer Open Siddur Project http://opensiddur.net http://wiki.jewishliturgy.org |