Fork me on GitHub

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.

Jacob O'Bryant18:02:21

Hm, I'm not familiar with configuring Jetty via XML. But if needed, you can modify the way Jetty starts in Biff by copying into your project, edit as necessary, and use that instead of Based on, it looks like the official ring jetty adapter supports a web.xml file. Biff uses since it comes with bindings for websockets; not sure if that one supports using an xml file easily or not.

Jacob O'Bryant18:02:22

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 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)
:dev {:merge [:prod]
       :biff.elham/enable-beholder true
       :biff/host ""
       :biff/port 4444
       :biff/configurator  ;<--- added this
       :biff/base-url ""
       :biff.xtdb/topology :standalone
       :biff.middleware/secure false
(defn hello-world [sys]
  (while true (log/info "Is this working!!!!!"))