This is the org.melusina.webmachine Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:32:52 2024 GMT+0.
org.melusina.webmachine/org.melusina.webmachine.asd
org.melusina.webmachine/src/package.lisp
org.melusina.webmachine/src/utilities.lisp
org.melusina.webmachine/src/configuration.lisp
org.melusina.webmachine/src/condition.lisp
org.melusina.webmachine/src/content.lisp
org.melusina.webmachine/src/request.lisp
org.melusina.webmachine/src/reply.lisp
org.melusina.webmachine/src/request-method.lisp
org.melusina.webmachine/src/media-type.lisp
org.melusina.webmachine/src/path.lisp
org.melusina.webmachine/src/resource.lisp
org.melusina.webmachine/src/constant-resource.lisp
org.melusina.webmachine/src/directory-resource.lisp
org.melusina.webmachine/src/file-resource.lisp
org.melusina.webmachine/src/acceptor.lisp
The main system appears first, followed by any subsystem dependency.
org.melusina.webmachine
HTTP Semantic Awareness on top of Hunchentoot
Michaël Le Barbier
MIT License
alexandria
(system).
cl-ppcre
(system).
hunchentoot
(system).
parse-number
(system).
trivia
(system).
src
(module).
Modules are listed depth-first from the system components tree.
org.melusina.webmachine/src
org.melusina.webmachine
(system).
package.lisp
(file).
utilities.lisp
(file).
configuration.lisp
(file).
condition.lisp
(file).
content.lisp
(file).
request.lisp
(file).
reply.lisp
(file).
request-method.lisp
(file).
media-type.lisp
(file).
path.lisp
(file).
resource.lisp
(file).
constant-resource.lisp
(file).
directory-resource.lisp
(file).
file-resource.lisp
(file).
acceptor.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
org.melusina.webmachine/org.melusina.webmachine.asd
org.melusina.webmachine/src/package.lisp
org.melusina.webmachine/src/utilities.lisp
org.melusina.webmachine/src/configuration.lisp
org.melusina.webmachine/src/condition.lisp
org.melusina.webmachine/src/content.lisp
org.melusina.webmachine/src/request.lisp
org.melusina.webmachine/src/reply.lisp
org.melusina.webmachine/src/request-method.lisp
org.melusina.webmachine/src/media-type.lisp
org.melusina.webmachine/src/path.lisp
org.melusina.webmachine/src/resource.lisp
org.melusina.webmachine/src/constant-resource.lisp
org.melusina.webmachine/src/directory-resource.lisp
org.melusina.webmachine/src/file-resource.lisp
org.melusina.webmachine/src/acceptor.lisp
org.melusina.webmachine/org.melusina.webmachine.asd
org.melusina.webmachine
(system).
org.melusina.webmachine/src/utilities.lisp
src
(module).
*file-content-type-rules*
(special variable).
*file-content-type-table*
(special variable).
file-content-type
(function).
send-file-contents
(function).
string-match
(function).
org.melusina.webmachine/src/configuration.lisp
src
(module).
*catch-errors*
(special variable).
org.melusina.webmachine/src/condition.lisp
src
(module).
http-condition
(condition).
http-condition-short-description
(function).
http-condition-status-code
(reader method).
http-error
(function).
http-error
(condition).
print-object
(method).
status-code-short-description
(function).
org.melusina.webmachine/src/content.lisp
src
(module).
make-content-output-stream
(function).
with-content-output-to-sequence
(macro).
org.melusina.webmachine/src/request.lisp
src
(module).
connect-request
(class).
delete-request
(class).
get-request
(class).
head-request
(class).
options-request
(class).
patch-request
(class).
post-request
(class).
put-request
(class).
request
(class).
trace-request
(class).
with-path-parameters
(macro).
parameter-value
(function).
org.melusina.webmachine/src/reply.lisp
src
(module).
application-reply
(class).
application/json-reply
(class).
application/octet-stream-reply
(class).
audio-reply
(class).
font-reply
(class).
image-reply
(class).
image/jpeg-reply
(class).
image/png-reply
(class).
image/svg+xml-reply
(class).
model-reply
(class).
reply
(class).
reply-media-type
(reader method).
text-reply
(class).
text/css-reply
(class).
text/html-reply
(class).
text/javascript-reply
(class).
text/plain-reply
(class).
video-reply
(class).
org.melusina.webmachine/src/request-method.lisp
src
(module).
define-request-method
(macro).
describe-request-methods
(function).
find-request-method
(function).
initialize-instance
(method).
list-request-methods
(function).
make-request-method
(function).
print-object
(method).
remove-request-method
(function).
request-method
(class).
request-method-name
(function).
request-method-p
(function).
*request-method-repository*
(special variable).
*request-method-repository-initial-content*
(special variable).
org.melusina.webmachine/src/media-type.lisp
src
(module).
define-media-type
(macro).
describe-media-types
(function).
find-media-type
(function).
initialize-instance
(method).
list-media-types
(function).
make-media-type
(function).
media-type
(class).
media-type-description
(reader method).
media-type-name
(reader method).
media-type-p
(function).
print-object
(method).
remove-media-type
(function).
*media-type-repository*
(special variable).
org.melusina.webmachine/src/path.lisp
src
(module).
path-parameters
(function).
match-path
(function).
parse-path
(function).
path-regex
(function).
tokenize
(function).
org.melusina.webmachine/src/resource.lisp
src
(module).
find-resource
(function).
initialize-instance
(method).
print-object
(method).
remove-resource
(function).
resource
(function).
(setf resource)
(function).
resource
(class).
resource-allowed-methods
(generic function).
resource-authorized-p
(generic function).
resource-available-p
(generic function).
resource-charsets-provided
(generic function).
resource-content-types-provided
(generic function).
resource-encodings-provided
(generic function).
resource-exists-p
(generic function).
resource-flexible-negotiation-p
(generic function).
resource-forbidden-p
(generic function).
resource-handle-request-p
(generic function).
resource-known-methods
(generic function).
resource-languages-provided
(generic function).
resource-name
(reader method).
resource-options
(generic function).
resource-p
(function).
resource-path
(reader method).
resource-payload-too-large-p
(generic function).
resource-uri-too-long-p
(generic function).
resource-valid-content-headers-p
(generic function).
resource-valid-content-type-p
(generic function).
resource-valid-request-p
(generic function).
resources
(function).
(setf resources)
(function).
write-resource-response
(generic function).
*resource-repository*
(special variable).
negotiate-accept
(function).
negotiate-accept-charset
(function).
negotiate-accept-encoding
(function).
negotiate-accept-language
(function).
parse-header-accept-*
(function).
resource-handle-request
(function).
org.melusina.webmachine/src/constant-resource.lisp
src
(module).
constant-resource
(class).
define-constant-resource
(macro).
initialize-instance
(method).
make-constant-resource
(function).
resource-allowed-methods
(method).
resource-authorized-p
(method).
resource-available-p
(method).
resource-charsets-provided
(method).
resource-content-types-provided
(method).
resource-encodings-provided
(method).
resource-flexible-negotiation-p
(method).
resource-forbidden-p
(method).
resource-known-methods
(method).
resource-languages-provided
(method).
resource-options
(method).
resource-payload-too-large-p
(method).
resource-uri-too-long-p
(method).
resource-valid-content-headers-p
(method).
resource-valid-content-type-p
(method).
resource-valid-request-p
(method).
write-resource-response
(method).
register-constant-resource
(function).
org.melusina.webmachine/src/directory-resource.lisp
src
(module).
directory-resource
(class).
initialize-instance
(method).
make-directory-resource
(function).
print-object
(method).
resource-allowed-methods
(method).
resource-content-types-provided
(method).
resource-exists-p
(method).
resource-flexible-negotiation-p
(method).
resource-forbidden-p
(method).
resource-handle-request-p
(method).
resource-valid-request-p
(method).
write-resource-response
(method).
org.melusina.webmachine/src/file-resource.lisp
src
(module).
file-resource
(class).
initialize-instance
(method).
make-file-resource
(function).
print-object
(method).
resource-allowed-methods
(method).
resource-content-types-provided
(method).
resource-exists-p
(method).
resource-flexible-negotiation-p
(method).
resource-forbidden-p
(method).
resource-handle-request-p
(method).
write-resource-response
(method).
org.melusina.webmachine/src/acceptor.lisp
src
(module).
acceptor
(class).
acceptor-dispatch-request
(method).
describe-object
(method).
make-acceptor
(function).
ssl-acceptor
(class).
acceptor-server-name
(method).
Packages are listed by definition order.
webmachine
common-lisp
.
*catch-errors*
(special variable).
acceptor
(class).
application-reply
(class).
application/json-reply
(class).
application/octet-stream-reply
(class).
audio-reply
(class).
connect-request
(class).
constant-resource
(class).
define-constant-resource
(macro).
define-media-type
(macro).
define-request-method
(macro).
delete-request
(class).
describe-media-types
(function).
describe-request-methods
(function).
directory-resource
(class).
file-resource
(class).
find-media-type
(function).
find-request-method
(function).
find-resource
(function).
font-reply
(class).
get-request
(class).
head-request
(class).
http-condition
(condition).
http-condition-short-description
(function).
http-condition-status-code
(generic reader).
http-error
(function).
http-error
(condition).
image-reply
(class).
image/jpeg-reply
(class).
image/png-reply
(class).
image/svg+xml-reply
(class).
list-media-types
(function).
list-request-methods
(function).
make-acceptor
(function).
make-constant-resource
(function).
make-content-output-stream
(function).
make-directory-resource
(function).
make-file-resource
(function).
make-media-type
(function).
make-request-method
(function).
media-type
(class).
media-type-description
(generic reader).
media-type-name
(generic reader).
media-type-p
(function).
model-reply
(class).
options-request
(class).
patch-request
(class).
path-parameters
(function).
post-request
(class).
put-request
(class).
remove-media-type
(function).
remove-request-method
(function).
remove-resource
(function).
reply
(class).
reply-media-type
(generic reader).
request
(class).
request-method
(class).
request-method-name
(function).
request-method-p
(function).
resource
(function).
(setf resource)
(function).
resource
(class).
resource-allowed-methods
(generic function).
resource-authorized-p
(generic function).
resource-available-p
(generic function).
resource-charsets-provided
(generic function).
resource-content-types-provided
(generic function).
resource-encodings-provided
(generic function).
resource-exists-p
(generic function).
resource-flexible-negotiation-p
(generic function).
resource-forbidden-p
(generic function).
resource-handle-request-p
(generic function).
resource-known-methods
(generic function).
resource-languages-provided
(generic function).
resource-name
(generic reader).
resource-options
(generic function).
resource-p
(function).
resource-path
(generic reader).
resource-payload-too-large-p
(generic function).
resource-uri-too-long-p
(generic function).
resource-valid-content-headers-p
(generic function).
resource-valid-content-type-p
(generic function).
resource-valid-request-p
(generic function).
resources
(function).
(setf resources)
(function).
ssl-acceptor
(class).
text-reply
(class).
text/css-reply
(class).
text/html-reply
(class).
text/javascript-reply
(class).
text/plain-reply
(class).
trace-request
(class).
video-reply
(class).
with-content-output-to-sequence
(macro).
with-path-parameters
(macro).
write-resource-response
(generic function).
*file-content-type-rules*
(special variable).
*file-content-type-table*
(special variable).
*media-type-repository*
(special variable).
*request-method-repository*
(special variable).
*request-method-repository-initial-content*
(special variable).
*resource-repository*
(special variable).
file-content-type
(function).
match-path
(function).
negotiate-accept
(function).
negotiate-accept-charset
(function).
negotiate-accept-encoding
(function).
negotiate-accept-language
(function).
parameter-value
(function).
parse-header-accept-*
(function).
parse-path
(function).
path-regex
(function).
register-constant-resource
(function).
resource-handle-request
(function).
send-file-contents
(function).
status-code-short-description
(function).
string-match
(function).
tokenize
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
If non-NIL, catch any error and explain them to the client.
If T (the default), *any* erroneous conditions that are a *fault of
the server and not of the user-agent*, including errors *and* HTTP
500-class conditions voluntarily signalled by the program logic, will
still result in a response to the user-agent.
To compose this response, Webmachine will first try EXPLAIN-CONDITION to
“politely” explain the condition in a format accepted by the user-agent, as
indicated in the :ACCEPT header. If that fails, the error is presented very
succintly to the client.
If set to NIL, errors will bubble up out of Webmachine and possible land you in the debugger. This option is also useful during development if you prefer an interactive debugger
Define a constant resource.
Define a media-type with the given NAME and ARGS.
Define a request-method with the given IDENTIFIER and ARGS.
Create an in-memory content output stream for reply content and bind VAR to it in BODY. The return value of this macro is a vector containing the octets resulting from writing to VAR within BODY.
Run BODY in an environment where PARAMETERS are bound to REQUEST.
The PARAMETERS are either a Symbol, which then associated to a parameter
of the same name, or a list with two elements, a Symbol and a parameter name.
A text holding the description of every known media type.
A text holding the description of every known request method.
Find a media-type whose name matches DESIGNATOR.
When a media type corresponding to DESIGNATOR is found, this request
method is returned, otherwise NIL is returned. The DESIGNATOR can be a string,
a keyword, a request-method, or a symbol.
Find a request-method whose identifier matches DESIGNATOR.
When a request method corresponding to DESIGNATOR is found, this request
method is returned, otherwise NIL is returned. The DESIGNATOR can be a string,
a keyword, a request-method, or a symbol.
Find a resource whose name matches DESIGNATOR.
The DESIGNATOR can be a string, a keyword, a resource, or a symbol.
The short description of HTTP-CONDITION.
Signal a HTTP-ERROR with the given STATUS-CODE and SHORT-DESCRIPTION.
A list of designators of all media types known to the system.
A list of designators of all request-methods known to the system.
Make a Webmachine acceptor.
Make a CONSTANT-RESOURCE with provided details.
Make a content output stream writing to the underlying RAW-OUTPUT-STREAM.
The final output stream takes care of writing characters using the
specified EXTERNAL-FORMAT and of applying the given ENCODING.
Accepted values for EXTERNAL-FORMAT are external format designators
as recognised by the flexi-streams library. Accepted values for the
ENCODING parameter are
:IDENTITY :GZIP :DEFLATE and :COMPRESS
Make a DIRECTORY-RESOURCE with provided details.
Make a FILE-RESOURCE with provided details.
Make a media-type with the given NAME and ARGS.
Make a request-method with the given IDENTIFIER and ARGS.
Predicate recognising media types.
The list of keyword parameters bound in a PATH.
Remove media type from the repository of known media types. Return T if there was such an entry, or NIL if not.
Remove request method from the repository of known request methods. Return T if there was such an entry, or NIL if not.
Remove a resource from resource repository.
The name of a request method.
Predicate recognising request-methods.
The resource named NAME.
Predicate recognising resources.
http-condition
)) ¶media-type
)) ¶A description of the media-type. If present, this description can be inserted in automatically generated documents.
media-type
)) ¶A string representing the MEDIA-TYPE.
name
.
The list of allowed methods on a resource.
A request to this resource whose method is not included in the returned
list will result in a 405 Method Not Allowed. The response will include
an :ALLOW header that lists the allowed methods. (V3B10)
The HyperText Transfer Protocol (HTTP) 405 Method Not Allowed response
status code indicates that the request method is known by the server but
is not supported by the target resource.
The server MUST generate an Allow header field in a 405 response containing a list of the target resource’s currently supported methods.
The method combination for this generic function is the standard one. Generic resources allow :GET and :HEAD resources.
file-resource
)) ¶directory-resource
)) ¶constant-resource
)) ¶This predicate recognises if a request is authorized.
When a request is unauthorized, the resource answers that request with a
401 Unauthorized. (V3B8)
The HTTP 401 Unauthorized client error status response code indicates
that the request has not been applied because it lacks valid
authentication credentials for the target resource.
This status is sent with a WWW-Authenticate header that contains
information on how to authorize correctly.
This status is similar to 403, but in this case, authentication is possible.
Generic resources accept all requests.
constant-resource
) request) ¶This predicate recognises if a resource is available.
When a resource is not available, requests it handles are answered
with a 503 Service Unavailable status code. (V3B13)
The method combination for this generic function is AND, so that
compound resources are unavailable if a participating resource
is unavailable.
Generic resources are always available.
and
.
:most-specific-first
constant-resource
)) ¶Content negociation for accepted charsets.
This should return a list of charsets or external formats designators.
Content negotiation is driven by this return value. For example, if a
client request includes an :ACCEPT-CHARSET header with a value that does
not appear as a first element in any of the return tuples, then a 406
Not Acceptable will be sent.
Default: (:utf-8)
constant-resource
) request) ¶Content negociation for accepted content types.
This should return a list of accepted media types designators. Content
negotiation is driven by this return value.
For example, if a client request includes an :ACCEPT header with a value
that does not appear in the list of content types provided, then a 406
Not Acceptable will be sent.
When a second value is supplied, this value is used as the result of a failed negotiation instead of returning 406.
file-resource
) request) ¶directory-resource
) request) ¶constant-resource
) request) ¶Content negociation for accepted encodings.
This should return a list of encoding designators. Content negotiation
is driven by this return value. For example, if a client request
includes an :ACCEPT-ENCODING header with a value that does not appear as
a first element in any of the return tuples, then a 406 Not Acceptable
will be sent.
Default: (:identity)
constant-resource
) request) ¶This predicate recognises if a resource exists.
When a resource does not exist, requests it handles are answered
with a 404 Not found status code, in most cases. (V3G7)
The method combination for this generic function is AND, so that
compound resources only exists if every participating resource
exist.
Generic resources always exist.
and
.
:most-specific-first
file-resource
) request) ¶directory-resource
) request) ¶Predicate recognising flexible negotiation situations.
When a flexible negotiation situation is recognised, the Webmachine
chooses to requalify client’s preferences instead to avoid returning
a 406 Not Acceptable status code. Instead it uses the first option
provided as if it were accpetable by the client.
file-resource
) request) ¶directory-resource
) request) ¶constant-resource
) request) ¶This predicate recognises if a request tries to access a forbidden resource.
When access to a resource is forbidden, the resource answers that
request with a 403 Forbidden. (V3B7)
The HTTP 403 Forbidden client error status response code indicates that
the server understood the request but refuses to authorize it.
This status is similar to 401, but in this case, re-authenticating will
make no difference. The access is permanently forbidden and tied to the
application logic, such as insufficient rights to a resource.
The method combination for this generic function is OR, so that an
access is forbidden for a compound resource if a participating resource
considers the access is forbidden.
Generic resources consider no access to be forbidden.
or
.
:most-specific-first
file-resource
) request) ¶directory-resource
) request) ¶constant-resource
) request) ¶This predicate recognises if RESOURCE wants to handle REQUEST.
file-resource
) request) ¶directory-resource
) request) ¶The list of HTTP methods supported by the resource.
When a resource does not support the HTTP method of a request, that
request is answered with a 501 Not Implemented status code. (V3B12)
The HyperText Transfer Protocol (HTTP) 501 Not Implemented server error
response code indicates that the server does not support the
functionality required to fulfill the request. This is the appropriate
response when the server does not recognize the request method and is
not capable of supporting it for any resource. The only request methods
that servers are required to support (and therefore that must not return
this code) are :GET and :HEAD.
The method combination for this generic function is APPEND, so that
compound resources support all methods supported by participating
resources.
The default value presents the de facto standard list of HTTP methods
but could be extendend to implement HTTP extensions. The actual
list is:
:GET :HEAD :POST :PUT :DELETE :TRACE :CONNECT and :OPTIONS
This must not be confused with the ‘resource-allowed-methods’ method.
append
.
:most-specific-first
constant-resource
)) ¶Content negociation for accepted languages.
This should return or list of languages, where each language is
identified by a string.
When a request has invalid accept language headers, the resource answers that request with a 406 Not Acceptable. (V3D5)
constant-resource
) request) ¶Headers to put in the answer of an :OPTIONS request.
If the OPTIONS method is supported and is used, the return value of
this function is expected to be an alist of pairs representing header
names and values that should appear in the response.
The method combination for this generic function is APPEND, so that compound resources support all methods supported by participating resources. When several values for the same header are provided, only the header value defined by the most specialised class is used.
append
.
:most-specific-first
constant-resource
) request) ¶resource
)) ¶The URI PATH where the resource is located.
The PATH is a list of strings and keyword. A string matches itself in
the URI PATH and a keyword matches a non-empty string made of characters
in the range [A-Za-z0-9_-] whose value shoud be bound to the parameter
denoted by the keyword.
path
.
This predicate recognises if a request entity is too large.
When a request entity is too large, the resource answers that request
with a 413 Payload Too Large. (V3B4)
The HTTP 413 Payload Too Large response status code indicates that the request entity is larger than limits defined by server; the server might close the connection or return a Retry-After header field.
constant-resource
) request) ¶This predicate recognises if a URI is too long.
When a URI of request is too long, the resource answers that request
with a 414 Request-URI Too Long. (V3B11)
The HTTP 414 URI Too Long response status code indicates that the URI
requested by the client is longer than the server is willing to
interpret.
There are a few rare conditions when this might occur:
- when a client has improperly converted a POST request to a GET
request with long query information,
- when the client has descended into a loop of redirection (for example, a redirected URI prefix that points to a suffix of itself),
- or when the server is under attack by a client attempting to exploit
potential security holes.
Generic resources accept all URI resources length.
constant-resource
) request) ¶This predicate recognises if a request bears valid Content-* headers.
When a request has invalid content headers, the resource answers that
request with a 501 Not Implemented. (V3B6)
The HTTP 501 Not Implemented server error response code indicates that
the server does not support the functionality required to fulfill the
request. This is the appropriate response when the server does not
recognize the request method and is not capable of supporting it for any
resource. The only request methods that servers are required to
support (and therefore that must not return this code) are :GET and
:HEAD.
The method combination for this generic function is AND, so that a
request has valid content headers for a compound resource if all
participating resources consider the request to have valid content
headers.
Generic resources accept all requests.
and
.
:most-specific-first
constant-resource
) request) ¶This predicate recognises if a request bears valid content type.
When a request has invalid content type, the resource answers that
request with a 415 Unsupported Media Type. (V3B5)
The HTTP 415 Unsupported Media Type client error response code indicates
that the server refuses to accept the request because the payload format
is in an unsupported format.
The format problem might be due to the request’s indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly.
The method combination for this generic function is AND, so that
a request has valid content type for a compound resource if
all participating resources consider the request to have valid
content type.
Generic resources accept all requests.
and
.
:most-specific-first
constant-resource
) request) ¶This predicate recognises if a request is valid.
When a request is invalid, the resource answers that request with a 400
Bad Request. (V3B9)
The HyperText Transfer Protocol (HTTP) 400 Bad Request response status
code indicates that the server cannot or will not process the request
due to something that is perceived to be a client error (e.g., malformed
request syntax, invalid request message framing, or deceptive request
routing).
The method combination for this generic function is AND, so that a
request is valid for a compound resource if all participating resources
consider the request valid.
Generic resources accept all requests.
and
.
:most-specific-first
directory-resource
) request) ¶constant-resource
) request) ¶Write the RESOURCE response for REQUEST to RESPONSE-BODY.
The response must be represented as specificed by the content type of
the REPLY.
When this method returns a STRING, the string is used as a response and written to RESPONSE-BODY by Webmachine.
file-resource
) (request get-request
) (reply reply
) response-body) ¶directory-resource
) (request get-request
) (reply reply
) response-body) ¶constant-resource
) (request get-request
) (reply reply
) response-body) ¶acceptor
) request) ¶The “Webmachine” dispatcher selects service to handle a request.
hunchentoot
.
resource
) &rest initargs &key &allow-other-keys) ¶constant-resource
) &rest initargs &key &allow-other-keys) ¶media-type
) &rest initargs &key &allow-other-keys) ¶directory-resource
) &rest initargs &key &allow-other-keys) ¶request-method
) &rest initargs &key &allow-other-keys) ¶file-resource
) &rest initargs &key &allow-other-keys) ¶media-type
) stream) ¶directory-resource
) stream) ¶http-condition
) stream) ¶request-method
) stream) ¶file-resource
) stream) ¶A HTTP-CONDITION is signalled upon protocol errors.
A protocol error is transmitted to the client and the server
can continue normal operation.
simple-condition
.
Initarg | Value |
---|---|
:format-control | http condition |
(quote (error "a http-condition reqiures a status code."))
:status-code
This slot is read-only.
A HTTP-ERROR is signalled upon processing errors.
It indicates to the client that the server encountered an unexpected
condition that prevented it from fulfilling the request.
http-condition
.
simple-error
.
Initarg | Value |
---|---|
:format-control | internal server error |
:status-code | 500 |
This is the acceptor of the Webmachine framework.
acceptor
.
Initarg | Value |
---|---|
:request-class | (quote request) |
:reply-class | (quote reply) |
:document-root | nil |
:server-name | webmachine |
:resources | nil |
:error-template-directory | nil |
The RESOURCES served by the server.
:resources
The server name to return in Server headers.
:server-name
The REPLY subclass for content of general type.
:class
:application
The REPLY subclass for application/json content.
:class
:application/json
The REPLY subclass for application/octet-stream content.
:class
:application/octet-stream
The REPLY subclass for audio content.
:class
:audio
The CONNECT method establishes a tunnel to the server identified
by the target resource.
WWW: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT
A resource on which generic functions return a fixed value, corresponding to initialisation parameters of the instance. Such a resource is useful for testing.
initialize-instance
.
resource-allowed-methods
.
resource-authorized-p
.
resource-available-p
.
resource-charsets-provided
.
resource-content-types-provided
.
resource-encodings-provided
.
resource-flexible-negotiation-p
.
resource-forbidden-p
.
resource-known-methods
.
resource-languages-provided
.
resource-options
.
resource-payload-too-large-p
.
resource-uri-too-long-p
.
resource-valid-content-headers-p
.
resource-valid-content-type-p
.
resource-valid-request-p
.
write-resource-response
.
Initarg | Value |
---|---|
:available-p | t |
:uri-too-long-p | nil |
:payload-too-large-p | nil |
:allowed-methods | (quote (get head)) |
:known-methods | (quote (get head post put delete connect options trace patch)) |
:valid-request-p | t |
:authorized-p | t |
:forbidden-p | nil |
:valid-content-headers-p | t |
:valid-content-type-p | t |
:options | t |
:content-types-provided | (quote (text/plain)) |
:languages-provided | (quote (en-us)) |
:charsets-provided | (quote (utf-8)) |
:encodings-provided | (quote (identity)) |
:flexible-negotiation-p | nil |
:response | (quote ((text/plain . a constant resource.))) |
The return value of the ‘RESOURCE-AVAILABLE-P’ generic function.
:available-p
The return value of the ‘RESOURCE-KNOWN-METHODS’ generic function.
:known-methods
The return value of the ‘RESOURCE-URI-TOO-LONG-P’ generic function.
:uri-too-long-p
The return value of the ‘RESOURCE-PAYLOAD-TOO-LARGE-P’ generic function.
:payload-too-large-p
The return value of the ‘RESOURCE-ALLOWED-METHODS’ generic function.
:allowed-methods
The return value of the ‘RESOURCE-VALID-REQUEST-P’ generic function.
:valid-request-p
The return value of the ‘RESOURCE-AUTHORIZED-P’ generic function.
:authorized-p
The return value of the ‘RESOURCE-FORBIDDEN-P’ generic function.
:forbidden-p
The return value of the ‘RESOURCE-VALID-CONTENT-HEADERS-P’ generic function.
:valid-content-headers-p
The return value of the ‘RESOURCE-VALID-CONTENT-TYPE-P’ generic function.
:valid-content-type-p
The return value of the ‘RESOURCE-OPTIONS’ generic function.
t
:options
The return value of the ‘RESOURCE-CONTENT-TYPES-PROVIDED’ generic function.
(quote (:text/html))
:content-types-provided
The return value of the ‘RESOURCE-LANGUAGES-PROVIDED’ generic function.
:languages-provided
The return value of the ‘RESOURCE-CHARSETS-PROVIDED’ generic function.
:charsets-provided
The return value of the ‘RESOURCE-ENCODINGS-PROVIDED’ generic function.
:encodings-provided
The return value of the ‘RESOURCE-FLEXIBLE-NEGOTIATION-P’ generic function.
:flexible-negotiation-p
The response for the constant resources.
The response can be one of the following
- A string, which is sent to the client.
- A function of a stream, which is responsible for writing
the response body in the provided stream.
- An alist mapping content-types to strings or functions, with
the same convention as above.
:response
The DELETE method deletes the specified resource.
WWW: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE
A ‘DIRECTORY-RESOURCE’ map any part of the filesystem into the web space.
It is similar to Apache’s Alias feature. The content of the directory is only
read once after the resource is created.
The request URI is validated using ‘HUNCHENTOOT::PARSE-PATH’ so that it
does not contain directory traversals, explicit devices not host fields.
When the URI of a request fails to validate, a Bad Request status
is returned.
The served CONTENT-TYPE is inferred from the name of the file requested, based on the CONTENT-TYPE-RULES slot.
The directory owning the files served by the resource. This must be a PATHNAME designating a directory.
:alias
A ‘FILE-RESOURCE’ map a regular file into the web space.
The request URI is validated using ‘HUNCHENTOOT::PARSE-PATH’ so that it
does not contain directory traversals, explicit devices not host fields.
When the URI of a request fails to validate, a Bad Request status
is returned.
The served CONTENT-TYPE is inferred from the name of the file requested, based on the CONTENT-TYPE-RULES slot.
The REPLY subclass for font or typeface content.
:class
:font
The GET method requests a representation of the specified resource.
Requests using GET should only retrieve data.
WWW: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET
The HEAD method asks for a response nearly identical to that of a GET request,
but without the response body.
WWW: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD
The REPLY subclass for image content.
:class
:image
The REPLY subclass for image/jpeg content.
:class
:image/jpeg
The REPLY subclass for image/png content.
:class
:image/png
The REPLY subclass for image/svg+xml content.
:class
:image/svg+xml
This represents a MEDIA-TYPE.
A string representing the MEDIA-TYPE.
(error "no media-type name.")
:name
This slot is read-only.
A keyword representing the MEDIA-TYPE.
(error "no media-type identifier.")
:identifier
The class to use to subtype replies with this content type.
(quote webmachine::application)
:reply-class
A description of the media-type. If present, this description can be inserted in automatically generated documents.
:description
This slot is read-only.
The REPLY subclass for 3D model content.
:class
:model
The OPTIONS method is used to describe the communication options
for the target resource.
WWW: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS
The PATCH method is used to apply partial modifications to a resource. WWW: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH
The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server. WWW: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST
The PUT method replaces all current representations of the target resource
with the request payload.
WWW: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT
Objects of this class hold all the information
about an outgoing reply. They are created automatically by
Webmachine and can be accessed and modified by the corresponding
handler.
reply
.
:class
:application
This slot is read-only.
Objects of this class hold all the information
about an incoming request. They are created automatically by
acceptors and can be accessed by the corresponding handler.
request
.
The alist of parameters inferred by the path.
:path-parameters
The negotiated language for the request.
When this parameter is non NIL, it it set by the content negotiation and
the client expects the returned content to be in that language.
:language
The negotiated charset for the request.
When this parameter is not NIL it is set by the content negotiation
and the client expects the returned content to be prepared using
this charset.
:charset
The negotiated encoding for the request.
When this parameter is non NIL, it is set by the content negotiation
and the client expects the returned content to be encoded using
the corresponding function.
The possible values for this field are:
NIL, :IDENTITY, :GZIP, :DEFLATE, and :COMPRESS.
:charset
This a request method for the HTTP protocol.
A string representing the REQUEST-METHOD.
(error "no request-method identifier.")
:identifier
The specialized class of requests associated to this method.
(quote webmachine:request)
:request-class
A flag identifying request-methods associated with destructive operations.
(error "no request-method destructive-p flag.")
:destructive-p
A description of the request-method, this description can be inserted in automatically generated documents.
"i am too lazy to describe this request-method."
:description
Resources with HTTP Protocol semantics.
The NAME of the resource.
This NAME is used in logging artefacts and introspective
presentations, to ease maintenance of the program.
(error "no resource name.")
:name
This slot is read-only.
The URI PATH where the resource is located.
The PATH is a list of strings and keyword. A string matches itself in
the URI PATH and a keyword matches a non-empty string made of characters
in the range [A-Za-z0-9_-] whose value shoud be bound to the parameter
denoted by the keyword.
:path
This slot is read-only.
This is an acceptor that accepts SSL connections.
acceptor
.
ssl-acceptor
.
The REPLY subclass for text content.
:class
:text
The REPLY subclass for text/css content.
:class
:text/css
The REPLY subclass for text/html content.
:class
:text/html
The REPLY subclass for text/javascript content.
:class
:text/javascript
The REPLY subclass for text/plain content.
:class
:text/plain
The TRACE method performs a message loop-back test along the path
to the target resource.
WWW: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/TRACE
The REPLY subclass for video content.
:class
:video
The table of all media-types.
When a media-type is defined, it is added to this table, using
its IDENTIFIER as the key.
A repository for request methods.
When a request-method is defined, it is added to this table, using its identifier–a keyword–as the key.
The table of all resources.
When a resource is defined, it is added to this table, using
the NAME as the key.
Guess content-type for PATHNAME.
Match URI against the PATH pattern.
If the URI matches PATH then T and an alist mapping parameters to
the corresponding text are returned as multiple values. In this
alist, the character name is used as a key. The key to a star
parameter is the keyword :RELATIVE-PATH.
If the URI does not match PATH, then NIL is returned.
Negotiate the :ACCEPT content type.
The ACCEPT parameter is an alist of (MEDIA-TYPE . QUALITY) sorted by decreasing
quality. The OFFER parameter is a list of acceptable MEDIA-TYPE values. The result
of the negotiation is the MEDIA-TYPE that best matches the ACCEPT parameter, or NIL.
Negotiate the :ACCEPT-CHARSET charset.
The ACCEPT parameter is an alist of (CHARSET . QUALITY) sorted by
decreasing quality. The OFFER parameter is a list of CHARSET. The
result of the negotiation is the CHARSET that best matches the ACCEPT
parameter, or NIL.
Negotiate the :ACCEPT-ENCODING encoding.
The ACCEPT parameter is an alist of (ENCODING . QUALITY) sorted by
decreasing quality. The OFFER parameter is a list of ENCODING. The
result of the negotiation is the ENCODING that best matches the ACCEPT
parameter, or NIL.
Negotiate the :ACCEPT-LANGUAGE language.
The ACCEPT parameter is an alist of (LANGUAGE . QUALITY) sorted by
decreasing quality. The OFFER parameter is a list of LANGUAGE
designators. The result of the negotiation is a LANGUAGE designator that
best matches the ACCEPT parameter, or NIL.
The value associated to NAME in request.
When NAME has no associated value, a status code 400 Bad Request is
returned.
Parse an :ACCEPT-* header.
The response is an alist of (DESIGNATOR . QUALITY) sorted by decreasing
quality. (This is a stable sort.)
Parse the CONCRETE-PATH into a list of PATH rules.
A path rule is either
- A STRING, matching itself;
- A KEYWORD, matching a safe string in the URI Path;
- A BOOLEAN, only allowed in the last place, indicating a greedy path.
Example valid concrete paths are
"/"
"/chrome/bootstrap/*"
"/user/:id"
"/user/:id/activity/*"
Note: Safe strings are made of the characters in the range [A-Za-z0-9_-]. Note: It is an error to use :RELATIVE-PATH as a keword in the CONCRETE-PATH.
Map the symbolic PATH to a PPCRE matching corresponding URI paths. Parameters are transformed to registers.
Handle the REQUEST using RESOURCE and sending back the REPLY. This walks down the decision graph of the Webmachine.
Send file contents of PATHNAME on stream RESPONSE-BODY.
Fail with Status code 500 when the file cannot be read. It assumes that the ability to read the file has been otherwise verified and that the file hence has been removed, which is an application logic error or an environmental error.
The short description associated with STATUS-CODE.
Predicate recognising TEXT matching a globbing PATTERN.
Tokenize TEXT according to TOKEN-SPEC.
The TOKEN-SPEC is an alist mapping token class names to a regular
expression matching tokens of that class. The tokenization process
scans repeatedly the text using the provided regular expressions, and
returns a list of pairs whose first element is the token class name and
the second element the token text.
Jump to: | (
A D F G H I L M N P R S T W |
---|
Jump to: | (
A D F G H I L M N P R S T W |
---|
Jump to: | *
A C D E F I K L M N O P R S U V |
---|
Jump to: | *
A C D E F I K L M N O P R S U V |
---|
Jump to: | A C D F G H I M O P R S T U V W |
---|
Jump to: | A C D F G H I M O P R S T U V W |
---|