Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2015-10-29 19:35:37 -0400
committerGreg Wilkins2015-11-05 18:38:08 -0500
commit56afc2b0e578844343d8860a525df0e2a15f7cbe (patch)
tree7f4352ffbb24970d8e71bf5365f09c6c6fa447be
parentc8ec399af24708ed4888a67af2e9b97edc7b110d (diff)
downloadorg.eclipse.jetty.project-56afc2b0e578844343d8860a525df0e2a15f7cbe.tar.gz
org.eclipse.jetty.project-56afc2b0e578844343d8860a525df0e2a15f7cbe.tar.xz
org.eclipse.jetty.project-56afc2b0e578844343d8860a525df0e2a15f7cbe.zip
481554 DispatcherType reset race
Cherry pick of fa53b11850eab2162ce4e2c980aaf280c9355ceb Conflicts: jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java40
1 files changed, 30 insertions, 10 deletions
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
index 0d29c82b3b..b90c4ee4f2 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
@@ -295,7 +295,6 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
throw new IllegalStateException("state=" + _state);
_request.setHandled(false);
_response.getHttpOutput().reopen();
- _request.setDispatcherType(DispatcherType.REQUEST);
List<HttpConfiguration.Customizer> customizers = _configuration.getCustomizers();
if (!customizers.isEmpty())
@@ -303,7 +302,15 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
for (HttpConfiguration.Customizer customizer : customizers)
customizer.customize(getConnector(), _configuration, _request);
}
- getServer().handle(this);
+ try
+ {
+ _request.setDispatcherType(DispatcherType.REQUEST);
+ getServer().handle(this);
+ }
+ finally
+ {
+ _request.setDispatcherType(null);
+ }
break;
}
@@ -311,8 +318,16 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
{
_request.setHandled(false);
_response.getHttpOutput().reopen();
- _request.setDispatcherType(DispatcherType.ASYNC);
- getServer().handleAsync(this);
+
+ try
+ {
+ _request.setDispatcherType(DispatcherType.ASYNC);
+ getServer().handleAsync(this);
+ }
+ finally
+ {
+ _request.setDispatcherType(null);
+ }
break;
}
@@ -344,7 +359,7 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
_request.setHandled(false);
_response.resetBuffer();
_response.getHttpOutput().reopen();
- _request.setDispatcherType(DispatcherType.ERROR);
+
String reason;
if (ex == null || ex instanceof TimeoutException)
@@ -371,7 +386,16 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
_state.getAsyncContextEvent().setDispatchPath(error_page);
}
- getServer().handleAsync(this);
+
+ try
+ {
+ _request.setDispatcherType(DispatcherType.ERROR);
+ getServer().handleAsync(this);
+ }
+ finally
+ {
+ _request.setDispatcherType(null);
+ }
break;
}
@@ -447,10 +471,6 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
handleException(e);
}
}
- finally
- {
- _request.setDispatcherType(null);
- }
action = _state.unhandle();
}

Back to the top