     (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

          (.setAttribute session "clj-session" clj-session)
          clj-session))))
 
(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)]
       (do ~@body))))
 
(defn- find-method


;;;; Helper functions ;;;;

(defn cookie
  "Create a new Cookie object."
  [name value & attrs]
  (let [cookie (new Cookie (str* name) value)
        attrs  (apply hash-map attrs)
        iff    (fn [attr func] (if attr (func attr)))]
    (iff (attrs :comment) #(.setComment cookie %))
    (iff (attrs :domain)  #(.setDomain  cookie %))
    (iff (attrs :max-age) #(.setMaxAge  cookie %))
    (iff (attrs :path)    #(.setPath    cookie %))
    (iff (attrs :secure)  #(.setSecure  cookie %))
    (iff (attrs :version) #(.setVersion cookie %))
    cookie))
 
(defn redirect-to
  "A shortcut for a '302 Moved' HTTP redirect."
  [location]
