Availability:
:- use_module(library(http/http_dispatch)).http_path.pl. If an HTTP
request arrives at the server that matches Path, Closure
is called with one extra argument: the parsed HTTP request.
Options is a list containing the following options:
- authentication(+Type)
- Demand authentication. Authentication methods are pluggable. The library
http_authenticate.plprovides a plugin for user/password basedBasicHTTP authentication. - chunked
- Use
Transfer-encoding: chunkedif the client allows for it. - content_type(+Term)
- Specifies the content-type of the reply. This value is currently not used by this library. It enhances the reflexive capabilities of this library through http_current_handler/3.
- id(+Term)
- Identifier of the handler. The default identifier is the predicate name. Used by http_location_by_id/2.
- hide_children(+Bool)
- If
trueon a prefix-handler (see prefix), possible children are masked. This can be used to (temporary) overrule part of the tree. - prefix
- Call Pred on any location that is a specialisation of Path. If multiple handlers match, the one with the longest path is used.
- priority(+Integer)
- If two handlers handle the same path, the one with the highest priority is used. If equal, the last registered is used. Please be aware that the order of clauses in multifile predicates can change due to reloading files. The default priority is 0 (zero).
- spawn(+SpawnOptions)
- Run the handler in a seperate thread. If SpawnOptions is an atom, it is interpreted as a thread pool name (see create_thread_pool/3). Otherwise the options are passed to http_spawn/2 and from there to thread_create/3. These options are typically used to set the stack limits.
- time_limit(+Spec)
- One of
infinite,defaultor a positive number (seconds)
Note that http_handler/3 is normally invoked as a directive and processed using term-expansion. Using term-expansion ensures proper update through make/0 when the specification is modified. We do not expand when the cross-referencer is running to ensure proper handling of the meta-call.
- Errors
- existence_error(http_location, Location)
- See also
- http_reply_file/3 and http_redirect/3 are generic handlers to serve files and achieve redirects.