How to use a ThrottlingFilter for Jetty in Restlet
-
20-08-2019 - |
Question
I would like to configure a webservice so that once the accept queue is full the service returns 503. Currently, these requests seem to just time out.
I did set paramters like maxThreads and acceptQueuesize (as described here: http://www.restlet.org/documentation/1.1/ext/com/noelios/restlet/ext/jetty/JettyServerHelper).
But the service does not respond with 503 once the acceptQueue is full.
It seems jetty's ThrottlingFilter (http://www.mortbay.org/jetty/jetty-6/apidocs/index.html?index-all.html) is what I'm looking for, but I don't know how to apply within my restlet service.
Solution
You won't be able to take advantage of ThrottlingFilter unless you deploy your application as a WAR file into Jetty. JettyServerHelper bootstraps Restlet as a standalone server using Jetty to accept HTTP connections and hence cannot utilize a Servlet Filter. I'm not sure if there is anyway to utilize similar processing logic from the ThrottlingFilter in Jetty outside of the Servlet world or not.