将以下行放入 mycompojure
defroutes
以clojure-paypal-ipn
调用这两个处理函数。
(POST "/paypal/ipn" [] (make-ipn-handler payment/paypal-data payment/paypal-error))
如何POST
在 Immutant 中处理请求?
我将 Immutant 2.0 与 Clojure 1.7-beta1 一起使用,并构建了 Immutant 功能演示。尽管我正在尝试使用 PayPal IPN,但使用 cURL 直接发布会产生相同的结果。
17:29:40.220 ERROR [io.undertow.request] (XNIO-1 task-1) Undertow request failed HttpServerExchange{ POST /paypal/ipn}
java.io.IOException: mark/reset not supported
at java.io.InputStream.reset(InputStream.java:348) ~[na:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93) ~[clojure-1.7.0-beta1.jar:na]
at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:313) ~[clojure-1.7.0-beta1.jar:na]
at clojure_paypal_ipn.core$req__GT_raw_body_str.invoke(core.clj:59) ~[na:na]
at clojure_paypal_ipn.core$make_ipn_handler$fn__16823.invoke(core.clj:69) ~[na:na]
at compojure.response$eval6101$fn__6102.invoke(response.clj:34) ~[na:na]
at compojure.response$eval6068$fn__6069$G__6059__6076.invoke(response.clj:7) ~[na:na]
at compojure.core$make_route$fn__7513.invoke(core.clj:113) ~[na:na]
at compojure.core$wrap_route_middleware$fn__7509.invoke(core.clj:103) ~[na:na]
at compojure.core$if_route$fn__7488.invoke(core.clj:41) ~[na:na]
at compojure.core$if_method$fn__7480.invoke(core.clj:27) ~[na:na]
at compojure.core$routing$fn__7519.invoke(core.clj:127) ~[na:na]
at clojure.core$some.invoke(core.clj:2568) ~[clojure-1.7.0-beta1.jar:na]
at compojure.core$routing.doInvoke(core.clj:127) ~[na:na]
at clojure.lang.RestFn.applyTo(RestFn.java:139) ~[clojure-1.7.0-beta1.jar:na]
at clojure.core$apply.invoke(core.clj:630) ~[clojure-1.7.0-beta1.jar:na]
at compojure.core$routes$fn__7523.invoke(core.clj:132) ~[na:na]
at immutant.web.internal.undertow$wrap_undertow_session$fn__5292.invoke(undertow.clj:69) ~[na:na]
at immutant.web.internal.undertow$create_http_handler$reify__5362.handleRequest(undertow.clj:130) ~[na:na]
at org.projectodd.wunderboss.web.async.websocket.UndertowWebsocket$2.handleRequest(UndertowWebsocket.java:96) ~[wunderboss-web-0.6.1.jar:na]
at io.undertow.server.session.SessionAttachmentHandler.handleRequest(SessionAttachmentHandler.java:68) ~[undertow-core-1.1.0.Final.jar:1.1.0.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) ~[undertow-core-1.1.0.Final.jar:1.1.0.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) ~[undertow-core-1.1.0.Final.jar:1.1.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]