summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorThomas Becker2012-02-17 13:09:48 (EST)
committer Greg Wilkins2012-02-27 00:46:15 (EST)
commit265d35324aad1d2391cd9a7fa8be074d43425e35 (patch)
treeca19c982cdf33bc46acc914131bc232e0bcfeb56
parent7a58f3408eee4c58230c6949fb7b16919eecfb03 (diff)
downloadorg.eclipse.jetty.project-265d35324aad1d2391cd9a7fa8be074d43425e35.zip
org.eclipse.jetty.project-265d35324aad1d2391cd9a7fa8be074d43425e35.tar.gz
org.eclipse.jetty.project-265d35324aad1d2391cd9a7fa8be074d43425e35.tar.bz2
371903: Implement servlet 3.0 spec change (spec section 9.4) to not commit response in Dispatcher.forward() when request.isAysncStarted()
Signed-off-by: Greg Wilkins <gregw@webtide.com>
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/Dispatcher.java43
1 files changed, 29 insertions, 14 deletions
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Dispatcher.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Dispatcher.java
index 1102b49..e7af926 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/Dispatcher.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Dispatcher.java
@@ -287,21 +287,9 @@ public class Dispatcher implements RequestDispatcher
_contextHandler.handle(_path,baseRequest, (HttpServletRequest)request, (HttpServletResponse)response);
- if (baseRequest.getResponse().isWriting())
+ if (!request.isAsyncStarted())
{
- try {response.getWriter().close();}
- catch(IllegalStateException e)
- {
- response.getOutputStream().close();
- }
- }
- else
- {
- try {response.getOutputStream().close();}
- catch(IllegalStateException e)
- {
- response.getWriter().close();
- }
+ commitResponse(response,baseRequest);
}
}
}
@@ -320,6 +308,33 @@ public class Dispatcher implements RequestDispatcher
}
+ private void commitResponse(ServletResponse response, Request baseRequest) throws IOException
+ {
+ if (baseRequest.getResponse().isWriting())
+ {
+ try
+ {
+ response.getWriter().close();
+ }
+ catch (IllegalStateException e)
+ {
+ response.getOutputStream().close();
+ }
+ }
+ else
+ {
+ try
+ {
+ response.getOutputStream().close();
+ }
+ catch (IllegalStateException e)
+ {
+ response.getWriter().close();
+ }
+ }
+ }
+
+
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */