Class DataRateLimitedServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.eclipse.jetty.servlets.DataRateLimitedServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

@Deprecated public class DataRateLimitedServlet extends jakarta.servlet.http.HttpServlet
Deprecated.
this is intended as a demonstration and not production quality.
A demonstration servlet that uses the Servlet 3.1 asynchronous IO API to server static content at a limited data rate.

Two implementations are supported:

  • The StandardDataStream impl uses only standard APIs, but produces more garbage due to the byte[] nature of the API.
  • the JettyDataStream impl uses a Jetty API to write a ByteBuffer and thus allow the efficient use of file mapped buffers without any temporary buffer copies.

The data rate is controlled by setting init parameters:

buffersize
The amount of data in bytes written per write
pause
The period in ms to wait after a write before attempting another
pool
The size of the thread pool used to service the writes (defaults to available processors)
Thus if buffersize = 1024 and pause = 100, the data rate will be limited to 10KB per second.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
     
    protected void
    doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Deprecated.
     
    void
    Deprecated.
     

    Methods inherited from class jakarta.servlet.http.HttpServlet

    doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service

    Methods inherited from class jakarta.servlet.GenericServlet

    getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DataRateLimitedServlet

      public DataRateLimitedServlet()
      Deprecated.
  • Method Details

    • init

      public void init() throws jakarta.servlet.ServletException
      Deprecated.
      Overrides:
      init in class jakarta.servlet.GenericServlet
      Throws:
      jakarta.servlet.ServletException
    • destroy

      public void destroy()
      Deprecated.
      Specified by:
      destroy in interface jakarta.servlet.Servlet
      Overrides:
      destroy in class jakarta.servlet.GenericServlet
    • doGet

      protected void doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException
      Deprecated.
      Overrides:
      doGet in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
      IOException