Author: hhubner Date: Fri Jan 18 07:05:32 2008 New Revision: 2353
Modified: branches/bos/bknr/src/web/handlers.lisp branches/bos/bknr/src/web/web-utils.lisp branches/bos/projects/bos/web/tags.lisp branches/bos/projects/bos/web/webserver.lisp Log: redirect with http response code 301 instead of 302, hoping that it will make google analytics happy
Modified: branches/bos/bknr/src/web/handlers.lisp ============================================================================== --- branches/bos/bknr/src/web/handlers.lisp (original) +++ branches/bos/bknr/src/web/handlers.lisp Fri Jan 18 07:05:32 2008 @@ -259,7 +259,7 @@ ((to :initarg :to :reader redirect-handler-to :documentation "url to redirect to")))
(defmethod handle ((page-handler redirect-handler) req) - (redirect (redirect-handler-to page-handler) req)) + (redirect (redirect-handler-to page-handler) req *response-moved-permanently*))
(defclass random-redirect-handler (redirect-handler) ())
Modified: branches/bos/bknr/src/web/web-utils.lisp ============================================================================== --- branches/bos/bknr/src/web/web-utils.lisp (original) +++ branches/bos/bknr/src/web/web-utils.lisp Fri Jan 18 07:05:32 2008 @@ -16,8 +16,8 @@ (with-http-body (req *ent*) (html "The page you requested could not be found."))))
-(defun redirect (to req) - (with-bknr-http-response (req :response *response-found*) +(defun redirect (to req &optional (response-code *response-found*)) + (with-bknr-http-response (req :response response-code) (setf (reply-header-slot-value req :location) to) (with-http-body (req *ent*))))
Modified: branches/bos/projects/bos/web/tags.lisp ============================================================================== --- branches/bos/projects/bos/web/tags.lisp (original) +++ branches/bos/projects/bos/web/tags.lisp Fri Jan 18 07:05:32 2008 @@ -176,4 +176,4 @@ "var gaJsHost = (('https:' == document.location.protocol) ? 'https://ssl.' : 'http://www.'); document.write(unescape('%3Cscript src=%22' + gaJsHost + 'google-analytics.com/ga.js%22 type=%22text/javascript%22%3E%3C/script%3E'));") ((:script :type "text/javascript") - #?"if (_gat) { var pageTracker = _gat._getTracker('$(*google-analytics-account*)'); pageTracker._initData(); pageTracker._trackPageview(); }"))) + (:princ #?"if (_gat) { var pageTracker = _gat._getTracker('$(*google-analytics-account*)'); pageTracker._initData(); pageTracker._trackPageview(); }"))))
Modified: branches/bos/projects/bos/web/webserver.lisp ============================================================================== --- branches/bos/projects/bos/web/webserver.lisp (original) +++ branches/bos/projects/bos/web/webserver.lisp Fri Jan 18 07:05:32 2008 @@ -94,7 +94,8 @@ (defmethod handle ((handler index-handler) req) (redirect (format nil "/~A/index" (or (find-browser-prefered-language req) *default-language*)) - req)) + req + *response-moved-permanently*))
(defclass infosystem-handler (page-handler) ())