Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Allow only a single client to send requests to jetty at a time

What action are you looking for the clients that attempt to connect
while another one is servicing a request, so you just want to return a
status code?

maybe 412 Precondition failed

If that is what your looking for a simple custom handler ought to do,
one that checks if the resource is busy and if it is return an error
code..  I figured the QoS would work for you, queueing up the other
requests but having only one active at a time.


jesse mcconnell

On Wed, May 4, 2011 at 02:28,  <Max.Ullinger@xxxxxx> wrote:
> Hello all,
> I managed to get the QoS Filter to work, unfortunately it won't solve the problem.
> { //Handler that forces a maximum of 1 request at a time
>        ServletHolder servletHolder = new ServletHolder();
>        servletHolder.setServlet(new NullServlet());
>         LogQOSFilter qosFilter = new LogQOSFilter();
>        FilterHolder filterHolder = new FilterHolder(qosFilter);
>        LogServletHandler servletHandler = new LogServletHandler();
>        servletHandler.addFilterWithMapping(filterHolder, "/*", 1);
>        servletHandler.addServletWithMapping(servletHolder, "/*");
>        baseCollection.addHandler(servletHandler);
>        try {
>          servletHandler.start();
>          servletHandler.initialize();
>        } catch (Exception e1) {
>          LOG.warn(e1);
>        }
>        qosFilter.setMaxRequests(1);
> }
> This will filter all Requests to Handlers behind the Filter.
> The NullServlet is a servlet that does nothing. It is needed to trigger the filter process, without servlet, no filtering.
> ------
> We need to filter on socket-level, to only allow a single stream to be opened at a time. In Jetty terms, these should be the connectors, if I am not mistaken.
> This is due the large XML we potentially return from our services. Only one stream/request can be allowed at a time.
> Currently we use a workaround: We have a lighttpd as proxy in front of our Java Webservice. Lighttpd allows to constrict connections on stream level.
> We would like to solve that problem with Jetty alone.
> So if anybody else has an idea how to restrict the concurrent connections/requests on socket level to only one, please let me know
> Thanks,
> Max
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx

Back to the top