Hi there, what is the standard way to set the SO_REUSEADDR socket option using the Jetty adapter?
Is it by using the :configurator option?
That's the approach we've taken at work for dealing with similar option settings...
Thank you!
For future reference, this is what I ended up with:
(defn configurator [^Server server]
(doseq [^ServerConnector connector (.getConnectors server)]
(.setReuseAddress connector true)))This is ours, for backward-compatibility in URL parsing(!):
(defn- configure-compliance [^Server server]
(doseq [^Connector conn (.getConnectors server)]
(doseq [^ConnectionFactory factory (.getConnectionFactories conn)]
(try
(logger/debug "attempting to configure" factory "from" conn)
(let [^HttpConfiguration config (.getHttpConfiguration factory)]
(.setUriCompliance config (UriCompliance/from "JETTY_11,ILLEGAL_PATH_CHARACTERS")))
(catch Exception e
(logger/error "Error setting URI compliance" (ex-message e)))))))
(Java APIs can be so awful -- the class hierarchy is such that not all connection factories provide .getHttpConfiguration as I recall, so it isn't in a common base class/interface)