ring

No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil

流过昼夜 提交于 2019-12-07 07:32:52
问题 I'm very new to Clojure and I'm having a great time playing with it. One thing I'm having some trouble with is how to read the errors, I personally think they're not very descriptive, but that's probably due to my "newbieness". For example, the issue I'm having now is when I try to start up my ring server (I can provide more details if needed): Started server on port 3000 java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory

Compojure handler friend/authenticate eats body of POST request

核能气质少年 提交于 2019-12-07 05:56:42
问题 How can I safely get the content of the :body InputStream from compojure? See related but different question for background. I'm trying to authenticate my ring routes with Friend using compojure handler/site but when I try to read the :body from an http POST request (which is a Java InputStream ), it is closed: 23:01:20.505 ERROR [io.undertow.request] (XNIO-1 task-3) Undertow request failed HttpServerExchange{ POST /paypal/ipn} java.io.IOException: UT000034: Stream is closed at io.undertow.io

How can I use ring anti-forgery / CSRF token with latest version ring/compojure?

血红的双手。 提交于 2019-12-07 01:27:25
问题 I copied some old code that was working in compojure 1.1.18 and other old libs, but using the latest versions I can't get it to work. Here's my minimal example code copied from the minimal example here to demonstrate that with latest ring and compojure libraries, I get an error when I send an http POST , even with the header set. lein ring server to start it, then do curl -X GET --cookie-jar cookies "http://localhost:3000/" which results in something like this: {"csrf-token":"7JnNbzx8BNG

lein ring server with nrepl doesn't honour cider-nrepl

时光怂恿深爱的人放手 提交于 2019-12-06 02:12:00
问题 When I start up my current project with lein ring server and try to connect to it from Emacs via cider, I get the following warning: ; CIDER 0.8.2 (Java 1.7.0_51, Clojure 1.6.0, nREPL 0.2.6) WARNING: The following required nREPL ops are not supported: apropos classpath complete eldoc info inspect-start inspect-refresh inspect-pop inspect-push inspect-reset macroexpand ns-list ns-vars resource stacktrace toggle-trace-var toggle-trace-ns undef Please, install (or update) cider-nrepl 0.8.2 and

聊聊rocketmq的AllocateMessageQueueConsistentHash

我是研究僧i 提交于 2019-12-05 20:37:57
序 本文主要研究一下rocketmq的AllocateMessageQueueConsistentHash AllocateMessageQueueStrategy rocketmq-client-4.5.2-sources.jar!/org/apache/rocketmq/client/consumer/AllocateMessageQueueStrategy.java public interface AllocateMessageQueueStrategy { /** * Allocating by consumer id * * @param consumerGroup current consumer group * @param currentCID current consumer id * @param mqAll message queue set in current topic * @param cidAll consumer set in current consumer group * @return The allocate result of given strategy */ List<MessageQueue> allocate( final String consumerGroup, final String currentCID, final

idiomatic way to catch exceptions in ring apps

僤鯓⒐⒋嵵緔 提交于 2019-12-05 20:16:05
问题 What is the idiomatic way to handle exceptions in ring apps. I would like to capture the exception and return a 500 page. How do I do that ? I am using moustache for the code below, however it doesnt work - (def my-app (try (app (wrap-logger true) wrap-keyword-params wrap-params wrap-file-info (wrap-file "resources/public/") [""] (index-route @prev-h nil) ["getContent"] (fetch-url) ["about"] "We are freaking cool man !!" [&] (-> "Nothing was found" response (status 404) constantly)) (catch

How can I add a build step to leiningen?

淺唱寂寞╮ 提交于 2019-12-05 17:13:25
So I've got an application built using Foundation and Ring, and I want to be able to compile my custom Foundation CSS whenever I run lein ring server or the like. Specifically, I'd like to be able to add a step the runs compass compile [path] . What's the idiomatic way to do this? I would say, Leiningen Hooks are the proper and idiomatic way to do so: Hooks . You can modify the behaviour of built-in tasks to a degree using hooks. Hook functionality is provided by the Robert Hooke library, which is included with Leiningen. 来源: https://stackoverflow.com/questions/18199188/how-can-i-add-a-build

Compojure handler friend/authenticate eats body of POST request

杀马特。学长 韩版系。学妹 提交于 2019-12-05 10:55:35
How can I safely get the content of the :body InputStream from compojure? See related but different question for background. I'm trying to authenticate my ring routes with Friend using compojure handler/site but when I try to read the :body from an http POST request (which is a Java InputStream ), it is closed: 23:01:20.505 ERROR [io.undertow.request] (XNIO-1 task-3) Undertow request failed HttpServerExchange{ POST /paypal/ipn} java.io.IOException: UT000034: Stream is closed at io.undertow.io.UndertowInputStream.read(UndertowInputStream.java:84) ~[undertow-core-1.1.0.Final.jar:1.1.0.Final] at

No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil

女生的网名这么多〃 提交于 2019-12-05 09:53:44
I'm very new to Clojure and I'm having a great time playing with it. One thing I'm having some trouble with is how to read the errors, I personally think they're not very descriptive, but that's probably due to my "newbieness". For example, the issue I'm having now is when I try to start up my ring server (I can provide more details if needed): Started server on port 3000 java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil core_deftype.clj:544 clojure.core/-cache-protocol-fn io.clj:69 clojure.java.io/fn[fn]

How to serve the stream pdf with ring

我只是一个虾纸丫 提交于 2019-12-05 05:52:53
I'm trying to serve a clj-http generated document directly via ring/compojure. I thought ring.util/piped-output-stream would work, but it seems I'm not understanding something here... This: (defn laminat-pdf-t [natno] (piped-input-stream (fn [output-stream]) (pdf [ {:title (str "Omanimali-Kuscheltierpass" natno) :orientation :landscape :size :a6 :author "Omanimali - Stefanie Tuschen" :register-system-fonts true } ;; [:svg {} (clojure.java.io/file ;; (str "/einbuergern/" natno "/svg" ))] [:paragraph "Some Text"] ] output-stream))) (defn laminat-pdf "generate individualized cuddly toy passport