           word #(keyword (.group % 1))
           path nil)))))
  
-(defn match-route
+(defn- match-route
   "Match a path against a parsed route. Returns a map of keywords and their
   matching path values."
   [route path]

;; HTTP resource library for Compojure
(ns compojure.http)
 
(use '(compojure control
                 file-utils
                 parser
                 str-utils))
 
(import '(java.io File FileInputStream)
        '(javax.servlet ServletContext)
        '(javax.servlet.http HttpServlet
                             HttpServletRequest
                             HttpServletResponse))
;;;; Mimetypes ;;;;
 
(defn context-mimetype

          (route :keywords)
          (rest (re-groups matcher)))))))
 
;;;; Handler functions ;;;;
 
(defstruct http-handler
  :method
  :route
  :function)
 
(defn get-session
  "Returns a ref to a hash-map that acts as a HTTP session that can be updated
  within a Clojure STM transaction."
  [#^HttpServletRequest request]
  (let [session (.getSession request)]
    (or (.getAttribute session "clj-session")
        (let [clj-session (ref {})]
          (.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 (str %))
             session   (compojure.http/get-session request)]
       (do ~@body))))
 
(defn- find-method
  "Returns either the value of the '_method' HTTP parameter, or the method
  of the HTTP request."
  [#^HttpServletRequest request]
  (or (.getParameter request "_method")
      (.getMethod request)))
 
(defn- update-response
  "Destructively update a HttpServletResponse using a Clojure datatype:
    string - Adds to the response body
    seq - Adds all containing elements to the response body
