Did not work.. all that is strange since I've been following the manual step-by-step.. looks like the shoreleave's wrapper does not even create a http route for itself... any other ideas?
On Friday, July 12, 2013 7:14:42 AM UTC+4, Samrat Man Singh wrote: > > I think you need to (use projectname.ajax) in your projectname.handler > page. If I remember correctly, there's also a way to specify which > namespace your remote function is in. > > On Thursday, July 11, 2013 10:42:15 PM UTC+5:45, Alex Fowler wrote: >> >> Hi all, this is my first experience with Shoreleave and I'm trying to use >> it's RPC mechanism to perform AJAX tasks. However, on a call to a remote >> procedure, I get this: >> >> ` >> >> 1. POST http://localhost:8080/_shoreleave 404 (Not Found) >> cljs.js:25223 <http://localhost:8080/js/cljs.js> >> 1. goog.net.XhrIo.sendcljs.js:25223<http://localhost:8080/js/cljs.js> >> 2. xhr__delegatecljs.js:31416 <http://localhost:8080/js/cljs.js> >> 3. xhrcljs.js:31423 <http://localhost:8080/js/cljs.js> >> 4. >> remote_callback__delegatecljs.js:32504<http://localhost:8080/js/cljs.js> >> 5. remote_callbackcljs.js:32515 <http://localhost:8080/js/cljs.js> >> 6. load_storecljs.js:32745 <http://localhost:8080/js/cljs.js> >> 7. >> mk__AMPERSAND__load_store__delegatecljs.js:32755<http://localhost:8080/js/cljs.js> >> 8. >> mk__AMPERSAND__load_storecljs.js:32763<http://localhost:8080/js/cljs.js> >> 9. example_storecljs.js:33341 <http://localhost:8080/js/cljs.js> >> 10. simplecljs.js:33361 <http://localhost:8080/js/cljs.js> >> 11. setup_guicljs.js:33962 <http://localhost:8080/js/cljs.js> >> 12. setup_allcljs.js:33982 <http://localhost:8080/js/cljs.js> >> 13. startupcljs.js:41166 <http://localhost:8080/js/cljs.js> >> 14. onloadapp:2 <http://localhost:8080/app> >> >> XHR ERROR: Not Found >> ` >> >> What is wrong and how do I fix it? I have been following this tutorial: >> Shoreleave >> Tutorial 10 - Introducing >> Ajax<https://github.com/magomimmo/modern-cljs/blob/master/doc/tutorial-10.md> >> my >> code (relevant parts) is this: >> >> Project.clj: >> ` >> (defproject projectname "0.1.0-SNAPSHOT" >> :description "FIXME: write description" >> :url "http://example.com/FIXME" >> :dependencies [[org.clojure/clojure "1.5.1"] >> [lib-noir "0.6.3"] >> [compojure "1.2.0-SNAPSHOT"] >> [ring-server "0.2.8"] >> [clabango "0.5"] >> [hiccup "1.0.3"] >> [com.taoensso/timbre "2.1.2"] >> [com.taoensso/tower "1.7.1"] >> [markdown-clj "0.9.26"] >> >> ; -- ajax >> [shoreleave "0.3.0"] >> [shoreleave/shoreleave-remote-ring "0.3.0"] >> [shoreleave/shoreleave-remote "0.3.0"] >> >> ; -- cljs >> [com.keminglabs/singult "0.1.6"] >> [enfocus "1.0.1"] >> [jayq "2.3.0"] >> ] >> :plugins [[lein-ring "0.8.5"] >> [lein-cljsbuild "0.3.2"]] >> :hooks [leiningen.cljsbuild] >> :cljsbuild { >> :builds [{ >> :jar true >> :source-paths ["src/family/webapp"] >> :compiler { >> :output-to >> "resources/public/js/cljs.js" >> :optimizations :whitespace >> :externs ["externs/jquery-1.9.js"] >> :pretty-print true}}]} >> :ring {:handler projectname.handler/war-handler >> :init projectname.handler/init >> :destroy projectname.handler/destroy} >> :profiles >> {:production {:ring {:open-browser? false >> :stacktraces? false >> :auto-reload? false}} >> :dev {:dependencies [[ring-mock "0.1.5"] >> [ring/ring-devel "1.1.8"]]}} >> :min-lein-version "2.0.0") >> ` >> >> Handler: >> ` >> (ns projectname.handler >> (:use projectname.routes.home >> compojure.core) >> (:require [noir.util.middleware :as middleware] >> [compojure.route :as route] >> [shoreleave.middleware.rpc :refer [wrap-rpc]])) >> >> (def all-routes [home-routes app-routes]) >> >> (def app (-> all-routes >> middleware/app-handler >> wrap-rpc >> ;;add your middlewares here >> )) >> >> (def war-handler (middleware/war-handler app)) >> ` >> >> Remote procedure declaration: >> ` >> (ns projectname.ajax >> (:require [shoreleave.middleware.rpc :refer [defremote]])) >> >> (defremote my-remote-proc [some-arg] (println "remote call ok" some-arg) >> some-arg) >> ` >> >> Client side ClojureScript code: >> ` >> (ns projectname.webapp.model.store >> (:require >> [shoreleave.remotes.http-rpc :refer [remote-callback]])) >> >> (defn do-smth-useful [useful-args] >> (log "This is the last log statement that get's printed") >> (remote-callback :my-remote-proc [useful-args] #(process-feedback %)) >> ` >> >> Thanks! >> > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.