Hi, I'm using Shoreleave in one of our projects and it works fine for us. I followed the same tutorial and everything was OK.
I've seen something similar when I was using the autogeneration of the js file. For some reason after updating the cljs the continuous compilation breaks the shoreleave RPC. When it happens I fix it by cleaning and compiling the whole thing again. Tony. On Sunday, 21 July 2013 16:08:07 UTC+1, Alex Fowler wrote: > > Considering the severity of the bug that i found, i want to ask if someone > is using Shoreleave's rpc without any problems? Maybe it's me missing > something? Or maybe someone run into the same problem too? > > On Saturday, July 20, 2013 2:16:02 PM UTC+4, Alex Fowler wrote: >> >> That wasn't hte case either. After some buzz with ddellacosta and others >> on #clojure, it was found that the RPC call is unable to find that very >> remote procedure I was requesting. Then I have verified that all is >> properly stored in the remote procedures registry on backend and that the >> front end makes proper calls. The problem was that the backend was >> expecting edn while the frontend was sending it in html-form format in >> request body. I am just a beginner with Clojure's web stack, so I think >> that maybe I missed some wrappers with Noir or Ring, but I was doing all >> according to the tutorial and it failed to work. So I had to manually >> override several functions from Shoreleave back-end and front-end to behave >> coherently and send and receive data in edn format. I think this makes a >> patch for the library since the RPC functionality is broken out-of-the-box. >> Unless I am missing something crucial, but examples I found miss that >> either... >> >> >> >> четверг, 18 июля 2013 г., 15:42:35 UTC+4 пользователь terjesb написал: >>> >>> The default /_shoreleave endpoint should work if you're running using >>> lein ring server. >>> >>> Are you running a WAR in a container? If so, I don't think Shoreleave >>> currently picks up the context. If you have only one client app, you could >>> proxy this using nginx in front on your container. For multiple client apps >>> (also standalone, without a container), you may need to do what I did: >>> >>> override default "/_shoreleave" in your app: (wrap-rpc >>> "/your-context/_shoreleave") >>> >>> and then (binding [shoreleave.remotes.http-rpc/*remote-uri* >>> "/your-context/_shoreleave"] ) around your client calls. >>> >>> Terje. >>> >>> >>> >>> >>> kl. 10:50:17 UTC+2 mandag 15. juli 2013 skrev Alex Fowler følgende: >>>> >>>> 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.