diff options
author | Jesse McConnell | 2011-06-15 15:39:33 +0000 |
---|---|---|
committer | Jesse McConnell | 2011-06-15 15:39:33 +0000 |
commit | 30c3934931fd961be92145439590ce3545090067 (patch) | |
tree | cea916dfa2ab858677c2326d4aa28fbcaba3b7e4 /jetty-servlets | |
parent | a90071355a86aa9438ce715a75432c7a8ac9c3df (diff) | |
download | org.eclipse.jetty.project-30c3934931fd961be92145439590ce3545090067.tar.gz org.eclipse.jetty.project-30c3934931fd961be92145439590ce3545090067.tar.xz org.eclipse.jetty.project-30c3934931fd961be92145439590ce3545090067.zip |
[Bug 295832] shifted customize exchange and continuation to the the last possible moment for extenders can have full state before each are used. added continuation setTimeout based on httpclient connect timeout and exchange timeouts so that the contination doesn't interrupt normal usage (streaming of data resetting exchange timeout but not continuation)
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3389 7e9141cc-0065-0410-87d8-b60c137991c4
Diffstat (limited to 'jetty-servlets')
-rw-r--r-- | jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java index 5648ce0f72..f6bedc0bc1 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java @@ -364,7 +364,6 @@ public class ProxyServlet implements Servlet response.sendError(HttpServletResponse.SC_GATEWAY_TIMEOUT); // Need better test that isInitial else { - customizeContinuation(continuation); String uri = request.getRequestURI(); if (request.getQueryString() != null) @@ -464,7 +463,6 @@ public class ProxyServlet implements Servlet exchange.setURL(url.toString()); exchange.setVersion(request.getProtocol()); - customizeExchange(exchange, request); if (debug != 0) _log.debug(debug + " " + request.getMethod() + " " + url + " " + request.getProtocol()); @@ -539,6 +537,20 @@ public class ProxyServlet implements Servlet if (hasContent) exchange.setRequestContentSource(in); + customizeExchange(exchange, request); + + /* + * we need to set the timeout on the continuation to take into + * account the timeout of the HttpClient and the HttpExchange + */ + long ctimeout = (_client.getConnectTimeout() > exchange.getTimeout()) ? _client.getConnectTimeout() : exchange.getTimeout(); + + // continuation fudge factor of 1000, underlying components + // should fail/expire first + continuation.setTimeout(ctimeout + 1000); + + customizeContinuation(continuation); + continuation.suspend(response); _client.send(exchange); @@ -663,7 +675,7 @@ public class ProxyServlet implements Servlet /** * Extension point for custom handling of an HttpExchange's onExpire method. The default implementation sets the response status to - * HttpServletResponse.SC_INTERNAL_SERVER_ERROR (503) + * HttpServletResponse.SC_GATEWAY_TIMEOUT (504) * * @param request * @param response @@ -672,7 +684,7 @@ public class ProxyServlet implements Servlet { if (!response.isCommitted()) { - response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + response.setStatus(HttpServletResponse.SC_GATEWAY_TIMEOUT); } } |