Hi Elina, (cc: basex-talk)
Happy to help. That email correspondence is a bit old, and the code referenced is ancient. I suspect your problems creating the headers in XQuery restxq are due to default namespace prefix changes, rest vs restxq, way back when.
You are correct that enabling the supplied CORS filter in web.xml works for GET and POST but not PUT.
The reason is that PUT is not in the default AllowedMethods [1]
As an exercise I have created a little sample that uses only RESTXQ facilities. [2] It assumes the web.xml CORS filter is not enabled.
As supplied it has:
A cors.html file, to be opened directly in the browser, i.e. using the file protocol.
A cors.xqm intended to be put in the webapp folder of a local basexhttp running on 8984
Only the PUT request is allowed as I have commented out the Xquery generation of the CORS headers for GET and POST.
Note PUT is a non-simple CORS request and will result in the browser sending an additional request using the OPTIONS method [3]
This can be seen in the screenshot and is handled in the cors.xqm code.
Hope this helps
/Andy