I am attempting to set up content negotiation for HTTP requests for various serializations of RDF. I have set up a restxq module file to control the API, started the server, and performed GET requests the the localhost with Accept: headers for the various Content-Types that the restxq file is designed to handle. You can see a simplified version of the file at https://gist.github.com/baskaufs/00f471b905ae9b862677fedf9f047bcb . Everything works according to expectations when I request a single content type using cURL, Chrome Advanced REST Client, etc. However, when I use a browser, I get the error
400 Stopped at C:/Program Files (x86)/BaseX/webapp/restxq.xqm, 6/12: [bxerr:BASX0003] Path "/{$id}" assigned to several functions: C:/Program Files (x86)/BaseX/webapp/restxq.xqm, 6/12 C:/Program Files (x86)/BaseX/webapp/restxq.xqm, 20/12 C:/Program Files (x86)/BaseX/webapp/restxq.xqm, 34/12 C:/Program Files (x86)/BaseX/webapp/restxq.xqm, 48/12
I checked the Accept: request header sent by Chrome and it is
1. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
So I tried sending a GET using Advanced Rest Client and the same Accept: header. That produced the same error. I experimented with changing the Accept header and the problem seems to be caused by the "*/*" wildcard in the Accept: header. Any combination I use without */* works, but any combination including it fails. According to what I've read at http://docs.basex.org/wiki/RESTXQ#Content_Negotiation and http://exquery.github.io/exquery/exquery-restxq-specification/restxq-1.0-spe... (section 5.2.3), the more specific media type should be used to process the request, so it doesn't seem like there should be a problem with the client specifying multiple content types, including */*.
Any advice you can offer would be appreciated. I'm running BaseX 8.5.3 on a 64 bit Windows 10 system. Steve Baskauf
Hi Steve,
Thanks for the report. I’ll need to spend some more time to investigate this. I remember there was a former bug report, which may have been related to this issue [1].
I’ll get back to you, hopefully soon, Christian
[1] https://github.com/BaseXdb/basex/issues/1220
On Thu, Sep 22, 2016 at 5:37 AM, Steve Baskauf steve.baskauf@vanderbilt.edu wrote:
I am attempting to set up content negotiation for HTTP requests for various serializations of RDF. I have set up a restxq module file to control the API, started the server, and performed GET requests the the localhost with Accept: headers for the various Content-Types that the restxq file is designed to handle. You can see a simplified version of the file at https://gist.github.com/baskaufs/00f471b905ae9b862677fedf9f047bcb . Everything works according to expectations when I request a single content type using cURL, Chrome Advanced REST Client, etc. However, when I use a browser, I get the error
400 Stopped at C:/Program Files (x86)/BaseX/webapp/restxq.xqm, 6/12: [bxerr:BASX0003] Path "/{$id}" assigned to several functions: C:/Program Files (x86)/BaseX/webapp/restxq.xqm, 6/12 C:/Program Files (x86)/BaseX/webapp/restxq.xqm, 20/12 C:/Program Files (x86)/BaseX/webapp/restxq.xqm, 34/12 C:/Program Files (x86)/BaseX/webapp/restxq.xqm, 48/12
I checked the Accept: request header sent by Chrome and it is
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
So I tried sending a GET using Advanced Rest Client and the same Accept: header. That produced the same error. I experimented with changing the Accept header and the problem seems to be caused by the "*/*" wildcard in the Accept: header. Any combination I use without */* works, but any combination including it fails. According to what I've read at http://docs.basex.org/wiki/RESTXQ#Content_Negotiation and http://exquery.github.io/exquery/exquery-restxq-specification/restxq-1.0-spe... (section 5.2.3), the more specific media type should be used to process the request, so it doesn't seem like there should be a problem with the client specifying multiple content types, including */*.
Any advice you can offer would be appreciated. I'm running BaseX 8.5.3 on a 64 bit Windows 10 system. Steve Baskauf
-- Steven J. Baskauf, Ph.D., Senior Lecturer Vanderbilt University Dept. of Biological Sciences
postal mail address: PMB 351634 Nashville, TN 37235-1634, U.S.A.
delivery address: 2125 Stevenson Center 1161 21st Ave., S. Nashville, TN 37235
office: 2128 Stevenson Center phone: (615) 343-4582, fax: (615) 322-4942 If you fax, please phone or email so that I will know to look for it. http://bioimages.vanderbilt.edu http://vanderbilt.edu/trees
basex-talk@mailman.uni-konstanz.de