3.24 library(http/http_pwp): Serve PWP pages through the HTTP server
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog HTTP support
        • The HTTP server libraries
          • library(http/http_pwp): Serve PWP pages through the HTTP server
            • pwp_handler/2
            • reply_pwp_page/3
Availability::- use_module(library(http/http_pwp)).
pwp_handler(+Options, +Request)
Handle PWP files. This predicate is defined to create a simple HTTP server from a hierarchy of PWP, HTML and other files. The interface is kept compatible with the 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 /web/pwp/.
user:file_search_path(pwp, '/web/pwp').

:- http_handler(root(.), pwp_handler([path_alias(pwp)]), [prefix]).

Options include:

path_alias(+Alias)
Search for PWP files as Alias(Path). See absolute_file_name/3.
index(+Index)
Name of the directory index (pwp) file. This option may appear multiple times. If no such option is provided, pwp_handler/2 looks for index.pwp.
view(+Boolean)
If true (default is false), allow for ?view=source to serve PWP file as source.
index_hook(:Hook)
If a directory has no index-file, pwp_handler/2 calls Hook(PhysicalDir, Options, Request). If this semidet predicate succeeds, the request is considered handled.
hide_extensions(+List)
Hide files of the given extensions. The default is to hide .pl files.
dtd(?DTD)
DTD to parse the input file with. If unbound, the generated DTD is returned
Errors
permission_error(index, http_location, Location) is raised if the handler resolves to a directory that has no index.
See also
reply_pwp_page/3