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

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

Back to the top