Hello there,

Further to the below, I have found the common.xqm module which has the resource function to do this.

Happy New Year :)

Shaun 

On Tue, 1 Jan 2019, 12:26 Shaun Flynn <scfy12@googlemail.com wrote:
Hello there,

I am using BaseX 9.1.1 inside a Tomcat server trying to build a webapp using RESTXQ.

I have studied the DBA xqm files, and see that there is static content delivered to the generated login page, located in dba/static folder.

When I try to replicate this in my app, I get 404 errors saying the resource can not be found in the Developer Tools of Opera.

Below is my .xqm file. The resources in question are in bold and underlined. What am I doing wrong?

module namespace scheduleGui = "www.tt.co.uk/schedule";
import module namespace path = "www.tt.co.uk/path" at "DFSPath.xqm";

(: 
Produces a simple HTML form for entering origin and destination to produce a path
:)



declare 
%output:method("html")
%rest:path("/rail/a2b")
function scheduleGui:welcome() {
<html>
<head>
  <script type="text/javascript" src="static/jQuery3.1.1.js"></script>
  <script type="text/javascript" src="static/simplePost.js"></script>
</head>
<body>
  <h1>Paths</h1>
  <table>
    <tr>
        <td> Origin </td>
        <td> <input type="text" id="origin" value="" size="8" /> </td>
    </tr>
    <tr>
        <td> Destination </td>
        <td> <input type="text" id="destination" value="" size="8" /> </td>
    </tr>
    <tr>
        <td> </td>
        <td> <input type="submit" value="Go!" id="findPath" /> </td>
    </tr>
  </table>
  
  <div id="displayArea">
  
  </div>
</body>
</html>
};

declare
%rest:POST
%rest:form-param("origin","{$origin}", "")
%rest:form-param("destination","{$destination}", "")
%output:method("html")
%rest:path("/rail/a2bp")
function scheduleGui:a2b($origin, $destination) {
  if($origin != "") then (<p> Find path from {$origin} to {$destination} </p>),
  <ul> {
  for $path in path:DFSSpec($origin, $destination, "up")
  return
  <li>{$path}</li>
  } </ul>
};