153 static string add(
Qore::Program p,
string fn,
string name,
string src);
158 static string getCode(
bool bare_refs,
string fmt);
165 static bool doBlock(
string end, reference src,
string type, reference i, reference l);
170 static string getContentType(
string name);
188 const TemplateFunc =
"t";
210 constructor(
string resource_path,
int parse_opts = DefaultProgramOptions, *code pgm_setup) ;
232 private setupTemplateIntern(
date new_mtime);
340 string add(
string name,
string src, *
string ct);
344 bool hasTemplate(
string tname);
388 *
hash getTemplateHash();
392 list getTemplateList();
405 softlist indexes = (Defaults.IndexTemplate, Defaults.IndexFile);
408 hash template_extensions = Defaults.TemplateExtensions;
414 softint chunked_threshold = Defaults.ChunkedThreshold;
417 softint chunk_size = Defaults.ChunkSize;
425 softint error_level = 0;
439 "IndexFile":
"index.html",
440 "IndexTemplate":
"index.qhtml",
441 "TemplateExtensions": (
444 "ChunkedThreshold": 10 * 1024,
449 const Dirlisting =
"<html lang=\"en\" >" 452 " $d.chdir($ctx.path);" 453 " string $title = sprintf(\"Index of /%s\", $ctx.resource_path);" 456 " <meta charset=\"utf-8\" />" 457 " <title>{{ $title }}</title>" 461 " <h1>{{ $title }}</h1>" 463 " <div class=\"container\">" 467 " <th width=\"40\">Type</th>" 468 " <th width=\"80\">Size</th>" 470 " {% if ($ctx.parent_url) { %}" 472 " <td colspan=\"2\"><a href=\"{{ $ctx.parent_url }}\">Parent Directory</a></td>" 475 " {% foreach string $dir in (sort($d.listDirs())) { %}" 476 " {% if ($dir[0]!=\".\") {" 477 " string $path = replace($ctx.path, $ctx.file_root, \"\");" 479 " <tr><td><a href=\"{{ $ctx.url_root + $path + \"/\" + $dir }}\">{{ $dir }}</a></td><td width=\"40\">Directory</td></tr>" 482 " {% foreach string $file in (sort($d.listFiles())) { %}" 483 " {% if ($file[0]!=\".\") {" 484 " string $path = replace($ctx.path, $ctx.file_root, \"\");" 486 " <tr><td><a href=\"{{ $ctx.url_root + $path + \"/\" + $file }}\">{{ $file }}</a></td><td width=\"40\">File</td><td align=\"right\">{{hstat($ctx.path + \"/\" + $file).size }}</td></tr>" 517 private string getDirlistingTemplate();
558 logError(
string fmt);
562 logDebug(
string fmt);
591 private hash sendFile(ReadOnlyFile
f,
bool txt,
string ct);
*date mtime
file's modification time
Definition: WebUtil.qm.dox.h:197
manages a template resource that may need to be recompiled if the file is updated in the filesystem; ...
Definition: WebUtil.qm.dox.h:174
hash th
hash for template storage
Definition: WebUtil.qm.dox.h:248
*code psetup
code to perform Program initialization when creating a new Program object (inport API...
Definition: WebUtil.qm.dox.h:191
string ct
Content-Type.
Definition: WebUtil.qm.dox.h:87
string ct
the content type of the rendered template
Definition: WebUtil.qm.dox.h:185
int po
parse options used on the program
Definition: WebUtil.qm.dox.h:179
ReadOnlyFile f
file object
Definition: WebUtil.qm.dox.h:83
this is the base class for all template Program container classes
Definition: WebUtil.qm.dox.h:107
this class manages templates based on files
Definition: WebUtil.qm.dox.h:240
AbstractHttpRequestHandler handler
*string default_target
the default target if a URL cannot be satisfied
Definition: WebUtil.qm.dox.h:411
const PO_NO_INHERIT_GLOBAL_VARS
bool txt
text flag
Definition: WebUtil.qm.dox.h:85
this class serves files from the file system based on a root location
Definition: WebUtil.qm.dox.h:397
private any sendImpl()
returns data to send
*code psetup
code to perform Program initialization when creating a new Program object (inport API...
Definition: WebUtil.qm.dox.h:254
int po
parse options used on the program
Definition: WebUtil.qm.dox.h:251
A container for holding static text templates (ie that do not change once created in the template man...
Definition: WebUtil.qm.dox.h:298
HttpListenerInterface listener
const PO_NO_INHERIT_USER_FUNC_VARIANTS
string path
the path to the template
Definition: WebUtil.qm.dox.h:182
this class handles chunked file sends
Definition: WebUtil.qm.dox.h:74
string file_root
root directory for serving files
Definition: WebUtil.qm.dox.h:402
Program p
Holds the template generation function.
Definition: WebUtil.qm.dox.h:112
const DefaultProgramOptions
default parse options for template Programs
Definition: WebUtil.qm.dox.h:118
const PO_NO_TOP_LEVEL_STATEMENTS
hash th
Maps template names to function names.
Definition: WebUtil.qm.dox.h:303
constructor(HttpServer::HttpListenerInterface listener, HttpServer::AbstractHttpRequestHandler handler, Qore::Socket s, hash cx, hash hdr, *data body, Qore::ReadOnlyFile file, bool textflag, string content_type, int chunk_size)
creates the object
the WebUtil namespace contains all the objects in the WebUtil module
Definition: WebUtil.qm.dox.h:72
private hash getResponseHeaderMessageImpl()
returns the reponse headers
int cs
chunk size
Definition: WebUtil.qm.dox.h:89