object

# `http_static_files`

Router-agnostic static file response helper built on the normalized `http_core` library.

Availability:
`logtalk_load(http_static_files(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-07-14
Compilation flags:
`static, context_switching_calls`
Imports:
`public` options
`public` http_docroot_paths
Uses:
atom
date
http_core
http_cors
http_directory_listing
list
mime_types
os
user
Remarks:
(none)
Inherited public predicates:
check_option/1 check_options/1 default_option/1 default_options/1 option/2 option/3 valid_option/1 valid_options/1

## Public predicates

### `serve/4`

Serves a relative request path from the given document root using the default options and returns a normalized response.

Compilation flags:
`static`
Template:
`serve(Path,Request,DocumentRoot,Response)`
Mode and number of proofs:
`serve(+atom,+compound,+atom,-compound)` - `one_or_error`
Exceptions:
`Path` is not a safe document-root relative path:
`domain_error(http_docroot_relative_path,Path)`
`Request` is not a valid normalized HTTP request term:
`domain_error(http_request,Request)`
`DocumentRoot` is not a valid absolute document root path:
`domain_error(http_docroot_document_root,DocumentRoot)`
`DocumentRoot` is not an existing static-files document root:
`domain_error(http_static_files_document_root,DocumentRoot)`
The generated response violates normalized HTTP response semantics:
`domain_error(http_header_semantics,Header)`

### `serve/5`

Serves a relative request path from the given document root using the given options and returns a normalized response.

Compilation flags:
`static`
Template:
`serve(Path,Request,DocumentRoot,Options,Response)`
Mode and number of proofs:
`serve(+atom,+compound,+atom,+list(compound),-compound)` - `one_or_error`
Exceptions:
`Path` is not a safe document-root relative path:
`domain_error(http_docroot_relative_path,Path)`
`Request` is not a valid normalized HTTP request term:
`domain_error(http_request,Request)`
`DocumentRoot` is not a valid absolute document root path:
`domain_error(http_docroot_document_root,DocumentRoot)`
`DocumentRoot` is not an existing static-files document root:
`domain_error(http_static_files_document_root,DocumentRoot)`
`Options` is a variable or a partial list:
`instantiation_error`
`Options` is neither a variable nor a list:
`type_error(list,Options)`
An element `Option` of the list `Options` is neither a variable nor a compound term:
`type_error(compound,Option)`
An element `Option` of the list `Options` is a compound term but not a valid option:
`domain_error(option,Option)`
The generated response violates normalized HTTP response semantics:
`domain_error(http_header_semantics,Header)`

## Protected predicates

(no local declarations; see entity ancestors if any)

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)