changeset 932:947df3056ddb

remove AsyncEventState
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 09 Oct 2016 20:20:13 -0600
parents 6f7e2ff51879
children c9513d80f305
files src/org/eclipse/jetty/server/AsyncContinuation.java
diffstat 1 files changed, 3 insertions(+), 112 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/AsyncContinuation.java	Sun Oct 09 19:24:55 2016 -0600
+++ b/src/org/eclipse/jetty/server/AsyncContinuation.java	Sun Oct 09 20:20:13 2016 -0600
@@ -80,7 +80,6 @@
 	private int _state;
 	private volatile boolean _responseWrapped;
 	private long _timeoutMs=DEFAULT_TIMEOUT;
-	private AsyncEventState _event;
 	private volatile long _expireAt;    
 	
 	/* ------------------------------------------------------------ */
@@ -151,15 +150,6 @@
 	} 
 
 	/* ------------------------------------------------------------ */
-	public AsyncEventState getAsyncEventState()
-	{
-		synchronized(this)
-		{
-			return _event;
-		}
-	} 
-   
-	/* ------------------------------------------------------------ */
 	/**
 	 * @see org.eclipse.jetty.continuation.Continuation#keepWrappers()
 	 */
@@ -372,12 +362,10 @@
 				{
 					if (ex!=null)
 					{
-						_event.getSuppliedRequest().setAttribute(RequestDispatcher.ERROR_EXCEPTION,ex);
-						_event.getSuppliedRequest().setAttribute(RequestDispatcher.ERROR_MESSAGE,ex.getMessage());
-						listener.onError(_event);
+						throw new UnsupportedOperationException();
 					}
 					else
-						listener.onComplete(_event);
+						listener.onComplete(null);
 				}
 				catch(Exception e)
 				{
@@ -434,11 +422,6 @@
 		}
 		else 
 		{
-			final AsyncEventState event=_event;
-			if (event!=null)
-			{
-				((AsyncEndPoint)endp).cancelTimeout(event._timeout);
-			}
 		}
 	}
 
@@ -477,33 +460,18 @@
 	/* ------------------------------------------------------------ */
 	public ServletRequest getRequest()
 	{
-		if (_event!=null)
-			return _event.getSuppliedRequest();
 		return _connection.getRequest();
 	}
 
 	/* ------------------------------------------------------------ */
 	public ServletResponse getResponse()
 	{
-		if (_responseWrapped && _event!=null && _event.getSuppliedResponse()!=null)
-			return _event.getSuppliedResponse();
 		return _connection.getResponse();
 	}
 
 	/* ------------------------------------------------------------ */
 	public void start(final Runnable run)
 	{
-		final AsyncEventState event=_event;
-		if (event!=null)
-		{
-			_connection.getServer().threadPool.execute(new Runnable()
-			{
-				public void run()
-				{
-					((Context)event.getServletContext()).getContextHandler().handle(run);
-				}
-			});
-		}
 	}
 
 	/* ------------------------------------------------------------ */
@@ -511,16 +479,13 @@
 	{
 		synchronized (this)
 		{
-			return (_event!=null && _event.getSuppliedRequest()==_connection._request && _event.getSuppliedResponse()==_connection._response);
+			return false;
 		}
 	}
 
 	/* ------------------------------------------------------------ */
 	public ContextHandler getContextHandler()
 	{
-		final AsyncEventState event=_event;
-		if (event!=null)
-			return ((Context)event.getServletContext()).getContextHandler();
 		return null;
 	}
 
@@ -531,8 +496,6 @@
 	 */
 	public ServletResponse getServletResponse()
 	{
-		if (_responseWrapped && _event!=null && _event.getSuppliedResponse()!=null)
-			return _event.getSuppliedResponse();
 		return _connection.getResponse();
 	}
 
@@ -581,76 +544,4 @@
 			}
 	}
 
-	/* ------------------------------------------------------------ */
-	/* ------------------------------------------------------------ */
-	public class AsyncEventState extends AsyncEvent
-	{
-		private final ServletContext _suspendedContext;
-		private ServletContext _dispatchContext;
-		private String _pathInContext;
-		private Timeout.Task _timeout=  new AsyncTimeout();
-		
-		public AsyncEventState(ServletContext context, ServletRequest request, ServletResponse response)
-		{
-			super(AsyncContinuation.this, request,response);
-			_suspendedContext=context;
-			// Get the base request So we can remember the initial paths
-			Request r=_connection.getRequest();
- 
-			// If we haven't been async dispatched before
-			if (r.getAttribute(AsyncContext.ASYNC_REQUEST_URI)==null)
-			{
-				// We are setting these attributes during startAsync, when the spec implies that 
-				// they are only available after a call to AsyncContext.dispatch(...);
-				
-				// have we been forwarded before?
-				String uri=(String)r.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI);
-				if (uri!=null)
-				{
-					r.setAttribute(AsyncContext.ASYNC_REQUEST_URI,uri);
-					r.setAttribute(AsyncContext.ASYNC_CONTEXT_PATH,r.getAttribute(RequestDispatcher.FORWARD_CONTEXT_PATH));
-					r.setAttribute(AsyncContext.ASYNC_SERVLET_PATH,r.getAttribute(RequestDispatcher.FORWARD_SERVLET_PATH));
-					r.setAttribute(AsyncContext.ASYNC_PATH_INFO,r.getAttribute(RequestDispatcher.FORWARD_PATH_INFO));
-					r.setAttribute(AsyncContext.ASYNC_QUERY_STRING,r.getAttribute(RequestDispatcher.FORWARD_QUERY_STRING));
-				}
-				else
-				{
-					r.setAttribute(AsyncContext.ASYNC_REQUEST_URI,r.getRequestURI());
-					r.setAttribute(AsyncContext.ASYNC_CONTEXT_PATH,r.getContextPath());
-					r.setAttribute(AsyncContext.ASYNC_SERVLET_PATH,r.getServletPath());
-					r.setAttribute(AsyncContext.ASYNC_PATH_INFO,r.getPathInfo());
-					r.setAttribute(AsyncContext.ASYNC_QUERY_STRING,r.getQueryString());
-				}
-			}
-		}
-		
-		public ServletContext getSuspendedContext()
-		{
-			return _suspendedContext;
-		}
-		
-		public ServletContext getDispatchContext()
-		{
-			return _dispatchContext;
-		}
-		
-		public ServletContext getServletContext()
-		{
-			return _dispatchContext==null?_suspendedContext:_dispatchContext;
-		}
-		
-		public void setPath(String path)
-		{
-			_pathInContext=path;
-		}
-		
-		/* ------------------------------------------------------------ */
-		/**
-		 * @return The path in the context
-		 */
-		public String getPath()
-		{
-			return _pathInContext;
-		}
-	}
 }