102 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, *
hash respHdr) ;
167 static string add(
Qore::Program p,
string fn,
string name,
string src);
172 static string getCode(
bool bare_refs,
string fmt);
179 static bool doBlock(
string end, reference<string> src,
string type, reference<int> i, reference<list<hash>> l);
184 static string getContentType(
string name);
202 const TemplateFunc =
"t";
224 constructor(
string resource_path,
int parse_opts = DefaultProgramOptions, *code pgm_setup) ;
248 setupTemplateIntern(
date new_mtime);
357 string add(
string name,
string src, *
string ct);
361 bool hasTemplate(
string tname);
405 *
hash getTemplateHash();
409 list getTemplateList();
422 softlist indexes = (Defaults.IndexTemplate, Defaults.IndexFile);
425 hash template_extensions = Defaults.TemplateExtensions;
431 softint chunked_threshold = Defaults.ChunkedThreshold;
434 softint chunk_size = Defaults.ChunkSize;
442 softint error_level = 0;
456 "IndexFile":
"index.html",
457 "IndexTemplate":
"index.qhtml",
458 "TemplateExtensions": (
461 "ChunkedThreshold": 10 * 1024,
466 const Dirlisting =
"<html lang=\"en\" >" 469 " $d.chdir($ctx.path);" 470 " string $title = sprintf(\"Index of /%s\", $ctx.resource_path);" 473 " <meta charset=\"utf-8\" />" 474 " <title>{{ $title }}</title>" 478 " <h1>{{ $title }}</h1>" 480 " <div class=\"container\">" 484 " <th width=\"40\">Type</th>" 485 " <th width=\"80\">Size</th>" 487 " {% if ($ctx.parent_url) { %}" 489 " <td colspan=\"2\"><a href=\"{{ $ctx.parent_url }}\">Parent Directory</a></td>" 492 " {% foreach string $dir in (sort($d.listDirs())) { %}" 493 " {% if ($dir[0]!=\".\") {" 494 " string $path = replace($ctx.path, $ctx.file_root, \"\");" 496 " <tr><td><a href=\"{{ $ctx.url_root + $path + \"/\" + $dir }}\">{{ $dir }}</a></td><td width=\"40\">Directory</td></tr>" 499 " {% foreach string $file in (sort($d.listFiles())) { %}" 500 " {% if ($file[0]!=\".\") {" 501 " string $path = replace($ctx.path, $ctx.file_root, \"\");" 503 " <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>" 536 string getDirlistingTemplate();
581 logError(
string fmt);
585 logDebug(
string fmt);
*date mtime
file's modification time
Definition: WebUtil.qm.dox.h:211
manages a template resource that may need to be recompiled if the file is updated in the filesystem; ...
Definition: WebUtil.qm.dox.h:188
hash th
hash for template storage
Definition: WebUtil.qm.dox.h:265
*code psetup
code to perform Program initialization when creating a new Program object (inport API...
Definition: WebUtil.qm.dox.h:205
string ct
Content-Type.
Definition: WebUtil.qm.dox.h:93
string ct
the content type of the rendered template
Definition: WebUtil.qm.dox.h:199
int po
parse options used on the program
Definition: WebUtil.qm.dox.h:193
hash getResponseHeaderMessageImpl()
returns the reponse headers
ReadOnlyFile f
file object
Definition: WebUtil.qm.dox.h:89
this is the base class for all template Program container classes
Definition: WebUtil.qm.dox.h:121
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, *hash respHdr)
creates the object
this class manages templates based on files
Definition: WebUtil.qm.dox.h:257
AbstractHttpRequestHandler handler
*hash respHdr
response headers
Definition: WebUtil.qm.dox.h:97
*string default_target
the default target if a URL cannot be satisfied
Definition: WebUtil.qm.dox.h:428
const PO_NO_INHERIT_GLOBAL_VARS
bool txt
text flag
Definition: WebUtil.qm.dox.h:91
this class serves files from the file system based on a root location
Definition: WebUtil.qm.dox.h:414
*code psetup
code to perform Program initialization when creating a new Program object (inport API...
Definition: WebUtil.qm.dox.h:271
int po
parse options used on the program
Definition: WebUtil.qm.dox.h:268
A container for holding static text templates (ie that do not change once created in the template man...
Definition: WebUtil.qm.dox.h:315
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:196
this class handles chunked file sends
Definition: WebUtil.qm.dox.h:80
string file_root
root directory for serving files
Definition: WebUtil.qm.dox.h:419
Program p
Holds the template generation function.
Definition: WebUtil.qm.dox.h:126
const DefaultProgramOptions
default parse options for template Programs
Definition: WebUtil.qm.dox.h:132
const PO_NO_TOP_LEVEL_STATEMENTS
hash th
Maps template names to function names.
Definition: WebUtil.qm.dox.h:320
the WebUtil namespace contains all the objects in the WebUtil module
Definition: WebUtil.qm.dox.h:78
int cs
chunk size
Definition: WebUtil.qm.dox.h:95