@abdullahibra i can reproduce that error with code below. you have to put :route-name
before :constraints
(defn respond-hello
""
[request]
{:status 200 :body "Hello, world"})
(defn greet
[req] {:status 200 :body "Greet"})
(def routes
(route/expand-routes
#{["/hello" :get [respond-hello] :route-name :hello]
["/greet/:id" :get [{:name :greet :enter greet}]
:constraints {:id #"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"}
:route-name :greet ]}))
error:
#error {
:cause "Assert failed: In row 2, there were unused elements (:route-name :greet).\nThe whole route was: [\"/greet/:id\" :get [{:name :greet, :enter #function[mavp.foo/greet]}] :constraints {:id #\"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\"} :route-name :greet]\n(empty? (:remaining ctx))"
:via
[{:type clojure.lang.Compiler$CompilerException
:message "Syntax error macroexpanding at (form-init15957751344353533874.clj:15:3)."
:data #:clojure.error{:phase :execution, :line 15, :column 3, :source "form-init15957751344353533874.clj"}
@mavbozo perfect, Thank you 🙂
So really basic question about servlet interceptors
https://www.eclipse.org/jetty/javadoc/9.4.32.v20200930/org/eclipse/jetty/servlets/DoSFilter.html
say i wanted to add this
from what i infer from the docs, I would have my service map
(-> {::http/routes (if (config/production? config)
(routes system)
(fn [] (routes system)))
::http/port (config/server-port config)
::http/host (if (config/production? config)
"0.0.0.0"
"localhost")
::http/type :jetty
...}
(add-servlet-filter {:filter DoSFilter}))
is there a way to configure it not via an xml config?
<filter>
<filter-name>DoSFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.DoSFilter</filter-class>
<init-param>
<param-name>maxRequestsPerSec</param-name>
<param-value>30</param-value>
</init-param>
</filter>
https://www.eclipse.org/jetty/documentation/current/dos-filter.html
@emccue you should be able to configure it in code. Initialize the filter with relevant values then add it