Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2015-08-13 04:06:14 -0400
committerGreg Wilkins2015-08-13 04:06:14 -0400
commitf21ea15725fc12153369a8e1a90b3074b857eaab (patch)
treed5a9cbe90bc845f94e8b75fe605a911927e102ac /jetty-servlet
parent0f6a83f7109f9a3bf4e69760cbca3a6f5a038335 (diff)
downloadorg.eclipse.jetty.project-f21ea15725fc12153369a8e1a90b3074b857eaab.tar.gz
org.eclipse.jetty.project-f21ea15725fc12153369a8e1a90b3074b857eaab.tar.xz
org.eclipse.jetty.project-f21ea15725fc12153369a8e1a90b3074b857eaab.zip
474634 - AsyncListener.onError() handling.
Handle errors thrown from dispatch when async is started with onError
Diffstat (limited to 'jetty-servlet')
-rw-r--r--jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java4
-rw-r--r--jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java1
-rw-r--r--jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java23
3 files changed, 10 insertions, 18 deletions
diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java
index b119fe7a82..b008dd72d0 100644
--- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java
+++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java
@@ -598,7 +598,9 @@ public class ServletHandler extends ScopedHandler
}
catch(Exception e)
{
- if (!(DispatcherType.REQUEST.equals(type) || DispatcherType.ASYNC.equals(type)))
+ //TODO, can we let all error handling fall through to HttpChannel?
+
+ if (baseRequest.isAsyncStarted() || !(DispatcherType.REQUEST.equals(type) || DispatcherType.ASYNC.equals(type)))
{
if (e instanceof IOException)
throw (IOException)e;
diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java
index 038fc2b534..14c951c0e2 100644
--- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java
+++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncContextTest.java
@@ -173,6 +173,7 @@ public class AsyncContextTest
"Connection: close\r\n" +
"\r\n";
String responseString = _connector.getResponses(request);
+ System.err.println(responseString);
BufferedReader br = new BufferedReader(new StringReader(responseString));
diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java
index c36c093bbd..3c076af584 100644
--- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java
+++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/AsyncServletTest.java
@@ -81,17 +81,7 @@ public class AsyncServletTest
protected List<String> _log;
protected int _expectedLogs;
protected String _expectedCode;
- protected static List<String> __history=new CopyOnWriteArrayList()
- {
-
- @Override
- public boolean add(Object e)
- {
- System.err.println("H: "+e);
- return super.add(e);
- }
-
- };
+ protected static List<String> __history=new CopyOnWriteArrayList<>();
protected static CountDownLatch __latch;
@Before
@@ -213,7 +203,7 @@ public class AsyncServletTest
{
_expectedCode="500 ";
String response=process("start=200&timeout=error",null);
- assertThat(response,startsWith("HTTP/1.1 500 Async Exception"));
+ assertThat(response,startsWith("HTTP/1.1 500 Server Error"));
assertThat(__history,contains(
"REQUEST /ctx/path/info",
"initial",
@@ -323,12 +313,11 @@ public class AsyncServletTest
"REQUEST /ctx/path/info",
"initial",
"start",
- /* TODO should there be an onError call?
"onError",
- "history: onComplete\r\n"
- */""
- ));
- assertContains("HTTP ERROR: 500",response);
+ "ERROR /ctx/path/info",
+ "!initial",
+ "onComplete"));
+ assertContains("ERROR DISPATCH: /ctx/path/info",response);
}
@Test

Back to the top