clack

API Reference

clack

Web application environment for Common Lisp

CLACK

  • Function CLACKUP (app &rest args &key (server :hunchentoot) (port 5000) (debug t) silent (use-thread t) (use-default-middlewares t) &allow-other-keys)

Also exports

  • CLACK.HANDLER:STOP

CLACK.HANDLER

  • Function RUN (app server &rest args &key use-thread &allow-other-keys)
  • Function STOP (handler)

CLACK.UTIL

  • Function FIND-HANDLER (server)

clack-handler-hunchentoot

Clack handler for Hunchentoot.

CLACK.HANDLER.HUNCHENTOOT

  • Function RUN (app &key debug (port 5000) ssl ssl-key-file ssl-cert-file ssl-key-password max-thread-count max-accept-count (persistent-connections-p t))
    Start Hunchentoot server.

clack-handler-toot

Clack handler for Toot.

CLACK.HANDLER.TOOT

  • Function RUN (app &key debug (port 5000) ssl ssl-key-file ssl-cert-file ssl-key-password)
    Start Toot server.

clack-middleware-auth-basic

Basic Authentication Middleware.

CLACK.MIDDLEWARE.AUTH.BASIC

  • Class <CLACK-MIDDLEWARE-AUTH-BASIC>  (<MIDDLEWARE>)
    Clack Middleware to authenticate.
    AUTHENTICATOR   Accessor: AUTHENTICATOR
    REALM   Accessor: REALM

clack-middleware-clsql

Middleware for CLSQL connection management

CLACK.MIDDLEWARE.CLSQL

  • Class <CLACK-MIDDLEWARE-CLSQL>  (<MIDDLEWARE>)
    DATABASE-TYPE   Accessor: DATABASE-TYPE
    CONNECTION-SPEC   Accessor: CONNECTION-SPEC
    CONNECT-ARGS   Accessor: CONNECT-ARGS

clack-middleware-csrf

Middleware for easy CSRF protection

CLACK.MIDDLEWARE.CSRF

  • Class <CLACK-MIDDLEWARE-CSRF>  (<MIDDLEWARE>)
    Clack Middleware for easy CSRF protection.
    BLOCK-APP   Accessor: BLOCK-APP
    ONE-TIME-P   Accessor: ONE-TIME-P
  • Function CSRF-TOKEN (session)
    Return a random CSRF token.
  • Function CSRF-HTML-TAG (session)
    Return an 'input' tag containing random CSRF token. Note this has a side-effect, natually. This function stores the generated id into the current session when called.

clack-middleware-dbi

Middleware for CL-DBI connection management.

CLACK.MIDDLEWARE.DBI

  • Variable *DB*
    nil
  • Class <CLACK-MIDDLEWARE-DBI>  (<MIDDLEWARE>)
    DRIVER-NAME   Accessor: DRIVER-NAME
    CONNECT-ARGS   Accessor: CONNECT-ARGS

clack-middleware-oauth

Supports authorization mechanism by OAuth

CLACK.MIDDLEWARE.OAUTH

  • Class <CLACK-MIDDLEWARE-OAUTH>  (<MIDDLEWARE>)
    PATH   Accessor: OAUTH-PATH
    CALLBACK-BASE   Accessor: OAUTH-CALLBACK-BASE
    CALLBACK-URI   Accessor: OAUTH-CALLBACK-URI
    CONSUMER-KEY   Accessor: OAUTH-CONSUMER-KEY
    CONSUMER-SECRET   Accessor: OAUTH-CONSUMER-SECRET
    AUTHORIZE-URI   Accessor: OAUTH-AUTHORIZE-URI
    REQUEST-TOKEN-URI   Accessor: OAUTH-REQUEST-TOKEN-URI
    ACCESS-TOKEN-URI   Accessor: OAUTH-ACCESS-TOKEN-URI
    AUTHORIZED   Accessor: OAUTH-AUTHORIZED
    STATE   Accessor: OAUTH-STATE
    STATE-EXPIRE   Accessor: OAUTH-STATE-EXPIRE

clack-middleware-postmodern

Middleware for POSTMODERN connection management

CLACK.MIDDLEWARE.POSTMODERN

  • Class <CLACK-MIDDLEWARE-POSTMODERN>  (<MIDDLEWARE>)
    This middleware opens a connection to the specified database and stores it in *database* as expected by postmodern. It also stores the connection(s) in an alist (database name as key) in the environment with the key :clack.postmodern.databases.
    DATABASE   Accessor: DATABASE
    The name of the database to connect to.
    USER   Accessor: USER
    The name of the database user.
    PASSWORD   Accessor: PASSWORD
    The password for the database.
    HOST   Accessor: HOST
    The host the database server is on.
    PORT   Accessor: PORT
    The port the database server is listening on.
    POOLED-P   Accessor: POOLED-P
    Shall the connections be pooled?
    USE-SSL   Accessor: USE-SSL
    Keyword for the use-ssl configuration.
  • Function GET-CONNECTION (db-name env)

clack-session-store-dbi

CL-DBI-based session store for Clack.Middleware.Session

CLACK.SESSION.STORE.DBI

  • Class <CLACK-SESSION-STORE-DBI>  (<CLACK-SESSION-STORE>)
    CONNECT-ARGS   Reader: STORE-CONNECT-ARGS
    CONNECTOR   Reader: STORE-CONNECTOR
    TABLE-NAME   Reader: STORE-TABLE-NAME
    %CONNECTION

clack-test

Testing Clack Applications.

CLACK.TEST

  • Variable *CLACK-TEST-HANDLER*
    :hunchentoot
    Backend Handler to run tests on. String or Symbol are allowed.
  • Variable *CLACK-TEST-PORT*
    4242
    HTTP port number of Handler.
  • Variable *ENABLE-DEBUG-P*
    t
  • Function LOCALHOST (&optional (path "/") (port *clack-test-port*))
  • Macro SUBTEST-APP (desc app &body client)

CLACK.TEST.SUITE

  • Variable *CLACK-TEST-ACCESS-PORT*
    clack.test:*clack-test-port*
    Port of localhost to request. Use if you want to set another port. The default is `*clack-test-port*`.
  • Function RUN-SERVER-TESTS (handler-name)
    Run tests for clack.handler. Handler name is a keyword and doesn't include the clack.handler prefix. For example, if you have a handler `clack.handler.foo', you would call like this: `(run-server-tests :foo)'.

clack-v1-compat

CLACK.BUILDER

No exported symbols.

Also exports

  • LACK.BUILDER:BUILDER

CLACK.REQUEST-RESPONSE

  • Generic-Function HEADERS (object &optional name)
  • Generic-Function (setf HEADERS) (headers object &optional name)
  • Method HEADERS ((request <request>) &optional name)
  • Generic-Function HEADERS (res &optional name)
    Get all included headers, or the header value that corresponds to `name'. Example: (headers res) ;;=> (:content-type "text/plain") (headers res :content-type) ;;=> "text/plain"
  • Method HEADERS ((res <response>) &optional name)
  • Method HEADERS ((res <response>) &optional name)
  • Method HEADERS ((res <response>) &optional name)
  • Generic-Function (setf HEADERS) (value res &optional name)
    Set headers. Example: (setf (headers res) '(:content-type "text/html")) (setf (headers res :content-type) "text/html")
  • Method (setf HEADERS) (value (res <response>) &optional name)
  • Method (setf HEADERS) (value (res <response>) &optional name)
  • Method (setf HEADERS) (value (res <response>) &optional name)

CLACK.REQUEST

  • Class <REQUEST>
    Portable HTTP Request object for Clack Request.
    ENV   Reader: ENV
    Raw env
    REQUEST-METHOD   Reader: REQUEST-METHOD
    The HTTP request method. This must be one of :GET, :HEAD, :OPTIONS, :PUT, :POST, or :DELETE.
    SCRIPT-NAME   Reader: SCRIPT-NAME
    The initial portion of the request URL's path, corresponding to the application. This may be an empty string if the application corresponds to the server's root URI. If this key is not empty, it must start with a forward slash (/).
    PATH-INFO   Reader: PATH-INFO
    The remainder of the request URL's path. This may be an empty string if the request URL targets the application root and does not have a trailing slash.
    SERVER-NAME   Reader: SERVER-NAME
    The resolved server name, or the server IP address.
    SERVER-PORT   Reader: SERVER-PORT
    The port on which the request is being handled.
    SERVER-PROTOCOL   Reader: SERVER-PROTOCOL
    The version of the protocol the client used to send the request. Typically this will be something like :HTTP/1.0 or :HTTP/1.1.
    REQUEST-URI   Reader: REQUEST-URI
    The request URI. Must start with '/'.
    URI-SCHEME   Reader: URI-SCHEME
    REMOTE-ADDR   Reader: REMOTE-ADDR
    REMOTE-PORT   Reader: REMOTE-PORT
    QUERY-STRING   Reader: QUERY-STRING
    The portion of the request URL that follows the '?', if any.
    RAW-BODY   Reader: RAW-BODY
    CONTENT-LENGTH   Reader: CONTENT-LENGTH
    CONTENT-TYPE   Reader: CONTENT-TYPE
    CLACK-HANDLER   Reader: CLACK-HANDLER
    HEADERS
    HTTP-COOKIE
    BODY-PARAMETERS
    QUERY-PARAMETERS
  • Generic-Function REFERER (request)
  • Method REFERER ((request <request>))
  • Method REFERER ((request <request>))
  • Method REFERER ((request <request>))
  • Generic-Function USER-AGENT (request)
  • Method USER-AGENT ((request <request>))
  • Method USER-AGENT ((request <request>))
  • Method USER-AGENT ((request <request>))
  • Function SHARED-RAW-BODY (env)
    Returns a shared raw-body, or returns nil if raw-body is empty. This function modifies REQ to share raw-body among the instances of <request>.
  • Function MAKE-REQUEST (env)
    A synonym for (make-instance '<request> ...). Make a <request> instance from environment plist. Raw-body of the instance will be shared, meaning making an instance of <request> doesn't effect on an original raw-body.
  • Generic-Function SECUREP (req)
  • Method SECUREP ((req <request>))
  • Method SECUREP ((req <request>))
  • Method SECUREP ((req <request>))
  • Generic-Function COOKIES (req &optional name)
    Returns cookies as a plist. If optional `name' is specified, returns the value that corresponds to it.
  • Method COOKIES ((req <request>) &optional name)
  • Method COOKIES ((req <request>) &optional name)
  • Method COOKIES ((req <request>) &optional name)
  • Generic-Function BODY-PARAMETER (req &optional name)
    Return POST parameters as a plist. If optional `name' is specified, returns the value that corresponds to it.
  • Method BODY-PARAMETER ((req <request>) &optional name)
  • Method BODY-PARAMETER ((req <request>) &optional name)
  • Method BODY-PARAMETER ((req <request>) &optional name)
  • Generic-Function QUERY-PARAMETER (req &optional name)
    Returns GET parameters as a plist. If optional `name' is specified, returns the value that corresponds to it.
  • Method QUERY-PARAMETER ((req <request>) &optional name)
  • Method QUERY-PARAMETER ((req <request>) &optional name)
  • Method QUERY-PARAMETER ((req <request>) &optional name)
  • Generic-Function PARAMETER (req &optional name)
    Returns request parameters containing (merged) GET and POST parameters. If optional `name' is specified, returns the value that corresponds to it.
  • Method PARAMETER ((req <request>) &optional name)
  • Method PARAMETER ((req <request>) &optional name)
  • Method PARAMETER ((req <request>) &optional name)

Also exports

  • CLACK.REQUEST-RESPONSE:HEADERS

CLACK.RESPONSE

No exported symbols.

CLACK.COMPONENT

  • Type COMPONENT-DESIGNATOR
  • Class <COMPONENT>  (LACK-COMPONENT)
    No slots.
  • Generic-Function MAKE-APP (comp)
  • Method MAKE-APP ((comp <component>))
  • Method MAKE-APP ((comp <component>))
  • Method MAKE-APP ((comp <component>))

Also exports

  • LACK.COMPONENT:CALL

CLACK.MIDDLEWARE

  • Class <MIDDLEWARE>  (<COMPONENT>)
    APP   Reader: APP
  • Generic-Function CALL-NEXT (mw env)
  • Method CALL-NEXT ((mw <middleware>) env)
  • Method CALL-NEXT ((mw <middleware>) env)
  • Method CALL-NEXT ((mw <middleware>) env)
  • Generic-Function WRAP (mw app-or-middleware)
  • Method WRAP ((mw function) app-or-middleware)
  • Method WRAP ((mw function) app-or-middleware)
  • Method WRAP ((mw function) app-or-middleware)
  • Method WRAP ((mw <middleware>) app-or-middleware)
  • Method WRAP ((mw <middleware>) app-or-middleware)
  • Method WRAP ((mw <middleware>) app-or-middleware)
  • Method WRAP ((this <clack-middleware-conditional>) app)

CLACK.MIDDLEWARE.ACCESSLOG

  • Variable *TIME-FORMAT*
    '((:day 2) #\/ :short-month #\/ (:year 4) #\: (:hour 2) #\: (:min 2) #\:
      (:sec 2) #\  :gmt-offset)
  • Class <CLACK-MIDDLEWARE-ACCESSLOG>  (<MIDDLEWARE>)
    LOGGER
    FORMATTER

CLACK.MIDDLEWARE.BACKTRACE

  • Class <CLACK-MIDDLEWARE-BACKTRACE>  (<MIDDLEWARE>)
    OUTPUT   Accessor: OUTPUT
    RESULT-ON-ERROR   Accessor: RESULT-ON-ERROR

CLACK.MIDDLEWARE.CONDITIONAL

  • Variable *LACK-MIDDLEWARE-CONDITION*
    (lambda
        (clack.middleware.conditional::app cond
         &key clack.middleware.conditional::builder)
      (clack.middleware:wrap
       (make-instance 'clack.middleware.conditional:<clack-middleware-conditional>
                      :condition cond :builder
                      clack.middleware.conditional::builder)
       clack.middleware.conditional::app))
  • Class <CLACK-MIDDLEWARE-CONDITIONAL>  (<MIDDLEWARE>)
    CONDITION
    BUILDER
    MIDDLEWARE

CLACK.MIDDLEWARE.LET

  • Class <CLACK-MIDDLEWARE-LET>  (<MIDDLEWARE>)
    BINDINGS

CLACK.MIDDLEWARE.STATIC

  • Class <CLACK-MIDDLEWARE-STATIC>  (<MIDDLEWARE>)
    Clack Middleware to intercept requests for static files.
    PATH   Accessor: STATIC-PATH
    ROOT   Accessor: STATIC-ROOT

CLACK.MIDDLEWARE.SESSION

  • Class <CLACK-MIDDLEWARE-SESSION>  (<MIDDLEWARE>)
    Clack Middleware for session management.
    STATE   Accessor: STATE
    STORE   Accessor: STORE

CLACK.MIDDLEWARE.SESSION.COOKIE

  • Class <CLACK-MIDDLEWARE-SESSION-COOKIE>  (<CLACK-MIDDLEWARE-SESSION>)
    SECRET   Accessor: SECRET
    Server side secret to sign the session data using HMAC SHA1.

CLACK.SESSION.STATE

  • Class <CLACK-SESSION-STATE>
    SESSION-KEY   Accessor: SESSION-KEY
    SID-GENERATOR   Accessor: SID-GENERATOR
    SID-VALIDATOR   Accessor: SID-VALIDATOR
  • Generic-Function EXPIRE (state id res &optional options)
  • Method EXPIRE ((this <clack-session-state>) id res &optional options)
  • Method EXPIRE ((this <clack-session-state>) id res &optional options)
  • Method EXPIRE ((this <clack-session-state>) id res &optional options)
  • Generic-Function SESSION-ID (state env)
  • Method SESSION-ID ((this <clack-session-state>) env)
  • Method SESSION-ID ((this <clack-session-state>) env)
  • Method SESSION-ID ((this <clack-session-state>) env)
  • Generic-Function VALID-SID-P (state id)
  • Method VALID-SID-P ((this <clack-session-state>) id)
  • Method VALID-SID-P ((this <clack-session-state>) id)
  • Method VALID-SID-P ((this <clack-session-state>) id)
  • Generic-Function EXTRACT-ID (state env)
  • Method EXTRACT-ID ((this <clack-session-state>) env)
  • Method EXTRACT-ID ((this <clack-session-state>) env)
  • Method EXTRACT-ID ((this <clack-session-state>) env)
  • Generic-Function GENERATE-ID (state &rest args)
  • Method GENERATE-ID ((this <clack-session-state>) &rest args)
  • Method GENERATE-ID ((this <clack-session-state>) &rest args)
  • Method GENERATE-ID ((this <clack-session-state>) &rest args)
  • Generic-Function FINALIZE (state id res options)
  • Method EXPIRE ((this <clack-session-state-cookie>) id res &optional options)
  • Method SESSION-ID ((this <clack-session-state-cookie>) env)
  • Method FINALIZE ((this <clack-session-state-cookie>) id res options)

CLACK.SESSION.STATE.COOKIE

  • Class <CLACK-SESSION-STATE-COOKIE>  (<CLACK-SESSION-STATE>)
    PATH   Accessor: PATH
    DOMAIN   Accessor: DOMAIN
    EXPIRES   Accessor: EXPIRES
    SECURE   Accessor: SECURE
    HTTPONLY   Accessor: HTTPONLY

Also exports

  • CLACK.SESSION.STATE:EXTRACT-ID
  • CLACK.SESSION.STATE:GENERATE-ID
  • CLACK.SESSION.STATE:SESSION-ID
  • CLACK.SESSION.STATE:EXPIRE
  • CLACK.SESSION.STATE:VALID-SID-P
  • CLACK.SESSION.STATE:FINALIZE

CLACK.SESSION.STORE

  • Class <CLACK-SESSION-STORE>
    STASH   Accessor: STASH
  • Generic-Function FETCH (store sid)
  • Method FETCH ((this <clack-session-store>) sid)
  • Method FETCH ((this <clack-session-store>) sid)
  • Method FETCH ((this <clack-session-store>) sid)
  • Generic-Function STORE-SESSION (store sid session)
  • Method STORE-SESSION ((this <clack-session-store>) sid session)
  • Method STORE-SESSION ((this <clack-session-store>) sid session)
  • Method STORE-SESSION ((this <clack-session-store>) sid session)
  • Generic-Function REMOVE-SESSION (store sid)
  • Method REMOVE-SESSION ((this <clack-session-store>) sid)
  • Method REMOVE-SESSION ((this <clack-session-store>) sid)
  • Method REMOVE-SESSION ((this <clack-session-store>) sid)

CLACK.APP.DIRECTORY

  • Class <CLACK-APP-DIRECTORY>  (<CLACK-APP-FILE>)
    No slots.
  • Function START-SERVER (&key (root (truename ".")) (port 5000))

CLACK.APP.FILE

  • Class <CLACK-APP-FILE>  (<COMPONENT>)
    Clack Application to serve static files.
    FILE   Accessor: FILE
    ROOT   Accessor: ROOT
    ENCODING   Accessor: ENCODING
  • Generic-Function SHOULD-HANDLE (app file)
  • Method SHOULD-HANDLE ((this <clack-app-file>) file)
  • Method SHOULD-HANDLE ((this <clack-app-file>) file)
  • Method SHOULD-HANDLE ((this <clack-app-file>) file)
  • Generic-Function LOCATE-FILE (app path root)
  • Method LOCATE-FILE ((this <clack-app-file>) path root)
  • Method LOCATE-FILE ((this <clack-app-file>) path root)
  • Method LOCATE-FILE ((this <clack-app-file>) path root)
  • Generic-Function SERVE-PATH (app env file encoding)
  • Method SERVE-PATH ((this <clack-app-file>) env file encoding)
  • Method SERVE-PATH ((this <clack-app-file>) env file encoding)
  • Method SERVE-PATH ((this <clack-app-file>) env file encoding)

CLACK.APP.URLMAP

  • Class <CLACK-APP-URLMAP>  (<COMPONENT>)
    Class to map multiple apps in different paths.
    %MAPPING
  • Generic-Function MOUNT (app-urlmap location app)
    Register an `app' to the `location'.
  • Method MOUNT ((this <clack-app-urlmap>) location app)
  • Method MOUNT ((this <clack-app-urlmap>) location app)
  • Method MOUNT ((this <clack-app-urlmap>) location app)
  • Macro BUILDER-URLMAP (&rest apps)
    Useful syntax sugar for building applications.

CLACK.HTTP-STATUS

  • Variable *HTTP-STATUS*
    (make-hash-table :test #'eql)
  • Function HTTP-STATUS-REASON (code)

t-clack-handler-fcgi

No packages.

t-clack-handler-hunchentoot

No packages.

t-clack-handler-toot

No packages.

t-clack-handler-wookie

No packages.

t-clack-middleware-auth-basic

No packages.

t-clack-middleware-csrf

No packages.

t-clack-v1-compat

No packages.