From xlopez at common-lisp.net Thu Sep 3 06:11:22 2009 From: xlopez at common-lisp.net (Xan Lopez) Date: Thu, 03 Sep 2009 02:11:22 -0400 Subject: [ht-ajax-cvs] r2 - Message-ID: Author: xlopez Date: Thu Sep 3 02:11:21 2009 New Revision: 2 Log: Port to Hunchentoot 1.0 APIs Patch by Andrew Stine. Modified: ht-ajax.lisp Modified: ht-ajax.lisp ============================================================================== --- ht-ajax.lisp (original) +++ ht-ajax.lisp Thu Sep 3 02:11:21 2009 @@ -161,11 +161,11 @@ (let ((content-type (getf funcallable-plist :content-type))) ;; Can't use the default parameter of getf since it may be present but null - (setf (content-type) (or content-type + (setf (content-type*) (or content-type (when (getf funcallable-plist :json) (json-content-type)) (default-content-type processor)))) (when (default-reply-external-format processor) - (setf (reply-external-format) (default-reply-external-format processor))) + (setf (reply-external-format*) (default-reply-external-format processor))) (unless (getf funcallable-plist :allow-cache) (no-cache)) @@ -173,13 +173,13 @@ (defun handle-virtual-file (processor) - (let* ((file-name (string-downcase (script-name))) + (let* ((file-name (string-downcase (script-name*))) (file-record (assoc file-name (virtual-files processor) :test 'equal))) (when file-record (let ((time (cddr file-record))) (handle-if-modified-since time) ; Does not return if the file was not modified - (setf (content-type) "text/javascript") + (setf (content-type*) "text/javascript") (setf (header-out "Last-Modified") (rfc-1123-date time)) ;;(setf (header-out "Expires") (rfc-1123-date (+ time #.(* 60 60 2)))) (cadr file-record))))) @@ -281,8 +281,10 @@ (string-downcase (make-safe-js-name function-name)))) -(defun maybe-rewrite-url-for-session (url &key (cookie-name *session-cookie-name*) - (value (hunchentoot::session-cookie-value))) +(defun maybe-rewrite-url-for-session (url &key (cookie-name (hunchentoot:session-cookie-name hunchentoot:*acceptor*)) + (value (let ((session (session *request*))) + (when session + (hunchentoot::session-cookie-value session))))) "Modelled after (well, copied from) HUNCHENTOOT::MAYBE-REWRITE-URLS-FOR-SESSION. Rewrites the URL such that the name/value pair COOKIE-NAME/COOKIE-VALUE is inserted if the client hasn't sent a