This module provides convience predicates to include PWP (Prolog Well-formed Pages) in a Prolog web-server. It provides the following predicates:
library(http/http_dispatch). In the typical usage scenario, one needs to define an http location and a file-search path that is used as the root of the server. E.g., the following declarations create a self-contained web-server for files in
user:file_search_path(pwp, '/web/pwp'). :- http_handler(root(.), pwp_handler([path_alias(pwp)]), [prefix]).
false), allow for ?view=source to serve PWP file as source.
permission_error(index, http_location, Location)is raised if the handler resolves to a directory that has no index.
Options supported are:
false), process the PWP file in a module constructed from its canonical absolute path. Otherwise, the PWP file is processed in the calling module.
While processing the script, the file-search-path pwp includes the current location of the script. I.e., the following will find myprolog in the same directory as where the PWP file resides.