Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the caveman Reference Manual, version 12.8.0, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 11:55:17 2020 GMT+0.
• Introduction | What caveman is all about | |
• Systems | The systems documentation | |
• Modules | The modules documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
(defparameter *web* (make-instance '<app>))
@route GET "/"
(defun index ()
(render #P"index.tmpl"))
@route GET "/hello"
(defun say-hello (&key (|name| "Guest"))
(format nil "Hello, ~A" |name|))
Everything. Caveman2 was written from scratch.
These are noteworthy points.
One of the most frequently asked questions was "Which should I use: ningle or Caveman? What are the differences?" I think these were asked so frequently because Caveman and ningle were too similar. Both of them are called "micro", and had no database support.
With Caveman2, Caveman is no longer a "micro" web application framework. It supports CL-DBI, and has database connection management by default. Caveman has started growing up.
Caveman is intended to be a collection of common parts of web applications. With Caveman2, I use three rules to make decisions:
You came here because you're interested in living like a caveman, right? This isn't Disneyland, but we can start here. Let's get into a cave!
Caveman2 is now available on Quicklisp.
(ql:quickload :caveman2)
(caveman2:make-project #P"/path/to/myapp/"
:author "<Your full name>")
;-> writing /path/to/myapp/.gitignore
; writing /path/to/myapp/README.markdown
; writing /path/to/myapp/app.lisp
; writing /path/to/myapp/db/schema.sql
; writing /path/to/myapp/shlyfile.lisp
; writing /path/to/myapp/myapp-test.asd
; writing /path/to/myapp/myapp.asd
; writing /path/to/myapp/src/config.lisp
; writing /path/to/myapp/src/db.lisp
; writing /path/to/myapp/src/main.lisp
; writing /path/to/myapp/src/view.lisp
; writing /path/to/myapp/src/web.lisp
; writing /path/to/myapp/static/css/main.css
; writing /path/to/myapp/t/myapp.lisp
; writing /path/to/myapp/templates/_errors/404.html
; writing /path/to/myapp/templates/index.tmpl
; writing /path/to/myapp/templates/layout/default.tmpl
Caveman2 provides 2 ways to define a route -- @route
and defroute
. You can use either.
@route
is an annotation macro, defined by using cl-annot. It takes a method, a URL-string, and a function.
@route GET "/"
(defun index ()
...)
;; A route with no name.
@route GET "/welcome"
(lambda (&key (|name| "Guest"))
(format nil "Welcome, ~A" |name|))
This is similar to Caveman1's @url
except for its argument list. You don't have to specify an argument when it is not required.
defroute
is just a macro. It provides the same functionality as @route
.
(defroute index "/" ()
...)
;; A route with no name.
(defroute "/welcome" (&key (|name| "Guest"))
(format nil "Welcome, ~A" |name|))
Since Caveman bases on ningle, Caveman also has the Sinatra-like routing system.
;; GET request (default)
@route GET "/" (lambda () ...)
(defroute ("/" :method :GET) () ...)
;; POST request
@route POST "/" (lambda () ...)
(defroute ("/" :method :POST) () ...)
;; PUT request
@route PUT "/" (lambda () ...)
(defroute ("/" :method :PUT) () ...)
;; DELETE request
@route DELETE "/" (lambda () ...)
(defroute ("/" :method :DELETE) () ...)
;; OPTIONS request
@route OPTIONS "/" (lambda () ...)
(defroute ("/" :method :OPTIONS) () ...)
;; For all methods
@route ANY "/" (lambda () ...)
(defroute ("/" :method :ANY) () ...)
Route patterns may contain "keywords" to put the value into the argument.
(defroute "/hello/:name" (&key name)
(format nil "Hello, ~A" name))
The above controller will be invoked when you access "/hello/Eitaro" or "/hello/Tomohiro", and name
will be "Eitaro" or "Tomohiro", as appropriate.
(&key name)
is almost same as a lambda list of Common Lisp, except it always allows other keys.
(defroute "/hello/:name" (&rest params &key name)
;; ...
)
Route patterns may also contain "wildcard" parameters. They are accessible by using splat
.
(defroute "/say/*/to/*" (&key splat)
; matches /say/hello/to/world
(format nil "~A" splat))
;=> (hello world)
(defroute "/download/*.*" (&key splat)
; matches /download/path/to/file.xml
(format nil "~A" splat))
;=> (path/to/file xml)
If you'd like to write use a regular expression in a URL rule, :regexp t
should work.
(defroute ("/hello/([\\w]+)" :regexp t) (&key captures)
(format nil "Hello, ~A!" (first captures)))
Normally, routes are tested for a match in the order they are defined, and only the first route matched is invoked, with the following routes being ignored. However, a route can continue testing for matches in the list, by including next-route
.
(defroute "/guess/:who" (&key who)
(if (string= who "Eitaro")
"You got me!"
(next-route)))
(defroute "/guess/*" ()
"You missed!")
You can return following formats as the result of defroute
.
Parameter keys containing square brackets ("[" & "]") will be parsed as structured parameters. You can access the parsed parameters as _parsed
in routers.
<form action="/edit">
<input type="name" name="person[name]" />
<input type="name" name="person[email]" />
<input type="name" name="person[birth][year]" />
<input type="name" name="person[birth][month]" />
<input type="name" name="person[birth][day]" />
</form>
(defroute "/edit" (&key _parsed)
(format nil "~S" (cdr (assoc "person" _parsed :test #'string=))))
;=> "((\"name\" . \"Eitaro\") (\"email\" . \"e.arrows@gmail.com\") (\"birth\" . ((\"year\" . 2000) (\"month\" . 1) (\"day\" . 1))))"
Blank keys mean they have multiple values.
<form action="/add">
<input type="text" name="items[][name]" />
<input type="text" name="items[][price]" />
<input type="text" name="items[][name]" />
<input type="text" name="items[][price]" />
<input type="submit" value="Add" />
</form>
(defroute "/add" (&key _parsed)
(format nil "~S" (assoc "items" _parsed :test #'string=)))
;=> "(((\"name\" . \"WiiU\") (\"price\" . \"30000\")) ((\"name\" . \"PS4\") (\"price\" . \"69000\")))"
Caveman uses Djula as its default templating engine.
{% extends "layouts/default.html" %}
{% block title %}Users | MyApp{% endblock %}
{% block content %}
<div id="main">
<ul>
{% for user in users %}
<li><a href="{{ user.url }}">{{ user.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endblock %}
(import 'myapp.view:render)
(render #P"users.html"
'(:users ((:url "/id/1"
:name "nitro_idiot")
(:url "/id/2"
:name "meymao"))
:has-next-page T))
If you want to get something from a database or execute a function using Djula you must explicity call list
when passing the arguments to render so that the code executes.
(import 'myapp.view:render)
(render #P"users.html"
(list :users (get-users-from-db)))
This is an example of a JSON API.
(defroute "/user.json" (&key |id|)
(let ((person (find-person-from-db |id|)))
;; person => (:|name| "Eitaro Fukamachi" :|email| "e.arrows@gmail.com")
(render-json person)))
;=> {"name":"Eitaro Fukamachi","email":"e.arrows@gmail.com"}
render-json
is a part of a skeleton project. You can find its code in "src/view.lisp".
Images, CSS, JS, favicon.ico and robot.txt in "static/" directory will be served by default.
/images/logo.png => {PROJECT_ROOT}/static/images/logo.png
/css/main.css => {PROJECT_ROOT}/static/css/main.css
/js/app/index.js => {PROJECT_ROOT}/static/js/app/index.js
/robot.txt => {PROJECT_ROOT}/static/robot.txt
/favicon.ico => {PROJECT_ROOT}/static/favicon.ico
You can change these rules by rewriting "PROJECT_ROOT/app.lisp". See Clack.Middleware.Static for detail.
Caveman adopts Envy as a configuration switcher. This allows definition of multiple configurations and switching between them according to an environment variable.
This is a typical example:
(defpackage :myapp.config
(:use :cl
:envy))
(in-package :myapp.config)
(setf (config-env-var) "APP_ENV")
(defconfig :common
`(:application-root ,(asdf:component-pathname (asdf:find-system :myapp))))
(defconfig |development|
`(:debug T
:databases
((:maindb :sqlite3 :database-name ,(merge-pathnames #P"test.db"
*application-root*)))))
(defconfig |production|
'(:databases
((:maindb :mysql :database-name "myapp" :username "whoami" :password "1234")
(:workerdb :mysql :database-name "jobs" :username "whoami" :password "1234"))))
(defconfig |staging|
`(:debug T
,@|production|))
Every configuration is a property list. You can choose the configuration which to use by setting APP_ENV
.
To get a value from the current configuration, call myapp.config:config
with the key you want.
(import 'myapp.config:config)
(setf (osicat:environment-variable "APP_ENV") "development")
(config :debug)
;=> T
When you add :databases
to the configuration, Caveman enables database support. :databases
is an association list of database settings.
(defconfig |production|
'(:databases
((:maindb :mysql :database-name "myapp" :username "whoami" :password "1234")
(:workerdb :mysql :database-name "jobs" :username "whoami" :password "1234"))))
db
in a package myapp.db
is a function for connecting to each databases configured the above. Here is an example.
(use-package '(:myapp.db :sxql :datafly))
(defun search-adults ()
(with-connection (db)
(retrieve-all
(select :*
(from :person)
(where (:>= :age 20))))))
The connection is alive during the Lisp session, and will be reused in every HTTP request.
retrieve-all
and the query language came from datafly and SxQL. See those sets of documentation for more information.
There are several special variables available during a HTTP request. *request*
and *response*
represent a request and a response. If you are familiar with Clack, these are instances of subclasses of Clack.Request and Clack.Response.
(use-package :caveman2)
;; Get a value of Referer header.
(http-referer *request*)
;; Set Content-Type header.
(setf (getf (response-headers *response* :content-type) "application/json")
;; Set HTTP status.
(setf (status *response*) 304)
If you would like to set Content-Type "application/json" for all "*.json" requests, next-route
can be used.
(defroute "/*.json" ()
(setf (getf (response-headers *response*) :content-type) "application/json")
(next-route))
(defroute "/user.json" () ...)
(defroute "/search.json" () ...)
(defroute ("/new.json" :method :POST) () ...)
Session data is for memorizing user-specific data. *session*
is a hash table that stores session data.
This example increments :counter
in the session, and displays it for each visitor.
(defroute "/counter" ()
(format nil "You came here ~A times."
(incf (gethash :counter *session* 0))))
Caveman2 stores session data in-memory by default. To change this, specify :store
to :session
in "PROJECT_ROOT/app.lisp".
This example uses RDBMS to store session data.
'(:backtrace
:output (getf (config) :error-log))
nil)
- :session
+ (:session
+ :store (make-dbi-store :connector (lambda ()
+ (apply #'dbi:connect
+ (myapp.db:connection-settings)))))
(if (productionp)
nil
(lambda (app)
NOTE: Don't forget to add :lack-session-store-dbi
as :depends-on
of your app. It is not a part of Clack/Lack.
See the source code of Lack.Session.Store.DBi for more information.
(import 'caveman2:throw-code)
(defroute ("/auth" :method :POST) (&key |name| |password|)
(unless (authorize |name| |password|)
(throw-code 403)))
To specify error pages for 404, 500 or such, define a method on-exception
of your app.
(defmethod on-exception ((app <web>) (code (eql 404)))
(declare (ignore app code))
(merge-pathnames #P"_errors/404.html"
*template-directory*))
Your application has functions named start
and stop
to start/stop your web application. This is a example that assumes that the name of your application is "myapp".
(myapp:start :port 8080)
As Caveman is based on Clack/Lack, you can choose which server to run on -- Hunchentoot, mod_lisp or FastCGI.
(myapp:start :server :hunchentoot :port 8080)
(myapp:start :server :fcgi :port 8080)
I recommend you use Hunchentoot on a local machine, and use FastCGI/Woo in a production environment.
You can also start your application by using clackup command.
$ ros install clack
$ which clackup
/Users/nitro_idiot/.roswell/bin/clackup
$ APP_ENV=development clackup --server :fcgi --port 8080 app.lisp
Though Caveman doesn't have a feature for hot deployment, Server::Starter -- a Perl module -- makes it easy.
$ APP_ENV=production start_server --port 8080 -- clackup --server :fcgi app.lisp
NOTE: Server::Starter requires the server to support binding on a specific fd, which means only :fcgi
and :woo
are the ones work with start_server
command.
To restart the server, send HUP signal (kill -HUP <pid>
) to the start_server
process.
Caveman outputs error backtraces to a file which is specified at :error-log
in your configuration.
(defconfig |default|
`(:error-log #P"/var/log/apps/myapp_error.log"
:databases
((:maindb :sqlite3 :database-name ,(merge-pathnames #P"myapp.db"
*application-root*)))))
(import 'cl-who:with-html-output-to-string)
(defroute "/" ()
(with-html-output-to-string (output nil :prologue t)
(:html
(:head (:title "Welcome to Caveman!"))
(:body "Blah blah blah."))))
;=> "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
; <html><head><title>Welcome to Caveman!</title></head><body>Blah blah blah.</body></html>"
(import 'cl-markup:xhtml)
(defroute "/" ()
(xhtml
(:head (:title "Welcome to Caveman!"))
(:body "Blah blah blah.")))
;=> "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html><head><title>Welcome to Caveman!</title></head><body>Blah blah blah.</body></html>"
{namespace myapp.view}
{template renderIndex}
<!DOCTYPE html>
<html>
<head>
<title>"Welcome to Caveman!</title>
</head>
<body>
Blah blah blah.
</body>
</html>
{/template}
(import 'myapp.config:*template-directory*)
(closure-template:compile-cl-templates (merge-pathnames #P"index.tmpl"
*template-directory*))
(defroute "/" ()
(myapp.view:render-index))
Licensed under the LLGPL License.
Next: Modules, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The caveman system |
Eitaro Fukamachi
LLGPL
Web Application Framework for Common Lisp
# Caveman - A micro web framework for Common Lisp
Caveman is a micro web framework for Common Lisp, based on [Clack](http://clacklisp.org).
* [https://github.com/fukamachi/caveman](https://github.com/fukamachi/caveman)
## Annoucement: Caveman2 Beta has released
Caveman2, the next major release, is now available on Quicklisp, though it is still BETA quality.
- [README for v2](https://github.com/fukamachi/caveman/blob/master/README.markdown)
## Usage
“‘common-lisp
@url GET "/hi"
(defun say-hi (params)
"Hello, World!")
“‘
## What’s Caveman
Caveman is a micro web framework on [Clack](http://clacklisp.org).
Why we should use "Framework" or something even if we already have Clack. You know Clack provides a very extensible environment for web application. We can build applications from isolated parts of Clack like kneading dough clay.
But Clack isn’t a real framework. If you say that Clack is a collection of cells, Caveman is a newborn baby. Caveman provides a minimum set for building web applications. You can decorate the baby as you like, of course, and also you can replace any parts in it.
Caveman has following features:
* Thin
* Extensible
* Easy to understand
## Installation
Caveman is available on [Quicklisp](https://www.quicklisp.org/beta/).
“‘common-lisp
(ql:quickload :caveman)
“‘
## Getting started
First, you have to generate a skeleton project.
“‘common-lisp
(caveman.skeleton:generate #p"lib/myapp/")
“‘
Then a project skeleton is generated at ‘lib/myapp/‘. The new project can be loaded and runs on this state.
“‘common-lisp
(ql:quickload :myapp)
(myapp:start)
“‘
Now you can access to http://localhost:5000/ and then Caveman may show you "Hello, Caveman!".
### Route
Caveman provides an useful annotation "@url" to define a controller (You don’t already know the meaning of "annotation"? Check [cl-annot](https://github.com/arielnetworks/cl-annot) out). It has same rules to [Clack.App.Route](http://quickdocs.org/clack/api#system-clack-app-route), it is an HTTP method paired with URL-matching pattern.
“‘common-lisp
@url GET "/"
(defun index (params) ...)
@url POST "/"
(defun index (params) ...)
@url PUT "/"
(defun index (params) ...)
@url DELETE "/"
(defun index (params) ...)
@url OPTIONS "/"
(defun index (params) ...)
;; For all methods
@url ANY "/"
(defun index (params) ...)
“‘
Route pattern may contain "keyword" to put the value into the argument.
“‘common-lisp
@url GET "/hello/:name"
(defun hello (params)
(format nil "Hello, ~A" (getf params :name)))
“‘
The above controller will be invoked when you access to "/hello/Eitaro" and "/hello/Tomohiro", and then ‘(getf params :name)‘ will be "Eitaro" and "Tomohiro".
Route patterns may also contain "wildcard" parameters. They are accessible to run ‘(getf params :splat)‘.
“‘common-lisp
@url GET "/say/*/to/*"
(defun say (params)
; matches /say/hello/to/world
(getf params :splat) ;=> ("hello" "world")
)
@url GET "/download/*.*"
(defun download ()
; matches /download/path/to/file.xml
(getf params :splat) ;=> ("path/to/file" "xml")
)
“‘
### Multiple values in params
If there are multiple values for the same key in query parameters (ex. ?item-id=1&item-id=2), the ‘param‘ would be like ‘(:|item-id| 1 :|item-id| 2)‘. However, ‘getf‘ will return only the first one.
“‘common-lisp
(getf ’(:|item-id| 1 :|item-id| 2) :|item-id|)
;=> 1
“‘
For getting both of them as a list, [multival-plist](https://github.com/fukamachi/multival-plist) will help you.
“‘common-lisp
(import ’multival-plist:getf-all)
(getf-all ’(:|item-id| 1 :|item-id| 2) :|item-id|)
;=> (1 2)
“‘
### Passing
Normally, routes are matched in the order they are defined. Only the first route matched is invoked and rest of them just will be ignored. But, a route can punt processing to the next matching route using ‘next-route‘.
“‘common-lisp
@url GET "/guess/:who"
(defun guess-me (params)
(if (string= (getf params :who) "Eitaro")
"You got me!"
(next-route)))
@url GET "/guess/*"
(defun guess-anyone (params)
"You missed!")
“‘
### Return Value
You can return following format as the result in actions.
* String
* Pathname
* Clack’s response list (containing Status, Headers and Body)
### View
Caveman adopt CL-EMB as the default template engine. A package, named ‘myapp.view.emb‘, will be generated in your project which has one function ‘render‘. It is simply execute ‘emb:execute-emb‘ and return the result as a string.
Of course, you can use other template engines, such as "cl-markup".
### Configuration
Caveman uses ".lisp" file as configuration file in ‘#p"config/"‘ directory. When a project is just generated, you might be able to find ‘dev.lisp‘ in it. It will be used when "start" the project application with "dev" mode.
“‘common-lisp
;; config/dev.lisp
‘(:static-path #p"static/"
:log-path #p"log/"
:template-path #p"templates/"
:application-root ,(asdf:component-pathname
(asdf:find-system :myapp))
:server :hunchentoot
:port 5000
:database-type :sqlite3
:database-connection-spec (,(namestring
(asdf:system-relative-pathname
:myapp
"sqlite3.db"))))
“‘
Obviously, this is just a plist. You can use following keys in there.
* ‘:application-root‘ (Pathname): Pathname of the application root.
* ‘:static-path‘ (Pathname): Relative pathname of a static files directory from the root.
* ‘:log-path‘ (Pathname): Relative pathname of a log files directory from the root.
* ‘:template-path‘ (Pathname): Relative pathname of a template directory from the root.
* ‘:port‘ (Integer): Server port.
* ‘:server‘ (Keyword): Clack.Handler’s server type. (ex. ‘:hunchentoot‘)
And following stuffs will be used by Clack.Middleware.Clsql for integrating CLSQL.
* ‘:database-type‘ (Keyword)
* ‘:database-connection-spec‘ (List)
You can access to the configuration plist anywhere, by using ‘caveman:config‘.
“‘common-lisp
(caveman:config)
;;=> (:static-path #p"public/" :template-path ...)
(caveman:config :server)
;;=> :hunchentoot
“‘
### Helper
* ‘context‘
* ‘with-context-variables‘
* ‘config‘
* ‘app-path‘
* ‘url-for‘
* ‘redirect-to‘
* ‘forward-to‘
* ‘current-uri‘
* ‘current-mode‘
### Session
‘caveman:*session*‘ is a hash table which represents a session for the current user.
## More practical
### Extend the Context
### Database
## Author
* Eitaro Fukamachi (e.arrows@gmail.com)
## Contributors
* Tomohiro Matsuyama (tomo@cx4a.org)
## Copyright
Copyright (c) 2011 Eitaro Fukamachi
## License
Licensed under the LLGPL License.
12.8.0
caveman.asd (file)
v1/src (module)
Modules are listed depth-first from the system components tree.
• The caveman/v1/src module | ||
• The caveman/v1/src/core module | ||
• The caveman/v1/src/lib module | ||
• The caveman/v1/src/lib/widget module | ||
• The caveman/v1/src/lib/view module |
Next: The caveman/v1/src/core module, Previous: Modules, Up: Modules [Contents][Index]
Next: The caveman/v1/src/lib module, Previous: The caveman/v1/src module, Up: Modules [Contents][Index]
v1/src (module)
v1/src/core/
Next: The caveman/v1/src/lib/widget module, Previous: The caveman/v1/src/core module, Up: Modules [Contents][Index]
Next: The caveman/v1/src/lib/view module, Previous: The caveman/v1/src/lib module, Up: Modules [Contents][Index]
Previous: The caveman/v1/src/lib/widget module, Up: Modules [Contents][Index]
lib (module)
v1/src/lib/view/
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
Next: The caveman/v1/src/core/caveman․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
caveman.asd
caveman (system)
Next: The caveman/v1/src/core/app․lisp file, Previous: The caveman․asd file, Up: Lisp files [Contents][Index]
core (module)
v1/src/core/caveman.lisp
Next: The caveman/v1/src/core/project․lisp file, Previous: The caveman/v1/src/core/caveman․lisp file, Up: Lisp files [Contents][Index]
core (module)
v1/src/core/app.lisp
Next: The caveman/v1/src/core/request․lisp file, Previous: The caveman/v1/src/core/app․lisp file, Up: Lisp files [Contents][Index]
core (module)
v1/src/core/project.lisp
Next: The caveman/v1/src/core/response․lisp file, Previous: The caveman/v1/src/core/project․lisp file, Up: Lisp files [Contents][Index]
core (module)
v1/src/core/request.lisp
Next: The caveman/v1/src/core/context․lisp file, Previous: The caveman/v1/src/core/request․lisp file, Up: Lisp files [Contents][Index]
core (module)
v1/src/core/response.lisp
<response> (class)
Next: The caveman/v1/src/core/middleware/context․lisp file, Previous: The caveman/v1/src/core/response․lisp file, Up: Lisp files [Contents][Index]
core (module)
v1/src/core/context.lisp
Next: The caveman/v1/src/core/skeleton․lisp file, Previous: The caveman/v1/src/core/context․lisp file, Up: Lisp files [Contents][Index]
context.lisp (file)
core (module)
v1/src/core/middleware/context.lisp
<caveman-middleware-context> (class)
Next: The caveman/v1/src/core/route․lisp file, Previous: The caveman/v1/src/core/middleware/context․lisp file, Up: Lisp files [Contents][Index]
core (module)
v1/src/core/skeleton.lisp
generate (function)
*skeleton-directory* (special variable)
Next: The caveman/v1/src/core/widget․lisp file, Previous: The caveman/v1/src/core/skeleton․lisp file, Up: Lisp files [Contents][Index]
app.lisp (file)
core (module)
v1/src/core/route.lisp
add-query-parameters (function)
Next: The caveman/v1/src/lib/widget/form․lisp file, Previous: The caveman/v1/src/core/route․lisp file, Up: Lisp files [Contents][Index]
core (module)
v1/src/core/widget.lisp
Next: The caveman/v1/src/lib/view/function․lisp file, Previous: The caveman/v1/src/core/widget․lisp file, Up: Lisp files [Contents][Index]
widget (module)
v1/src/lib/widget/form.lisp
Next: The caveman/v1/src/lib/view/emb․lisp file, Previous: The caveman/v1/src/lib/widget/form․lisp file, Up: Lisp files [Contents][Index]
view (module)
v1/src/lib/view/function.lisp
render (function)
Previous: The caveman/v1/src/lib/view/function․lisp file, Up: Lisp files [Contents][Index]
function.lisp (file)
view (module)
v1/src/lib/view/emb.lisp
render (function)
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
Next: The caveman․app package, Previous: Packages, Up: Packages [Contents][Index]
caveman.lisp (file)
common-lisp
Next: The caveman․project package, Previous: The caveman package, Up: Packages [Contents][Index]
app.lisp (file)
Next: The caveman․request package, Previous: The caveman․app package, Up: Packages [Contents][Index]
project.lisp (file)
Next: The caveman․response package, Previous: The caveman․project package, Up: Packages [Contents][Index]
request.lisp (file)
Next: The caveman․context package, Previous: The caveman․request package, Up: Packages [Contents][Index]
response.lisp (file)
<response> (class)
Next: The caveman․middleware․context package, Previous: The caveman․response package, Up: Packages [Contents][Index]
context.lisp (file)
Next: The caveman․skeleton package, Previous: The caveman․context package, Up: Packages [Contents][Index]
middleware/context.lisp (file)
<caveman-middleware-context> (class)
Next: The caveman․route package, Previous: The caveman․middleware․context package, Up: Packages [Contents][Index]
skeleton.lisp (file)
common-lisp
generate (function)
*skeleton-directory* (special variable)
Next: The caveman․widget package, Previous: The caveman․skeleton package, Up: Packages [Contents][Index]
route.lisp (file)
add-query-parameters (function)
Next: The caveman․widget․form package, Previous: The caveman․route package, Up: Packages [Contents][Index]
widget.lisp (file)
Next: The caveman․view․function package, Previous: The caveman․widget package, Up: Packages [Contents][Index]
form.lisp (file)
Next: The caveman․view․emb package, Previous: The caveman․widget․form package, Up: Packages [Contents][Index]
function.lisp (file)
common-lisp
render (function)
Previous: The caveman․view․function package, Up: Packages [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables | ||
• Exported macros | ||
• Exported functions | ||
• Exported generic functions | ||
• Exported classes |
Next: Exported macros, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
Special variable to store Caveman Context, a hash table.
Don’t set to this variable directly. This is designed to be bound in lexical let.
context.lisp (file)
Special variable to store current Caveman application.
Don’t set to this variable directly. This is designed to be bound in lexical let.
context.lisp (file)
Special variable to store Caveman Request, a instance of ‘<request>’ in Caveman.Request package. Don’t set to this variable directly. This is designed to be bound in lexical let.
context.lisp (file)
Special variable to store Caveman Response, a instance of ‘<response>’ in Caveman.Response package. Don’t set to this variable directly. This is designed to be bound in lexical let.
context.lisp (file)
Special variable to store session.
Don’t set to this variable directly. This is designed to be bound in lexical let.
context.lisp (file)
Next: Exported functions, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
Recreation of @URL annotation in S-expression form
route.lisp (file)
Useful annotation to define actions.
Example:
;; for Function
@url GET "/login"
(defun login (req)
;; response
)
;; for Clack Component
@url GET "/member/:id"
(defclass <member-profile> (<component>) ())
(defmethod call ((this <member-profile>) req)
;; response
)
route.lisp (file)
Convert action form into a routing rule, a list.
Example:
((member-profile #<url-rule> #’member-profile)
(login-form #<url-rule> #’login-form))
route.lisp (file)
context.lisp (file)
Next: Exported generic functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
caveman.lisp (file)
caveman.lisp (file)
Access to current context. If key is specified, return the value in current context.
If not, just return a current context.
Example:
(context)
;=> #<HASH-TABLE :TEST EQL size 0/60 #x3020025FF5FD>
(context :request)
;=> #<CAVEMAN.REQUEST:<REQUEST> #x3020024FCCFD>
context.lisp (file)
(setf context) (function)
context.lisp (file)
context (function)
caveman.lisp (file)
caveman.lisp (file)
caveman.lisp (file)
Generate a skeleton of Caveman Application.
‘name’ must be a symbol or a keyword. ‘path’ must be a pathname. If ‘path’ isn’t specified, generate a skeleton to current directory.
skeleton.lisp (file)
Create a new Context.
context.lisp (file)
A synonim for ‘(make-instance ’<caveman-widget-form> ...)‘.
form.lisp (file)
Construct a request instance.
request.lisp (file)
app.lisp (file)
An action when no routing rules are found.
app.lisp (file)
caveman.lisp (file)
Render function for Functions.
function.lisp (file)
Render function for CL-EMB templates.
emb.lisp (file)
Make an URL for the action with PARAMS.
Example:
@url GET "/animals/:type"
(defun animals (params))
(url-for ’animals :type "cat")
;; => "/animals/cat"
route.lisp (file)
Next: Exported classes, Previous: Exported functions, Up: Exported definitions [Contents][Index]
Add another widget to this form. That will be rendered in ’form’ tag.
form.lisp (file)
Add a routing rule to the Application.
app.lisp (file)
Build up an application for this project and return it. This method must be implemented in subclasses.
project.lisp (file)
automatically generated reader method
project.lisp (file)
automatically generated writer method
project.lisp (file)
automatically generated reader method
project.lisp (file)
automatically generated writer method
project.lisp (file)
project.lisp (file)
Lookup a routing rule with SYMBOL from the application.
app.lisp (file)
automatically generated reader method
project.lisp (file)
automatically generated writer method
project.lisp (file)
widget.lisp (file)
project.lisp (file)
project.lisp (file)
Stop a server.
project.lisp (file)
form.lisp (file)
automatically generated reader method
widget.lisp (file)
automatically generated writer method
widget.lisp (file)
Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
Base class for Caveman Application. All Caveman Application must inherit this class.
app.lisp (file)
<component> (class)
caveman.app::routing-rules
routing-rules (generic function)
(setf routing-rules) (generic function)
Clack Middleware to set context for each request.
middleware/context.lisp (file)
<middleware> (class)
call (method)
form.lisp (file)
<caveman-widget> (class)
string
:action
""
form-action (generic function)
(setf form-action) (generic function)
keyword
:method
:post
form-method (generic function)
(setf form-method) (generic function)
list
:components
form-components (generic function)
(setf form-components) (generic function)
Base class of view widget.
widget.lisp (file)
standard-object (class)
<caveman-widget-form> (class)
(or null function clack.component:<component>)
:view
view (generic function)
(setf view) (generic function)
project.lisp (file)
<component> (class)
:config
config (generic function)
(setf config) (generic function)
acceptor (generic function)
(setf acceptor) (generic function)
boolean
:debug-mode-p
t
debug-mode-p (generic function)
(setf debug-mode-p) (generic function)
keyword
:mode
project-mode (generic function)
(setf project-mode) (generic function)
Class for Caveman Request.
request.lisp (file)
<request> (class)
Class for Caveman Response.
response.lisp (file)
<response> (class)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal special variables | ||
• Internal functions | ||
• Internal generic functions |
Next: Internal functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
A function called when ‘next-route’ is invoked. This will be overwritten in ‘dispatch-with-rules’.
app.lisp (file)
skeleton.lisp (file)
Next: Internal generic functions, Previous: Internal special variables, Up: Internal definitions [Contents][Index]
Add a query parameters string of PARAMS to BASE-URL.
route.lisp (file)
app.lisp (file)
app.lisp (file)
Read a specified file and return the content as a sequence.
project.lisp (file)
Previous: Internal functions, Up: Internal definitions [Contents][Index]
automatically generated reader method
project.lisp (file)
automatically generated writer method
project.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | C F L M |
---|
Jump to: | C F L M |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
A B C D F G L M N P R S U V W |
---|
Jump to: | (
A B C D F G L M N P R S U V W |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | *
A C D M R S V |
---|
Jump to: | *
A C D M R S V |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | <
C P S |
---|
Jump to: | <
C P S |
---|