diff src/org/eclipse/jetty/server/handler/ContextHandler.java @ 993:d9d95acded81

remove ScopedHandler
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 18 Oct 2016 15:54:54 -0600
parents 0608a6664bee
children 4e9d373bf6e9
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/handler/ContextHandler.java	Tue Oct 18 15:23:25 2016 -0600
+++ b/src/org/eclipse/jetty/server/handler/ContextHandler.java	Tue Oct 18 15:54:54 2016 -0600
@@ -93,7 +93,7 @@
  * 
  * @org.apache.xbean.XBean description="Creates a basic HTTP context"
  */
-public final class ContextHandler extends ScopedHandler implements Server.Graceful
+public final class ContextHandler extends HandlerWrapper implements Server.Graceful
 {
 	private static final Logger LOG = LoggerFactory.getLogger(ContextHandler.class);
 
@@ -229,18 +229,6 @@
 	}
 
 	/* ------------------------------------------------------------ */
-	public void callContextInitialized (ServletContextListener l, ServletContextEvent e)
-	{
-		l.contextInitialized(e);
-	}
-
-	/* ------------------------------------------------------------ */
-	public void callContextDestroyed (ServletContextListener l, ServletContextEvent e)
-	{
-		l.contextDestroyed(e);
-	}
-	
-	/* ------------------------------------------------------------ */
 	/*
 	 * @see org.eclipse.thread.AbstractLifeCycle#doStop()
 	 */
@@ -267,10 +255,6 @@
 		_contextAttributes.clearAttributes();
 	}
 
-	/* ------------------------------------------------------------ */
-	/*
-	 * @see org.eclipse.jetty.server.Handler#handle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
-	 */
 	private boolean checkContext(final String target, final Request baseRequest, final HttpServletResponse response) throws IOException, ServletException
 	{
 		switch (_availability)
@@ -308,13 +292,8 @@
 		return true;
 	}
 
-	/* ------------------------------------------------------------ */
-	/**
-	 * @see org.eclipse.jetty.server.handler.ScopedHandler#doScope(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest,
-	 *      javax.servlet.http.HttpServletResponse)
-	 */
 	@Override
-	public void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
+	public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
 	{
 		if (LOG.isDebugEnabled())
 			LOG.debug("scope {}|{}|{} @ {}",baseRequest.getContextPath(),baseRequest.getServletPath(),baseRequest.getPathInfo(),this);
@@ -375,16 +354,16 @@
 			if (LOG.isDebugEnabled())
 				LOG.debug("context={}|{}|{} @ {}",baseRequest.getContextPath(),baseRequest.getServletPath(), baseRequest.getPathInfo(),this);
 
-			// start manual inline of nextScope(target,baseRequest,request,response);
-			if (never())
-				nextScope(target,baseRequest,request,response);
-			else if (_nextScope != null)
-				_nextScope.doScope(target,baseRequest,request,response);
-			else if (_outerScope != null)
-				_outerScope.doHandle(target,baseRequest,request,response);
-			else
-				doHandle(target,baseRequest,request,response);
-			// end manual inline (pathentic attempt to reduce stack depth)
+			try
+			{
+				super.handle(target,baseRequest,request,response);
+			}
+			catch (HttpException e)
+			{
+				LOG.debug("",e);
+				baseRequest.setHandled(true);
+				response.sendError(e.getStatus(),e.getReason());
+			}
 		}
 		finally
 		{
@@ -400,34 +379,6 @@
 		}
 	}
 
-	/* ------------------------------------------------------------ */
-	/**
-	 * @see org.eclipse.jetty.server.handler.ScopedHandler#doHandle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest,
-	 *      javax.servlet.http.HttpServletResponse)
-	 */
-	@Override
-	public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
-	{
-		try
-		{
-			// start manual inline of nextHandle(target,baseRequest,request,response);
-			// noinspection ConstantIfStatement
-			if (never())
-				nextHandle(target,baseRequest,request,response);
-			else if (_nextScope != null && _nextScope == _handler)
-				_nextScope.doHandle(target,baseRequest,request,response);
-			else if (_handler != null)
-				_handler.handle(target,baseRequest,request,response);
-			// end manual inline
-		}
-		catch (HttpException e)
-		{
-			LOG.debug("",e);
-			baseRequest.setHandled(true);
-			response.sendError(e.getStatus(),e.getReason());
-		}
-	}
-
 	public void setContextPath(String contextPath)
 	{
 		if (contextPath != null && contextPath.length() > 1 && contextPath.endsWith("/"))