noir

Clojure warning: “resultset-seq already exists in clojure.core”

对着背影说爱祢 提交于 2021-01-27 08:10:57
问题 I'm new to Clojure and building a web app using the Noir framework (very similar to Compojure, in fact I think it's Compojure with a different request handler layer). I'm getting a warning when I import the JDBC library: WARNING: resultset-seq already refers to: #'clojure.core/resultset-seq in namespace: webapp.models.database, being replaced by: #'clojure.java.jdbc/resultset-seq Do I have to live with this warning or is there a way around it? I'm importing the JDBC library using: (use

Clojure warning: “resultset-seq already exists in clojure.core”

两盒软妹~` 提交于 2021-01-27 08:10:24
问题 I'm new to Clojure and building a web app using the Noir framework (very similar to Compojure, in fact I think it's Compojure with a different request handler layer). I'm getting a warning when I import the JDBC library: WARNING: resultset-seq already refers to: #'clojure.core/resultset-seq in namespace: webapp.models.database, being replaced by: #'clojure.java.jdbc/resultset-seq Do I have to live with this warning or is there a way around it? I'm importing the JDBC library using: (use

Can you set the size limit of a post request in header?

扶醉桌前 提交于 2020-01-15 11:30:07
问题 I'm trying to make a post request to my noir server but I have too many parameters and the server just responds with 413 status code. I was wondering if I could raise the character limit for the post request. I read it's possible with other services like What is the size limit of a post request? and Clojure/Ring: Using the ring jetty adapter, large requests give me a 413: FULL HEAD error. Thanks! 回答1: noir.server/start accepts a map of options as a second argument (which is itself optional).

Howto use lib-noir stateful-sessions in Compojure

蓝咒 提交于 2020-01-14 09:31:28
问题 I think I have a fairly straightforward problem here. But I've been looking at this screen too long. So I'm trying (and failing) to get stateful sessions working in Compojure. The refheap code paste is here . You can see me trying to use lib-noir (line 62) to initialize stateful sessions. Then when the app is running, I try to make a call to session/put! some data in the session (line 43). Now, this stacktrace says that in session.put!, lib-noir is trying to swap out a session var that hasn't

Clojure / Noir: Force HTTPS, redirect if the request was http:// to https://

我怕爱的太早我们不能终老 提交于 2020-01-02 02:19:28
问题 I'm trying to force SSL on my site. I want to have a ring style middle-ware to redirect the site to the same URL with https if it is only http I wrote the following code but it doesn't really do anything besides check the request scheme and print the URL it should be redirecting to. (defn https-url [request-url] (str (str (str (str "https://" (:server-name request-url) ":") (:server-port request-url))) (:uri request-url))) (defn require-https [handler] (fn [request] (let [page-request

How to do HTTP 302 redirects with Noir Web framework

独自空忆成欢 提交于 2019-12-19 07:09:39
问题 I'm helping to set up a Web site with Clojure's Noir framework, though I have a lot more experience with Django/Python. In Django, I'm used to URLs such as http://site/some/url being 302-redirected automagically to http://site/some/url/ Noir is more picky and does not do this. What would be the proper way to do this automatically? Since good URLs are an important way of addressing into a site, and many users will forget the trailing slash, this is basic functionality I'd like to add to my

Variable passed to macro gets resolved in wrong namespace?

 ̄綄美尐妖づ 提交于 2019-12-19 05:57:28
问题 The Noir macro defpage is giving me a little bit of trouble. I am trying to construct a call similar to this: (defpage [:post "some/url"] [data] ;; some stuff... ) However, instead of using the keyword :post I would like to use a variable, like this: (def my-method :post) (defpage [my-method "some/url"] [data] ;; some stuff... ) The problem is that when the macro expands, it wants to resolve the variable my-method in the compojure.core namespace instead of my own, giving me the error: No such

Why is username not saved in noir session in Clojure project?

浪尽此生 提交于 2019-12-11 15:45:21
问题 This is how I save it during login: (defn set-loggedin [username] (sesh/put! :username username)) (defn login-handler [username password] (let [user (datab/login username password)] (if (empty? user) (view/login-form "Wrong password.") (do (set-loggedin username) (resp/redirect "/movies"))))) (defroutes app-routes ... (POST "/" [username password] (login-handler username password)) (POST "/movie/save" [movieID name] (film-new movieID name)) ...) (def app (noir-middleware/app-handler [app

Noir render function causes NullPointerException

て烟熏妆下的殇ゞ 提交于 2019-12-11 04:00:51
问题 In my Clojure application I'm using Noir as web framework. I have one post page defined which is saving some data onto a mongodb database and I'm then trying to render another page: (defpage "/delivery/save" [delivery] (let [id (save-delivery delivery)] (render "/delivery/list" id)) I then have another page: (defpage "/delivery/list/:id" {:id id} (this should render the page)) However I'm getting a NullPointerException when calling the render function. Any idea why is this happening? Please

Add webapp frontend to existing clojure app

守給你的承諾、 提交于 2019-12-10 19:55:48
问题 I have a Clojure-based chat bot that I start up in typical leiningen fashion with lein run . I'd like to add a front end to this app, but not totally sure how to go about it. From reading docs on compojure, lib-noir and ring, looks like the standard way to serve is with lein ring server . I'd rather just start up the app and the front end with a single lein command if possible. Would this involve manually starting up the server (in another thread perhaps) with something like (run-jetty