Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for clojure v1.3 #12

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@
.*sw*
*.jar
*.class
.lein-*
75 changes: 75 additions & 0 deletions pom.xml
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?><project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.twinql.clojure</groupId>
<artifactId>clj-apache-http</artifactId>
<version>2.3.1</version>
<name>clj-apache-http</name>
<description>Clojure HTTP library using the Apache HttpClient.</description>
<scm>
<connection>scm:git:git://github.com/roman/clj-apache-http.git</connection>
<developerConnection>scm:git:ssh://git@github.com/roman/clj-apache-http.git</developerConnection>
<tag>3d3de1da943ec7dfac5c7c419f5a31efdbf368ff</tag>
<url>https://github.com/roman/clj-apache-http</url>
</scm>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>test-resources</directory>
</testResource>
</testResources>
</build>
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>clojars</id>
<url>http://clojars.org/repo/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>data.json</artifactId>
<version>0.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.0.1</version>
</dependency>
</dependencies>
</project>
<!-- This file was autogenerated by Leiningen.
Please do not edit it directly; instead edit project.clj and regenerate it.
It should not be considered canonical data. For more information see
https://github.com/technomancy/leiningen -->
7 changes: 3 additions & 4 deletions project.clj
@@ -1,8 +1,7 @@
(defproject com.twinql.clojure/clj-apache-http "2.3.1"
(defproject com.twinql.clojure/clj-apache-http "2.3.2-SNAPSHOT"
:description "Clojure HTTP library using the Apache HttpClient."
:dev-dependencies [[leiningen/lein-swank "1.1.0"]]
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/data.json "0.1.2"]
[org.apache.httpcomponents/httpcore "4.0.1"]
[org.apache.httpcomponents/httpmime "4.0.1"]
[commons-logging/commons-logging "1.1.1"]
Expand Down
10 changes: 5 additions & 5 deletions src/com/twinql/clojure/http.clj
Expand Up @@ -2,8 +2,8 @@
(:refer-clojure :exclude [get])
(:use clojure.set)
(:require
[clojure.contrib.io :as io]
[clojure.contrib.json :as json])
[clojure.java.io :as io]
[clojure.data.json :as json])
(:import
(java.lang Exception)
(java.net URI)
Expand Down Expand Up @@ -205,17 +205,17 @@

(defmethod entity-as :string [#^HttpEntity entity as status]
(with-open [#^InputStream stream (.getContent entity)]
(io/slurp* stream)))
(slurp stream)))

;;; JSON handling.
;;; We prefer keywordizing.
(defmethod entity-as :json [#^HttpEntity entity as status]
(with-open [#^InputStream stream (.getContent entity)]
(clojure.contrib.json/read-json (io/reader stream) true)))
(json/read-json (io/reader stream) true)))

(defmethod entity-as :json-string-keys [#^HttpEntity entity as status]
(with-open [#^InputStream stream (.getContent entity)]
(clojure.contrib.json/read-json (io/reader stream) false)))
(json/read-json (io/reader stream) false)))


;;; To avoid overhead in shutting down a ClientConnectionManager,
Expand Down