Efficient POST/PUT queries

Posted by Ralf Jung on
URL: https://discuss.orbeon.com/Efficient-POST-PUT-queries-tp3693979.html

Hi list,

when loading data from a HTTP service with GET, using the url-generator is (in
my experience) much more efficient than using xforms-submission. However, the
url-generator lacks a way to use different HTTP methods - if I want to issue a
large POST or PUT request, I seem to still have to use the xforms-submission
processor. That will not only start a full-flown XForms session, it will also
parse the whole request and response in a DOM tree, which is horribly
inefficient.
I guess for PUT and DELETE, which usually do not have a response (besides
"failed or not"), I could also use the url-serializer, but I could not find any
documentation about which HTTP method it uses or how to configure that
(http://wiki.orbeon.com/forms/doc/developer-guide/processors-other-
serializers#TOC-URL-serializer). Not that serializing to a "DELETE" would make
much sense.
However, this is obviously no solution for POST as the response is of interest
there. I attempted to extend the url-generator to support post, put and
delete. Unfortunately, Apache HttpClient sends weird "chunked POST" requests
if it is handed an InputStream, so the full POST body has to be buffered in a
byte[]. This is however still more memory efficient than parsing it into a DOM
tree. I tested it briefly with my usecase, and it worked. However I am sure I
did not get the caching part right - I could not figure out what all that
validity stuff does, so I just had it return null for non-GET queries. Seems to
work ;-)

I'd welcome any feedback whether something like this is desired, and whether I
chose the right direction to implement it.

The attached patch is based on current master.

Kind regards,
Ralf


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

0001-implemenet-POST-and-PUT-for-URLGenerator.patch (14K) Download Attachment