public class ServletHttpHandlerAdapter
extends java.lang.Object
HttpHandler
to an HttpServlet
using Servlet Async
support and Servlet 3.1 non-blocking I/O.AbstractReactiveWebInitializer
Modifier and Type | Class and Description |
---|---|
private static class |
ServletHttpHandlerAdapter.HandlerResultAsyncListener |
private class |
ServletHttpHandlerAdapter.HandlerResultSubscriber |
Modifier and Type | Field and Description |
---|---|
private int |
bufferSize |
private DataBufferFactory |
dataBufferFactory |
private static int |
DEFAULT_BUFFER_SIZE |
private HttpHandler |
httpHandler |
private static Log |
logger |
private java.lang.String |
servletPath |
private static java.lang.String |
WRITE_ERROR_ATTRIBUTE_NAME |
Constructor and Description |
---|
ServletHttpHandlerAdapter(HttpHandler httpHandler) |
Modifier and Type | Method and Description |
---|---|
protected ServerHttpRequest |
createRequest(HttpServletRequest request,
AsyncContext context) |
protected ServerHttpResponse |
createResponse(HttpServletResponse response,
AsyncContext context) |
void |
destroy() |
int |
getBufferSize()
Return the configured input buffer size.
|
DataBufferFactory |
getDataBufferFactory() |
ServletConfig |
getServletConfig() |
java.lang.String |
getServletInfo() |
java.lang.String |
getServletPath()
Return the Servlet path under which the Servlet is deployed by checking
the Servlet registration from
init(ServletConfig) . |
private java.lang.String |
getServletPath(ServletConfig config) |
void |
init(ServletConfig config) |
private static void |
runIfAsyncNotComplete(AsyncContext asyncContext,
java.util.concurrent.atomic.AtomicBoolean isCompleted,
java.lang.Runnable task)
We cannot combine ERROR_LISTENER and HandlerResultSubscriber due to:
https://issues.jboss.org/browse/WFLY-8515
|
void |
service(ServletRequest request,
ServletResponse response) |
void |
setBufferSize(int bufferSize)
Set the size of the input buffer used for reading in bytes.
|
void |
setDataBufferFactory(DataBufferFactory dataBufferFactory) |
private static final Log logger
private static final int DEFAULT_BUFFER_SIZE
private static final java.lang.String WRITE_ERROR_ATTRIBUTE_NAME
private final HttpHandler httpHandler
private int bufferSize
@Nullable private java.lang.String servletPath
private DataBufferFactory dataBufferFactory
public ServletHttpHandlerAdapter(HttpHandler httpHandler)
public void setBufferSize(int bufferSize)
By default this is set to 8192.
public int getBufferSize()
@Nullable public java.lang.String getServletPath()
init(ServletConfig)
.null
if this method is invoked
before the init(ServletConfig)
Servlet container callback.public void setDataBufferFactory(DataBufferFactory dataBufferFactory)
public DataBufferFactory getDataBufferFactory()
public void init(ServletConfig config)
private java.lang.String getServletPath(ServletConfig config)
public void service(ServletRequest request, ServletResponse response) throws ServletException, java.io.IOException
ServletException
java.io.IOException
protected ServerHttpRequest createRequest(HttpServletRequest request, AsyncContext context) throws java.io.IOException, java.net.URISyntaxException
java.io.IOException
java.net.URISyntaxException
protected ServerHttpResponse createResponse(HttpServletResponse response, AsyncContext context) throws java.io.IOException
java.io.IOException
public java.lang.String getServletInfo()
@Nullable public ServletConfig getServletConfig()
public void destroy()
private static void runIfAsyncNotComplete(AsyncContext asyncContext, java.util.concurrent.atomic.AtomicBoolean isCompleted, java.lang.Runnable task)