aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Sierra <mail@stuartsierra.com>2009-08-15 15:57:46 -0400
committerStuart Sierra <mail@stuartsierra.com>2009-08-15 16:14:25 -0400
commitee6e4bf2d912419dd180b712d32e817a479f14e8 (patch)
treeb7387eb7d2e489a1829b7339cb2d3f1516635db6
parentf1dac079c1fec627a68919a3e3984a769b0739b7 (diff)
http/connection.clj: added type hints
-rw-r--r--src/clojure/contrib/http/connection.clj14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/clojure/contrib/http/connection.clj b/src/clojure/contrib/http/connection.clj
index 0e975cd9..4eda0fa6 100644
--- a/src/clojure/contrib/http/connection.clj
+++ b/src/clojure/contrib/http/connection.clj
@@ -27,32 +27,32 @@
#^{:doc "Transmits a request entity body."}
send-request-entity (fn [conn entity] (type entity)))
-(defmethod send-request-entity duck/*byte-array-type* [conn entity]
+(defmethod send-request-entity duck/*byte-array-type* [#^HttpURLConnection conn entity]
(.setFixedLengthStreamingMode conn (count entity))
(.connect conn)
(duck/copy entity (.getOutputStream conn)))
-(defmethod send-request-entity String [conn entity]
+(defmethod send-request-entity String [conn #^String entity]
(send-request-entity conn (.getBytes entity duck/*default-encoding*)))
-(defmethod send-request-entity File [conn entity]
+(defmethod send-request-entity File [#^HttpURLConnection conn #^File entity]
(.setFixedLengthStreamingMode conn (.length entity))
(.connect conn)
(duck/copy entity (.getOutputStream conn)))
-(defmethod send-request-entity InputStream [conn entity]
+(defmethod send-request-entity InputStream [#^HttpURLConnection conn entity]
(.setChunkedStreamingMode conn -1)
(.connect conn)
(duck/copy entity (.getOutputStream conn)))
-(defmethod send-request-entity Reader [conn entity]
+(defmethod send-request-entity Reader [#^HttpURLConnection conn entity]
(.setChunkedStreamingMode conn -1)
(.connect conn)
(duck/copy entity (.getOutputStream conn)))
(defn start-http-connection
- ([conn] (.connect conn))
- ([conn request-entity-body]
+ ([#^HttpURLConnection conn] (.connect conn))
+ ([#^HttpURLConnection conn request-entity-body]
(if request-entity-body
(do (.setDoOutput conn true)
(send-request-entity conn request-entity-body))