       ;; TODO: internal configuration lookup
       "application/octet-stream")))
 
+(defn open-output-stream-for-asset
+  "Configures the response in preperation for writing content."
+  [#^HttpServletResponse response #^URL asset-url #^String mime-type]
+  (let [#^URLConnection connection (.openConnection asset-url)
+        last-modified (.getLastModified connection)
+        content-length (.getContentLength connection)]
+    (if-not (zero? content-length)
+      (.setContentLength response content-length))
+    (doto response
+      (.setDateHeader "Last-Modified" last-modified)
+      (.setDateHeader "Expires"  ten-years-from-now)
+      (.setContentType mime-type))
+    (.getOutputStream response)))
+                 
 (defn asset-request-dispatcher
   "Processes a request for an asset. The domain-name is used in exceptions. url-provider is a function passed
   an asset-path string that returns a URL for the asset, or nil if not found."

  #^{:doc "Asset management"}
  cascade.asset
  (:import
    (javax.servlet ServletContext)
    (javax.servlet.http HttpServletRequest HttpServletResponse))
  (:require


(assoc-in-config :asset-blacklist
  [#"\.class$", #"\.clj$"])

(def ten-years-from-now
  (+ (System/currentTimeMillis) (* 1000 60 60 24 365 10)))

;; Assets represents files stored either under the web context or stored within the classpath.
;; Identifying an asset will eventually incorporate a locale-specific search. Ultimately,
