Permalink
Browse files

Remove most reflection.

  • Loading branch information...
1 parent 6b1dece commit fa8c6f139714c67b98843405ef9a3ab39292ad55 @mmcgrana committed Mar 3, 2010
View
2 ring-core/src/ring/middleware/multipart_params.clj
@@ -11,7 +11,7 @@
(defn- multipart-form?
"Does a request have a multipart form?"
[request]
- (if-let [content-type (:content-type request)]
+ (if-let [#^String content-type (:content-type request)]
(.startsWith content-type "multipart/form-data")))
(defvar- file-upload
View
4 ring-core/src/ring/middleware/session/cookie.clj
@@ -59,7 +59,7 @@
[options]
(if-let [secret-key (:key options)]
(if (string? secret-key)
- (.getBytes secret-key)
+ (.getBytes #^String secret-key)
secret-key)
(secure-random-bytes 16)))
@@ -71,7 +71,7 @@
(defn- unseal
"Retrieve a sealed Clojure data structure from a string"
- [key string]
+ [key #^String string]
(let [[data mac] (.split string "--")
data (codec/base64-decode data)]
(if (= mac (hmac key data))
View
2 ring-core/src/ring/util/codec.clj
@@ -17,5 +17,5 @@
(defn base64-decode
"Decode a base64 encoded string into an array of bytes."
- [encoded]
+ [#^String encoded]
(Base64/decodeBase64 (.getBytes encoded)))
View
10 ring-core/src/ring/util/response.clj
@@ -21,23 +21,23 @@
(defn- safe-path?
"Is a filepath safe for a particular root?"
- [root path]
+ [#^String root #^String path]
(.startsWith (.getCanonicalPath (File. root path))
(.getCanonicalPath (File. root))))
(defn- find-index-file
"Search the directory for an index file."
- [dir]
+ [#^File dir]
(first
(filter
- #(.startsWith (.toLowerCase (.getName %)) "index.")
+ #(.startsWith (.toLowerCase (.getName #^File %)) "index.")
(.listFiles dir))))
(defn- get-file
"Safely retrieve the correct file. See static-file for an
explanation of options."
- [path opts]
- (let [file (if-let [root (:root opts)]
+ [#^String path opts]
+ (let [file (if-let [#^String root (:root opts)]
(if (safe-path? root path)
(File. root path))
(File. path))]

0 comments on commit fa8c6f1

Please sign in to comment.