Send JSON data to compojure server from android

I'm trying to send some json data from Android to a clojure/compojure server

However I can't seem to able to properly send or receive the data, and I'm not quite sure if the problem lies with Android or compojure.

Here is the java code

String PATH = "http://localhost:8080/get_position";
DefaultHttpClient mClient = new DefaultHttpClient();

HttpGet httpget = new HttpGet(PATH);
HttpResponse response;
httpget.getParams().setParameter("measurements", measurements.toString());

response = mClient.execute(httpget);
HttpEntity entity = response.getEntity();

Where mesurements is the JSON object.

And the main compojure code for handling the routing

(defroutes main-routes
   (POST "/get_position" {params :params}
      (emit-json (find-location (:results (read-json (:measurements params))))))
   (route/not-found "Page not found"))

The request is properly received, but I get an error that params is nil

java.lang.IllegalArgumentException: No implementation of method: :read-json-from of protocol: #' found for class: nil   

Does anyone see a problem with this code or knows the correct way to do this?


The params map has strings as keys, I believe, not keywords.

I recommend using ring-json-params.

Need Your Help

Page keeps on loading when open a URL

php javascript apache

The page keeps on loading when open link. On some pages it is fixed by putting exit(); after header('location:link'); statement.

why do javascript functions evaluated onload

java javascript html jsp

Question: Any ideas how to NOT trigger the confirmOption function on page load, and only trigger it when the button is clicked?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.