This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-17
Channels
- # announcements (12)
- # babashka (27)
- # beginners (65)
- # biff (7)
- # calva (21)
- # clj-kondo (1)
- # clj-otel (5)
- # clojure (61)
- # clojure-europe (127)
- # clojure-nl (1)
- # clojure-norway (11)
- # clojure-portugal (2)
- # clojure-uk (2)
- # clojurescript (18)
- # cursive (5)
- # data-science (3)
- # datahike (14)
- # datascript (3)
- # datomic (7)
- # deps-new (11)
- # emacs (31)
- # exercism (1)
- # fulcro (1)
- # honeysql (3)
- # hyperfiddle (38)
- # introduce-yourself (4)
- # leiningen (2)
- # malli (20)
- # meander (2)
- # missionary (3)
- # off-topic (4)
- # pathom (3)
- # practicalli (2)
- # reagent (5)
- # releases (1)
- # sci (1)
- # shadow-cljs (9)
- # xtdb (8)
Hi, how do I get Jetty to read a XML file? I read that Jetty needs jetty-ant-config.xml
in order to do URL rewriting, but I'm confuse as how to accomplish this with an embedded Jetty server.
Maybe something like this? https://github.com/weavejester/lein-ring/issues/45
Or something like this by adding something to the configurator? https://stackoverflow.com/questions/28174202/how-to-disable-sslv3-for-embedded-jetty-server-for-ring-application
Hm, I'm not familiar with configuring Jetty via XML. But if needed, you can modify the way Jetty starts in Biff by copying https://github.com/jacobobryant/biff/blob/master/src/com/biffweb/impl/misc.clj#L63 into your project, edit as necessary, and use that instead of https://github.com/jacobobryant/biff/blob/master/example/src/com/example.clj#L46. Based on https://github.com/weavejester/lein-ring/issues/17, it looks like the official ring jetty adapter supports a web.xml file. Biff uses https://github.com/sunng87/ring-jetty9-adapter since it comes with bindings for websockets; not sure if that one supports using an xml file easily or not.
Let me know if it would help to replace ring-jetty9-adapter with the official ring adapter--that would be pretty straightforward as well (as long as you're not using websockets), but it'd be made a little easier if I make a couple changes to Biff.
@U7YNGKDHA Hmm yes, I saw that issue but too be honest I didn't really understand most of it 😅. Do you know an easier way to do URL rewriting in development (could be with something apart from Jetty)? I know you can configure it on nginx for production but I'm not sure how suitable that can be. I'm new to web development.
Anyways this is what I did, but I can't seem to get the hello-world
function to log my message (it should run when the server starts https://ring-clojure.github.io/ring/ring.adapter.jetty.html)
biffweb.clj
(defn use-jetty
"A Biff component that starts a Jetty web server."
[{:biff/keys [host port configurator handler]
:or {host "localhost"
port 8080
configurator #'hello-world}
:as sys}]
(misc/use-jetty sys)
config.edn
:dev {:merge [:prod]
:biff.elham/enable-beholder true
:biff/host "0.0.0.0"
:biff/port 4444
:biff/configurator ;<--- added this
:biff/base-url ""
:biff.xtdb/topology :standalone
:biff.middleware/secure false
blog.clj
(defn hello-world [sys]
(while true (log/info "Is this working!!!!!"))