webapp/static

Thursday, 6 January 2022 · 2 messages · last reply 7 Jan 2022
HR
Hans-Juergen Rennau6 Jan 2022 10:07 #

Hello, dear BaseX team,

one question concerning folder $BASEX/webapp/static.

Given an HTML page created by a query via REST or RESTXQ execution. It seems to me that referenced resources (e.g. link/@href or img/@src) must be located in that folder or a subfolder of it, and the reference must be "../static/foo.css" or "../static/path/to/subfolder/foo.css", examples:

<link rel="stylesheet" type="text/css" href="../static/foo.css"/>
<link rel="stylesheet" type="text/css" href="../static/foo/foo.css"/>

At least I did not succeed with any other locations, specified by full path or by relative path, assuming different context paths (e.g. the folder containing the query producing the HTML, or $BASEX/bin, or $BASEX).

My QUESTION: is that correct, if not - what are the rules?

Many thanks, Hans-Jürgen

PS: Apologies if this is documented, but I failed to find it, and the complete PDF contains a single occurrence of string "/static" which does not apply.

CG
Christian Grün7 Jan 2022 18:24 #

Hi Hans-Jürgen.

A fixed directory for static resources can be adjusted in the web.xml file; see [1] for further information. Static files can also be delivered via RESTXQ; see [2] on how it’s done by the DBA.

Gutes Neues, Christian

[1] https://docs.basex.org/wiki/Web_Application [2] https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/webapp/dba/common.xqm#L21-L41

Quoted text · Hans-Juergen Rennau · 19 lines
On Thu, Jan 6, 2022 at 10:07 AM Hans-Juergen Rennau <hrennau at yahoo.de> wrote: > > Hello, dear BaseX team, > > one question concerning folder $BASEX/webapp/static. > > Given an HTML page created by a query via REST or RESTXQ execution. It seems to me that referenced resources (e.g. link/@href or img/@src) must be located in that folder or a subfolder of it, and the reference must be "../static/foo.css" or "../static/path/to/subfolder/foo.css", examples: > > <link rel="stylesheet" type="text/css" href="../static/foo.css"/> > <link rel="stylesheet" type="text/css" href="../static/foo/foo.css"/> > > At least I did not succeed with any other locations, specified by full path or by relative path, assuming different context paths (e.g. the folder containing the query producing the HTML, or $BASEX/bin, or $BASEX). > > My QUESTION: is that correct, if not - what are the rules? > > Many thanks, > Hans-Jürgen > > PS: Apologies if this is documented, but I failed to find it, and the complete PDF contains a single occurrence of string "/static" which does not apply.

⚡Generated with XQuery