![]()  | 
  
    Qore WebUtil Module Reference
    1.6.1
    
   | 
 
manages a template resource that may need to be recompiled if the file is updated in the filesystem; used by WebUtil::TemplateFileManager More...

Public Member Methods | |
| constructor (string resource_path, int parse_opts=DefaultProgramOptions, *code pgm_setup) | |
| creates the object based on the pathname and Program options  More... | |
  Public Member Methods inherited from WebUtil::TextTemplateBase | |
| constructor (int po=DefaultProgramOptions) | |
| sets up the object  | |
| Program | getProgram () | 
| returns the contained Program object  | |
Private Member Methods | |
| hash< HttpResponseInfo > | renderImpl (date new_mtime, hash< auto > ctx, int http_code=200, *hash< auto > hdr) | 
| explicitly renders the given template with the given argument  More... | |
| RWLock | rwl () | 
| to ensure atomicity regarding contention between setup/recompiles and rendering requests  | |
Private Attributes | |
| string | ct | 
| the content type of the rendered template  | |
| *date | mtime | 
| file's modification time  | |
| string | path | 
| the path to the template  | |
| int | po | 
| parse options used on the program  | |
| *code | psetup | 
| code to perform Program initialization when creating a new Program object (inport API, etc)  | |
| const | TemplateFunc = "t" | 
| the name of the template function  | |
  Private Attributes inherited from WebUtil::TextTemplateBase | |
| Program | p | 
| Holds the template generation function.  | |
Additional Inherited Members | |
  Static Public Member Methods inherited from WebUtil::StaticTextTemplateBase | |
| static string | add (Qore::Program p, string fn, string name, string src) | 
| adds a template function to a template Program object  More... | |
| static string | getContentType (string name) | 
| returns the content type from the file name, ignores any leading "q" in the extensions, assuming a template  | |
  Public Attributes inherited from WebUtil::StaticTextTemplateBase | |
| const | DefaultProgramOptions = PO_REQUIRE_OUR|PO_NO_TOP_LEVEL_STATEMENTS|PO_NO_INHERIT_USER_FUNC_VARIANTS|PO_NO_INHERIT_GLOBAL_VARS|PO_NO_USER_CLASSES|PO_NO_TERMINAL_IO | 
| default parse options for template Programs  | |
  Static Private Member Methods inherited from WebUtil::StaticTextTemplateBase | |
| static bool | doBlock (string end, reference< string > src, string type, reference< int > i, reference< list< hash >> l) | 
| a helper method used in parsing  | |
| static string | getCode (bool bare_refs, string fmt) | 
| a helper method that strips dollar signs from code when PO_ALLOW_BARE_REFS is set in the template program  | |
manages a template resource that may need to be recompiled if the file is updated in the filesystem; used by WebUtil::TemplateFileManager
| WebUtil::FileTemplate::constructor | ( | string | resource_path, | 
| int | parse_opts = DefaultProgramOptions,  | 
        ||
| *code | pgm_setup | ||
| ) | 
creates the object based on the pathname and Program options
| resource_path | the path to the resource | 
| parse_opts | the Program parse options for the template file programs | 
| pgm_setup | an optional closure or call reference taking a single Program argument to be called when initializing template programs to set up a custom template API, etc | 
      
  | 
  private | 
explicitly renders the given template with the given argument
| new_mtime | the modified date/time of the file, used to determine if the template should be recomiled or not | 
| ctx | the context argument for the template | 
| http_code | the HTTP response code for the response, if not present then 200 "OK" is assumed  | 
| hdr | any optional headers for the response (the "Content-Type" header is set from the template's "Content-Type" value automatically) | 
code: the HTTP response code corresponding to the code argumentbody: the rendered templatehdr: a hash of headers corresponding to the hdr argument plus the "Content-Type" key set from the template's "Content-Type" value)