Method (STARTUP-SERVER STANDARD-SERVER) Startup SERVER.
Method (SHUTDOWN-SERVER STANDARD-SERVER) First call SHUTDOWN-APPLICATION on all the apps registered with SERVER, then call SHUTDOWN-BACKEND on SERVER's backend.
Method (REGISTER-ENTRY-POINT STANDARD-SERVER ENTRY-POINT) Simply call the backend's register-entry-point.
Method (HANDLE-REQUEST STANDARD-SERVER REQUEST RESPONSE) Service REQUEST and create a response in RESPONSE.
(defgeneric dump-applications (server output-file-name))
Method (FIND-SESSION STANDARD-APPLICATION REQUEST-CONTEXT) Returns the session with ID (find-session-id CONTEXT) in APP, NIL if there is no session with that id.
Method (MAKE-NEW-SESSION STANDARD-APPLICATION) Returns a new session object.
Method (UNREGISTER-ENTRY-POINT STANDARD-APPLICATION ENTRY-POINT) Unregister the entry point with url (entry-point.
Method (REGISTER-ENTRY-POINT STANDARD-APPLICATION ENTRY-POINT) Register the entry point ENTRY-POINT.
Method (FIND-ENTRY-POINT STANDARD-APPLICATION REQUEST-CONTEXT) Returns the entry-point object associated with CONTEXT, returns NIL if no entry point object could be found.
(defgeneric entry-point-match (entry-point effective-query-path) (:documentation "Returns T if ENTRY-POINT should handle EFFECTIVE-QUERY-PATH. EFFECTIVE-QUERY-PATH. is a string representing the request's query-path but with application's url-prefix removed. The name could be improved.") (:method ((entry-point standard-entry-point) (query-path string)) (string= (entry-point.url entry-point) query-path)) (:method ((entry-point regexp-entry-point) (query-path string)) (cl-ppcre:scan (entry-point.url entry-point) query-path)))
Method (REMOVE-EXPIRED-SESSIONS APPLICATION) Loops over all the sessions in APP, calls EXPIRE-SESSION on those for which EXPIREDP returns T.
Method (DELETE-SESSION STANDARD-APPLICATION SESSION) Remove SESSION from the set of known sessions.
Method (SERVICE BEFORE STANDARD-APPLICATION REQUEST-CONTEXT) Removes expired sessions.
Method (SERVICE STANDARD-APPLICATION REQUEST-CONTEXT) Service a request for this application.
Method (STARTUP-APPLICATION STANDARD-APPLICATION) Simply clears out the app's session-table.
Method (RESTART-APPLICATION STANDARD-APPLICATION) Calls shutdown-application and then startup-application on APP.
Method (COMPUTE-URL STANDARD-APPLICATION) Creates the default url for APP which, when requested, will cause the action with id ACTION-ID to be called.
Variable *STANDARD-SESSION-LONGEVITY* Amout of inactivity, in seconds, allowed before a standard-session object is expired.
Method (SESSION.VALUE T STANDARD-SESSION) Lookup the value associated with KEY in the session.
Method (EXPIREDP STANDARD-SESSION) Returns T if SESSION's last-access is more than *standard-session-longevity* seconds ago.
Method (FIND-FRAME STANDARD-SESSION STRING) Returns the frame whose id is FRAME-ID.
Method (MAKE-NEW-FRAME STANDARD-SESSION) Inserts a new frame in the session stack of SESSION.
Method (SERVICE STANDARD-SESSION REQUEST-CONTEXT) Service a request for a session.
Class COOKIE-SESSION-APPLICATION Class for applications which use cookies for sesion tracking.
Variable +UCW-SESSION-NAME+ Name of the cookie used when storing the session id.
Method (SERVICE AFTER COOKIE-SESSION-APPLICATION COOKIE-SESSION-REQUEST-CONTEXT) Add a Set-Cookie for the session-id to the response.
Function MAKE-NEW-CALLBACK Registers a new callback.
Method (MAKE-NEW-CALLBACK-USING-CLASS STANDARD-SESSION-FRAME T) Returns the name for a query param which, when passed in a action generated by F will call LAMBDA passing it the value of the param.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Servicing session frame
Method (SERVICE STANDARD-SESSION-FRAME REQUEST-CONTEXT) Service a request for this session frame.
Call/Answer vodoo
Macro CALL Stop the execution of the current action and pass control to a freshly created component of type COMPONENT-TYPE.
Macro ANSWER Return control to the calling component passing it VALUE.
Macro CALL-AS-WINDOW Just like CALL but the new component is used for the entire window.
Binding request params to variables
Macro WITH-REQUEST-PARAMS Bind, according the REQUEST-LAMBDA-LIST the parameters in REQUEST and execute BODY.
(defstruct arg-spec symbol name-string default-value supplied-symbol-name)
Defining actions and entry points
Macro %DEFACTION Defines an action method named NAME.
Macro DEFENTRY-POINT Define an entry point bound to the url URL.
Function ACTION-HREF Given a lambda returns an URL (as a string) which will call the lambda.
Places
Macro MAKE-PLACE Create a new place around FORM.
Method (PLACE PLACE) Returns the current value of PLACE.
Method (PLACE T PLACE) Set the value of PLACE to VALUE.
Method (CLONE-PLACE-VALUE PLACE) Return a copy of the current value in PLACE.
Backtracking
Method (SAVE-BACKTRACKED STANDARD-SESSION-FRAME) For every place in FRAME we want to back track save (in frame's BACKTRACKS) a copy of the current value of the backtrack places.
Method (REINSTATE-BACKTRACKED STANDARD-SESSION-FRAME) Reset all the values of the backtracked places in FRAME to the values they had the last FRAME was handled.
Function CLONE-BACKTRACKS BACKTRACKS is a list of backtrack objects, we create a new list of backtracks with the same getter, setter and value but a new copy of value.
(defstruct backtrace-frame index description locals source-location)
(defgeneric handle-request-error (error backtrace))
(defgeneric handle-action-error (error backtrace) (:documentation "Method called when a user defined action signals an error."))
(defgeneric handle-action-error-using-application (application error backtrace) (:documentation "Hook for application specific error handilng code. Please rename me. Please, God please!"))
Macro WITH-ACTION-ERROR-HANDLER Execute BODY with a handle for conditions of type ERROR-TYPE which calls HANDLE-ACTION-ERROR.
(define-condition rerl-error (error) ((context :initarg :context :accessor rerl-error.context :initform *context*)) (:documentation "An error signalled during the request processing chain."))
Conditions relating to badly formed requests. Generally this means that some essential piece of information was either missing or unrecognizable.
(define-condition inexistent-request-part (rerl-error) ((query-path :initarg :query-path :accessor rerl-error.query-path :initform "#<unknown>")) (:documentation "Class of errors signaled when a particular part of the action chain (session, frame, param-action or action) is specified in the request but the corresponding server side object can't be found."))
(define-condition inexistent-application-name (inexistent-request-part) () (:documentation "Signalled when the server can't determine an application for a particular request."))
(define-condition inexistent-entry-point (inexistent-request-part) ((application :initarg :application) (action-name :initarg :action-name)))
(define-condition inexistent-session-id (inexistent-request-part) ((application :initarg :application) (session-id :initarg :session-id)))
(define-condition inexistent-frame-id (inexistent-request-part) ((session :initarg :session) (frame-id :initarg :frame-id)))
(define-condition inexistent-callback-id (inexistent-request-part) ((application :initarg :application) (session :initarg :session) (frame :initarg :frame) (callback-id :initarg :callback-id)))
(define-condition inexistent-action-id (inexistent-request-part) ((frame :initarg :frame) (action-id :initarg :action-id)))
(define-condition badly-formatted-request (rerl-error) () (:documentation "Class of errors signaled when a particular id (application, session, frame or action) is not found in the request."))
(define-condition session-id-missing (badly-formatted-request) ())
(define-condition frame-id-missing (badly-formatted-request) ())
(define-condition action-id-missing (badly-formatted-request) ())
(define-condition callback-error (rerl-error) () (:documentation "An error has occured while handling a callback."))
(define-condition action-error (rerl-error) () (:documentation "An error has occured during the execution of an action."))
(define-condition render-error (rerl-error) () (:documentation "An error has occured while rendering a component."))
Constant +SESSION-ID-LENGTH+ Length, in chars, of the automatically generated session ids.
Constant +FRAME-ID-LENGTH+ Length, in chars, of the automatically generated frame ids.
Constant +ACTION-ID-LENGTH+ Length, in chars, of the automatically generates action ids.