Class ServletHttpHandlerAdapter

java.lang.Object
org.springframework.http.server.reactive.ServletHttpHandlerAdapter
All Implemented Interfaces:
jakarta.servlet.Servlet
Direct Known Subclasses:
TomcatHttpHandlerAdapter

public class ServletHttpHandlerAdapter extends Object implements jakarta.servlet.Servlet
Adapt HttpHandler to an HttpServlet using Servlet Async support and Servlet non-blocking I/O.
Since:
5.0
Author:
Arjen Poutsma, Rossen Stoyanchev
See Also:
  • Constructor Details

    • ServletHttpHandlerAdapter

      public ServletHttpHandlerAdapter(HttpHandler httpHandler)
  • Method Details

    • setBufferSize

      public void setBufferSize(int bufferSize)
      Set the size of the input buffer used for reading in bytes.

      By default this is set to 8192.

    • getBufferSize

      public int getBufferSize()
      Return the configured input buffer size.
    • getServletPath

      public @Nullable String getServletPath()
      Return the Servlet path under which the Servlet is deployed by checking the Servlet registration from init(ServletConfig).
      Returns:
      the path, or an empty string if the Servlet is deployed without a prefix (i.e. "/" or "/*"), or null if this method is invoked before the init(ServletConfig) Servlet container callback.
    • setDataBufferFactory

      public void setDataBufferFactory(DataBufferFactory dataBufferFactory)
    • getDataBufferFactory

      public DataBufferFactory getDataBufferFactory()
    • init

      public void init(jakarta.servlet.ServletConfig config)
      Specified by:
      init in interface jakarta.servlet.Servlet
    • service

      public void service(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) throws jakarta.servlet.ServletException, IOException
      Specified by:
      service in interface jakarta.servlet.Servlet
      Throws:
      jakarta.servlet.ServletException
      IOException
    • createRequest

      protected org.springframework.http.server.reactive.ServletServerHttpRequest createRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.AsyncContext context) throws IOException, URISyntaxException
      Throws:
      IOException
      URISyntaxException
    • createResponse

      protected org.springframework.http.server.reactive.ServletServerHttpResponse createResponse(jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.AsyncContext context, org.springframework.http.server.reactive.ServletServerHttpRequest request) throws IOException
      Throws:
      IOException
    • getServletInfo

      public String getServletInfo()
      Specified by:
      getServletInfo in interface jakarta.servlet.Servlet
    • getServletConfig

      public @Nullable jakarta.servlet.ServletConfig getServletConfig()
      Specified by:
      getServletConfig in interface jakarta.servlet.Servlet
    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Servlet