;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- ;;; $Header: src/server.lisp $ ;;; Copyright (c) 2008, Andrea Chiumenti. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions ;;; are met: ;;; * Redistributions of source code must retain the above copyright ;;; notice, this list of conditions and the following disclaimer. ;;; * Redistributions in binary form must reproduce the above ;;; copyright notice, this list of conditions and the following ;;; disclaimer in the documentation and/or other materials ;;; provided with the distribution. ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (in-package :claw) (defgeneric clawserver-dispatch-request (clawserver) (:documentation "Dispatches http requests through registered dispatchers")) (defgeneric clawserver-dispatch-method (clawserver) (:documentation "Uses CLAWSERVER-DISPATCH-REQUEST to perform dispatching")) (defgeneric clawserver-start (clawserver) (:documentation "Starts the server")) (defgeneric clawserver-stop (clawserver) (:documentation "Stops the server")) (defgeneric (setf clawserver-port) (port clawserver) (:documentation "Sets the claw server http port. When server is started an error will be signaled.")) (defgeneric (setf clawserver-sslport) (sslport clawserver) (:documentation "Sets the claw server https port. When server is started an error will be signaled.")) (defgeneric (setf clawserver-address) (address clawserver) (:documentation "Binds the claw server to a specific address. When server is started an error will be signaled.")) (defgeneric (setf clawserver-name) (name clawserver) (:documentation "Sets the name of the server that dispatches http requests.")) (defgeneric (setf clawserver-sslname) (sslname clawserver) (:documentation "Sets the name of the server that dispatches https requests.")) (defgeneric (setf clawserver-mod-lisp-p) (mod-lisp-p clawserver) (:documentation "When not null binds the claw server to apache using mod_lisp2. When server is started an error will be signaled.")) (defgeneric (setf clawserver-use-apache-log-p) (apache-log-p clawserver) (:documentation "When boud to apache with mod_lisp2 if not nil, uses apache logging. When server is started an error will be signaled.")) (defgeneric (setf clawserver-input-chunking-p) (input-chunking-p clawserver) (:documentation "Sets input-chunking-p, when true the server will accept request bodies without a Content-Length header if the client uses chunked transfer encoding. If you want to use this feature behind mod_lisp, you should make sure that your combination of Apache and mod_lisp can cope with that. When server is started an error will be signaled.")) (defgeneric (setf clawserver-read-timeout) (read-timeout clawserver) (:documentation "Sets the read timeout in seconds. When server is started an error will be signaled.")) (defgeneric (setf clawserver-write-timeout) (write-timeout clawserver) (:documentation "Sets the write timeout in seconds. When server is started an error will be signaled.")) #+(and :unix (not :win32)) (defgeneric (setf clawserver-setuid) (setuid clawserver) (:documentation "Sets the uid under which the server runs (Only for *NIX). When server is started an error will be signaled.")) #+(and :unix (not :win32)) (defgeneric (setf clawserver-setgid) (setgid clawserver) (:documentation "Sets the gid under which the server runs (Only for *NIX). When server is started an error will be signaled.")) #-:hunchentoot-no-ssl (defgeneric (setf clawserver-ssl-certificate-file) (certificate-file clawserver) (:documentation "The ssl certificate file for https connections. When server is started an error will be signaled.")) #-:hunchentoot-no-ssl (defgeneric (setf clawserver-ssl-privatekey-file) (ssl-privatekey-file clawserver) (:documentation "The ssl private key file for https connections. When server is started an error will be signaled.")) #-:hunchentoot-no-ssl (defgeneric (setf clawserver-ssl-privatekey-password) (ssl-privatekey-password clawserver) (:documentation "The password for the ssl private key file. When server is started an error will be signaled.")) (defgeneric clawserver-register-configuration(clawserver realm configuration) (:documentation "Registers a configuration object for the given realm into the server. The configuration will perform the authentication logic.")) (defgeneric configuration-login (configuration &optional request) (:documentation "Authenticate a user creating a principal object that will be stored into the http session. If no session is present one will be created, if the authentication succeds the principal instance is returned")) (defclass error-page (page) ((title :initarg :title :reader page-title :documentation "The page title") (error-code :initarg :error-code :reader page-error-code :documentation "The error code to display")) (:documentation "This is the page class used to render the http error messages.")) (defclass error-page-template (wcomponent) ((title :initarg :title :reader title :documentation "The page title") (error-code :initarg :error-code :reader error-code :documentation "The http error code. For details consult http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html") (style :initarg :style :reader style :documentation "The CSS