Hi Ben, 

Sorry for the belated response — maybe you forgot to update the web.xml file?

RestXQ-Resolution works as follows: 

The .basex file configures **where on disk** the RestXQ-Servlet looks für 
XQuery modules: 

The following options can be set: 

* WEBPATH
> Points to the directory in which all the Web Application 
> <https://docs.basex.org/wiki/Web_Application> contents are stored, including 
> XQuery, Script, RESTXQ <https://docs.basex.org/wiki/RESTXQ> and configuration 
> files:


In your case: PROJECT_ROOT/webapp

* RESTXQPATH

If this a relative path, it will be relative to your WEBPATH — so setting it to 
„modules“ will resolve to:
PROJECT_ROOT/webapp/modules

Now this summarizes it for your on disk-context ;-)

Switchting to the Servlet-context, you must make sure to tell the Container 
where to server your RESTXQ-Servlet: 
This can be seen in Web.xml here: 
> https://git.basex.io/basex-public/mailinglist-autocomplete/-/blob/main/webapp/WEB-INF/web.xml#L81-84
  <servlet-mapping>
    <servlet-name>RESTXQ</servlet-name>
    <url-pattern>/api/*</url-pattern>
  </servlet-mapping>

So basically you need to tell jetty, or whatever container you have, what’s the 
ROOT-Url for the RESTXQ contents. 
So in my web.xml anything *under* /api/ will be sent to the RESTXQ-Servlet 
which in turn tries to make sense of the URL and resolve it against your XQuery 
annotations :-)

Hope this helps

Michael

> Am 10.07.2020 um 23:28 schrieb Ben Pracht <ben.pra...@gmail.com>:
> 
> Thanks Michael,
> 
> I cloned your repo and borrowed your .basex file.  It did indeed allow me to 
> specify the page location.  However, I'm not able to get it to find my RESTXQ 
> is my services.  I added the out of the box BaseX ./bin to my PATH and 
> changed to a completely different directory.  Attached is my .basex and 
> database-services.xqm file.  For debugging purposes, I wanted to make sure my 
> services point to the right database.  My setup is like this:  
> 
> PROJECT_ROOT/.basex
> PROJECT_ROOT/.basexhome
> PROJECT_ROOT/modules/database
> PROJECT_ROOT/webapp/modules/database-services.xqm
> PROJECT_ROOT/modules/database-services.xqm
> 
> I duplicated the database-services file because I wasn't sure what folder the 
> RESTXQ was relative to.  
> 
> Vielen Danke!
> 
> Best Regards,
> Ben Pracht
> 919.809.2439
> ben.pra...@gmail.com <mailto:ben.pra...@gmail.com>

Reply via email to