Disable Servlet async request timeout in WebFlux

Issue: SPR-15463
This commit is contained in:
Rossen Stoyanchev 2017-04-25 16:26:23 -04:00
parent 61a4eaf3cf
commit 4f3db9b822
2 changed files with 5 additions and 3 deletions

View File

@ -176,6 +176,7 @@ configure(allprojects) { project ->
}
repositories {
mavenLocal()
maven { url "https://repo.spring.io/libs-release" }
maven { url "https://repo.spring.io/libs-snapshot" }
maven { url "https://repo.spring.io/milestone" }

View File

@ -104,11 +104,12 @@ public class ServletHttpHandlerAdapter implements Servlet {
public void service(ServletRequest request, ServletResponse response) throws IOException {
// Start async before Read/WriteListener registration
AsyncContext asyncContext = request.startAsync();
asyncContext.setTimeout(-1);
ServerHttpRequest httpRequest = createRequest(((HttpServletRequest) request), asyncContext);
ServerHttpResponse httpResponse = createResponse(((HttpServletResponse) response), asyncContext);
asyncContext.addListener(TIMEOUT_HANDLER);
asyncContext.addListener(ERROR_LISTENER);
HandlerResultSubscriber subscriber = new HandlerResultSubscriber(asyncContext);
this.httpHandler.handle(httpRequest, httpResponse).subscribe(subscriber);
@ -129,7 +130,7 @@ public class ServletHttpHandlerAdapter implements Servlet {
}
/**
* We cannot combine TIMEOUT_HANDLER and HandlerResultSubscriber due to:
* We cannot combine ERROR_LISTENER and HandlerResultSubscriber due to:
* https://issues.jboss.org/browse/WFLY-8515
*/
private static void runIfAsyncNotComplete(AsyncContext asyncContext, Runnable task) {
@ -167,7 +168,7 @@ public class ServletHttpHandlerAdapter implements Servlet {
}
private final static AsyncListener TIMEOUT_HANDLER = new AsyncListener() {
private final static AsyncListener ERROR_LISTENER = new AsyncListener() {
@Override
public void onTimeout(AsyncEvent event) throws IOException {