162 static string add(
Qore::Program p,
string fn,
string name,
string src);
167 static string getCode(
bool bare_refs,
string fmt);
174 static bool doBlock(
string end, reference<string> src,
string type, reference<int> i, reference<list<hash>> l);
179 static string getContentType(
string name);
197 const TemplateFunc =
"t";
219 constructor(
string resource_path,
int parse_opts = DefaultProgramOptions, *code pgm_setup) ;
243 setupTemplateIntern(
date new_mtime);
352 string add(
string name,
string src, *
string ct);
356 bool hasTemplate(
string tname);
400 *
hash getTemplateHash();
404 list getTemplateList();
417 softlist indexes = (Defaults.IndexTemplate, Defaults.IndexFile);
420 hash template_extensions = Defaults.TemplateExtensions;
426 softint chunked_threshold = Defaults.ChunkedThreshold;
429 softint chunk_size = Defaults.ChunkSize;
437 softint error_level = 0;
451 "IndexFile":
"index.html",
452 "IndexTemplate":
"index.qhtml",
453 "TemplateExtensions": (
456 "ChunkedThreshold": 10 * 1024,
461 const Dirlisting =
"<html lang=\"en\" >" 464 " $d.chdir($ctx.path);" 465 " string $title = sprintf(\"Index of /%s\", $ctx.resource_path);" 468 " <meta charset=\"utf-8\" />" 469 " <title>{{ $title }}</title>" 473 " <h1>{{ $title }}</h1>" 475 " <div class=\"container\">" 479 " <th width=\"40\">Type</th>" 480 " <th width=\"80\">Size</th>" 482 " {% if ($ctx.parent_url) { %}" 484 " <td colspan=\"2\"><a href=\"{{ $ctx.parent_url }}\">Parent Directory</a></td>" 487 " {% foreach string $dir in (sort($d.listDirs())) { %}" 488 " {% if ($dir[0]!=\".\") {" 489 " string $path = replace($ctx.path, $ctx.file_root, \"\");" 491 " <tr><td><a href=\"{{ $ctx.url_root + $path + \"/\" + $dir }}\">{{ $dir }}</a></td><td width=\"40\">Directory</td></tr>" 494 " {% foreach string $file in (sort($d.listFiles())) { %}" 495 " {% if ($file[0]!=\".\") {" 496 " string $path = replace($ctx.path, $ctx.file_root, \"\");" 498 " <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>" 531 string getDirlistingTemplate();
576 logError(
string fmt);
580 logDebug(
string fmt);
627 hash sendFile(ReadOnlyFile
f,
bool txt,
string ct);
*date mtime
file's modification time
Definition: WebUtil.qm.dox.h:206
manages a template resource that may need to be recompiled if the file is updated in the filesystem; ...
Definition: WebUtil.qm.dox.h:183
hash th
hash for template storage
Definition: WebUtil.qm.dox.h:260
*code psetup
code to perform Program initialization when creating a new Program object (inport API...
Definition: WebUtil.qm.dox.h:200
string ct
Content-Type.
Definition: WebUtil.qm.dox.h:90
string ct
the content type of the rendered template
Definition: WebUtil.qm.dox.h:194
int po
parse options used on the program
Definition: WebUtil.qm.dox.h:188
hash getResponseHeaderMessageImpl()
returns the reponse headers
ReadOnlyFile f
file object
Definition: WebUtil.qm.dox.h:86
this is the base class for all template Program container classes
Definition: WebUtil.qm.dox.h:116
this class manages templates based on files
Definition: WebUtil.qm.dox.h:252
AbstractHttpRequestHandler handler
*string default_target
the default target if a URL cannot be satisfied
Definition: WebUtil.qm.dox.h:423
const PO_NO_INHERIT_GLOBAL_VARS
bool txt
text flag
Definition: WebUtil.qm.dox.h:88
this class serves files from the file system based on a root location
Definition: WebUtil.qm.dox.h:409
*code psetup
code to perform Program initialization when creating a new Program object (inport API...
Definition: WebUtil.qm.dox.h:266
int po
parse options used on the program
Definition: WebUtil.qm.dox.h:263
A container for holding static text templates (ie that do not change once created in the template man...
Definition: WebUtil.qm.dox.h:310
auto sendImpl()
returns data to send
HttpListenerInterface listener
hash< HttpHandlerResponseInfo > handleRequest()
const PO_NO_INHERIT_USER_FUNC_VARIANTS
string path
the path to the template
Definition: WebUtil.qm.dox.h:191
this class handles chunked file sends
Definition: WebUtil.qm.dox.h:77
string file_root
root directory for serving files
Definition: WebUtil.qm.dox.h:414
Program p
Holds the template generation function.
Definition: WebUtil.qm.dox.h:121
const DefaultProgramOptions
default parse options for template Programs
Definition: WebUtil.qm.dox.h:127
const PO_NO_TOP_LEVEL_STATEMENTS
hash th
Maps template names to function names.
Definition: WebUtil.qm.dox.h:315
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:75
int cs
chunk size
Definition: WebUtil.qm.dox.h:92