|Did you know ...||Search Documentation:|
'/home.html'or a term Alias(Relative). Where Alias is associated with a concrete path using http:location/3 and resolved using http_absolute_location/3. Relative can be a single atom or a term `Segment1/Segment2/...`, where each element is either an atom or a variable. If a segment is a variable it matches any segment and the binding may be passed to the closure. If the last segment is a variable it may match multiple segments. This allows registering REST paths, for example:
:- http_handler(root(user/User), user(Method, User), [ method(Method), methods([get,port,put]) ]). user(get, User, Request) :- ... user(post, User, Request) :- ...
If an HTTP request arrives at the server that matches Path, Closure is called as below, where Request is the parsed HTTP request.
Options is a list containing the following options:
http_authenticate.plprovides a plugin for user/password based
Transfer-encoding: chunkedif the client allows for it.
trueon a prefix-handler (see prefix), possible children are masked. This can be used to (temporary) overrule part of the tree.
method(*)allows for all methods.
:- http_handler(/, http_404([index('index.html')]), [spawn(my_pool),prefix]).
defaultor a positive number (seconds). If
default, the value from the setting
http:time_limitis taken. The default of this setting is 300 (5 minutes). See setting/2.
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.