Response ΒΆ
API
-
[function]
name value
Use this function to add a
HTTP
header:(add-header :x-request-id 100500)
-
[function]
uri &key (retpath (get-uri))
Adds a "retpath"
GET
parameter to the givingURL
.Keeps all other parameters and overwrites "retpath" parameter if it is already exists in the
URL
.By default, retpath is the current page, rendered by the reblocks. This is very useful to redirect user to login page and return him to the same page where he has been before.
-
[reader]
(:code = 200)
HTTP
status code to return in response to request.By default, this slot will be set to 200.
-
[reader]
(:content = "")
A string with a content of the response.
-
[reader]
(:content-type = (get-default-content-type-for-response))
HTTP
content type to return in response to request.By default, have text/html value for usual requests and application/json for
AJAX
requests.
-
[reader]
(:custom-headers = nil)
Custom
HTTP
headers of request.By default, this slot will be set to 200.
- [function] response
- [reader] (:response)
-
[function]
content &key (content-type
(get-default-content-type-for-response)) (code 200) (headers \*custom-headers\*)
(condition-class 'immediate-response)
Aborts request processing by signaling an
immediate-response
and returns a given value as response.HTTP
code and headers are taken fromCODE
andCONTENT-TYPE
.
- [function] content &key (code 200) (content-type (get-default-content-type-for-response)) (headers \*custom-headers\*)
-
[function]
new-path
Makes a new
URL
, based on the current request'sURL
.If new-path can be absolute, like /logout or relative, like ./stories.
Also, it can contain a query params like /login?code=100500
-
[function]
script &optional (place :after-load)
Send JavaScript to the browser. The way of sending depends on whether the current request is via
AJAX
or not.Script may be either a string or a list; if it is a list it will be compiled through Parenscript first.