     (instance? File update)
       (send-stream context response (new FileInputStream update) update)
     (instance? URL update)
-      (send-stream context response (.openStream update) update)))
+      (send-stream context response (.openStream update) update)
+    (instance? Cookie update)
+      (.addCookie response update)))
         
 (defn- apply-http-handler
   "Finds and evaluates the handler that matches the HttpServletRequest. If the

                    FileInputStream)
           (java.net URL)
           (javax.servlet ServletContext)
           (javax.servlet.http HttpServlet
                               HttpServletRequest
                               HttpServletResponse)))
;;;; Mimetypes ;;;;

          (.setAttribute session "clj-session" clj-session)
          clj-session))))
 
(defn get-cookie-map
  "Creates a name/value map from all of the cookies in the request."
  [request]
  (apply hash-map
    (mapcat (fn [cookie] [(keyword (.getName cookie))
                          (.getValue cookie)])
            (.getCookies request))))

(defmacro handler-fn
  "Macro that wraps the body of a handler up in a standalone function."
  [& body]
  `(fn ~'[route context request]
     (let ~'[method     (.getMethod    request)
             full-path  (.getPathInfo  request)
             param     #(.getParameter request (compojure.str-utils/str* %))
             header    #(.getHeader    request (compojure.str-utils/str* %))
             mimetype  #(compojure.http/context-mimetype context (str %))
             session    (compojure.http/get-session request)
             cookie-map (compojure.http/get-cookie-map request)]
       (do ~@body))))
 
(defn- find-method
