The simple-routes Reference Manual

This is the simple-routes Reference Manual, version 0.3, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:42:38 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 simple-routes

Facility for straightforward http routing on top of Hunchentoot.

Author

Currell Berry

License

2 clause BSD

Version

0.3

Dependencies
  • hunchentoot (system).
  • cl-ppcre (system).
Source

simple-routes.asd.

Child Component

simple-routes.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 simple-routes/simple-routes.asd

Source

simple-routes.asd.

Parent Component

simple-routes (system).

ASDF Systems

simple-routes.

Packages

simpleroutes-asd.


3.1.2 simple-routes/simple-routes.lisp

Source

simple-routes.asd.

Parent Component

simple-routes (system).

Packages

simple-routes.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 simple-routes

Source

simple-routes.lisp.

Use List
  • cl-ppcre.
  • common-lisp.
  • hunchentoot.
Public Interface
Internals

4.2 simpleroutes-asd

Source

simple-routes.asd.

Use List
  • asdf/interface.
  • common-lisp.

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *routeslist*

should contain routes compiled with routespec-compile or manually entered in compiled form incoming requests are matched up against each item in *routeslist* successively, until (and if) a matching routespec is found.

Package

simple-routes.

Source

simple-routes.lisp.


5.1.2 Macros

Macro: bind-alist-values (lambda-list alist-expression &rest body)

this is intended to be used to access get and post parameters. example usage (bind-alist-values (first second) (hunchentoot:get-parameters*)
(list first second))

Package

simple-routes.

Source

simple-routes.lisp.

Macro: compile-routes (&rest routespecs)
Package

simple-routes.

Source

simple-routes.lisp.

Macro: define-simple-handler (name argument-spec &body body)
Package

simple-routes.

Source

simple-routes.lisp.


5.1.3 Standalone methods

Method: acceptor-dispatch-request ((acceptor simpleroutes-acceptor) request)

The simple request dispatcher which tries to complete the request using simple,
but otherwise falls back to the hunchentoot defaults *dispatch-table* and easy-acceptor

Package

hunchentoot.

Source

simple-routes.lisp.


5.1.4 Classes

Class: simpleroutes-acceptor

This first tries to route requests using simple-router, then falls back to hunchentoot’s default easy-acceptor.

Package

simple-routes.

Source

simple-routes.lisp.

Direct superclasses

easy-acceptor.

Direct subclasses

simpleroutes-ssl-acceptor.

Direct methods

acceptor-dispatch-request.

Class: simpleroutes-ssl-acceptor

This is an acceptor that mixes the simpleroutes acceptor with SSL connections.

Package

simple-routes.

Source

simple-routes.lisp.

Direct superclasses

5.2 Internals


5.2.1 Ordinary functions

Function: issymbolstring (str)
Package

simple-routes.

Source

simple-routes.lisp.

Function: lastitem (seq)
Package

simple-routes.

Source

simple-routes.lisp.

Function: removelast (sequence)

removes the last item in sequence IF THE SEQUENCE HAS A LAST ITEM

Package

simple-routes.

Source

simple-routes.lisp.

Function: routespec-compile (httpmethod urldef fntocall)

httpmethod can be one of :GET :HEAD :POST :PUT :DELETE or :ALL
urldef is a url definition string sharing *basic* syntax with Ruby on Rails
fntocall is the function to call in case the this is found to be a match for the request

this macro returns a list which is meant to be processed by cl-simple routehandler example call:
=>(rtreg :GET “/home/next/:number” #’nxthandler) returns
(:GET "^/home/next/([^/]*)$" (NUMBER)
#<CLOSURE (LAMBDA # :IN MACRO-FUNCTION) {1000F213DB}>)
the output of this macro can in turn be processed by simple-processor

Package

simple-routes.

Source

simple-routes.lisp.

Function: simple-router (request-uri request-type)

takes in a request uri and type (:GET, :POST, etc...) and loops through all compiled routes in *routeslist*. If it finds a route that matches
,it returns the associated handler and returns true. otherwise returns false

Package

simple-routes.

Source

simple-routes.lisp.


Appendix A Indexes


A.1 Concepts


A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*routeslist*: Public special variables

S
Special Variable, *routeslist*: Public special variables