     (.setHandler handler)
     (.setMimeTypes (gzip-excluded-mime-types))
     (.setExcludeMimeTypes true)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Handler Helper Functions
+
+(sm/defn ^:always-validate
+  add-handler :- ContextHandler
+  [webserver-context :- WebserverServiceContext
+   handler :- ContextHandler]
+  (.addHandler (:handlers webserver-context) handler)
+  handler)
+
+(defn- ring-handler
+  "Returns an Jetty Handler implementation for the given Ring handler."
+  [handler]
+  (proxy [AbstractHandler] []
+    (handle [_ ^Request base-request request response]
+      (let [request-map  (servlet/build-request-map request)
+            response-map (handler request-map)]
+        (when response-map
+          (servlet/update-servlet-response response response-map)
+          (.setHandled base-request true))))))
 
 (sm/defn ^:always-validate
   proxy-servlet :- ProxyServlet

  [webserver-context :- WebserverServiceContext]
  (instance? Server (:server webserver-context)))

(defn- ring-handler
  "Returns an Jetty Handler implementation for the given Ring handler."
  [handler]
  (proxy [AbstractHandler] []
    (handle [_ ^Request base-request request response]
      (let [request-map  (servlet/build-request-map request)
            response-map (handler request-map)]
        (when response-map
          (servlet/update-servlet-response response response-map)
          (.setHandled base-request true))))))

; TODO: move
(sm/defn ^:always-validate
  ssl-context-factory :- SslContextFactory
  "Creates a new SslContextFactory instance from a map of options."

    (.setHandler s (gzip-handler hc))
    (assoc webserver-context :server s)))

(sm/defn ^:always-validate start-webserver! :- WebserverServiceContext
  "Creates and starts a webserver.  Returns an updated context map containing
  the Server object."
