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

remove ScopedHandler
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 18 Oct 2016 15:54:54 -0600
parents 22a4e93ed20e
children 32d4b569567c
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/handler/HandlerWrapper.java	Tue Oct 18 15:23:25 2016 -0600
+++ b/src/org/eclipse/jetty/server/handler/HandlerWrapper.java	Tue Oct 18 15:54:54 2016 -0600
@@ -36,141 +36,141 @@
  */
 public class HandlerWrapper extends AbstractHandlerContainer
 {
-    protected Handler _handler;
+	protected Handler _handler;
 
-    /* ------------------------------------------------------------ */
-    /**
-     *
-     */
-    public HandlerWrapper()
-    {
-    }
+	/* ------------------------------------------------------------ */
+	/**
+	 *
+	 */
+	public HandlerWrapper()
+	{
+	}
 
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Returns the handlers.
-     */
-    public Handler getHandler()
-    {
-        return _handler;
-    }
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return Returns the handlers.
+	 */
+	public Handler getHandler()
+	{
+		return _handler;
+	}
 
-    /* ------------------------------------------------------------ */
-    /**
-     * @return Returns the handlers.
-     */
-    public Handler[] getHandlers()
-    {
-        if (_handler==null)
-            return new Handler[0];
-        return new Handler[] {_handler};
-    }
+	/* ------------------------------------------------------------ */
+	/**
+	 * @return Returns the handlers.
+	 */
+	public Handler[] getHandlers()
+	{
+		if (_handler==null)
+			return new Handler[0];
+		return new Handler[] {_handler};
+	}
 
-    /* ------------------------------------------------------------ */
-    /**
-     * @param handler Set the {@link Handler} which should be wrapped.
-     */
-    public void setHandler(Handler handler)
-    {
-        if (isStarted())
-            throw new IllegalStateException(STARTED);
+	/* ------------------------------------------------------------ */
+	/**
+	 * @param handler Set the {@link Handler} which should be wrapped.
+	 */
+	public void setHandler(Handler handler)
+	{
+		if (isStarted())
+			throw new IllegalStateException(STARTED);
 
-        Handler old_handler = _handler;
-        _handler = handler;
-        if (handler!=null)
-            handler.setServer(getServer());
-    }
+		Handler old_handler = _handler;
+		_handler = handler;
+		if (handler!=null)
+			handler.setServer(getServer());
+	}
 
-    /* ------------------------------------------------------------ */
-    /*
-     * @see org.eclipse.thread.AbstractLifeCycle#doStart()
-     */
-    @Override
-    protected void doStart() throws Exception
-    {
-        if (_handler!=null)
-            _handler.start();
-        super.doStart();
-    }
+	/* ------------------------------------------------------------ */
+	/*
+	 * @see org.eclipse.thread.AbstractLifeCycle#doStart()
+	 */
+	@Override
+	protected void doStart() throws Exception
+	{
+		if (_handler!=null)
+			_handler.start();
+		super.doStart();
+	}
 
-    /* ------------------------------------------------------------ */
-    /*
-     * @see org.eclipse.thread.AbstractLifeCycle#doStop()
-     */
-    @Override
-    protected void doStop() throws Exception
-    {
-        if (_handler!=null)
-            _handler.stop();
-        super.doStop();
-    }
+	/* ------------------------------------------------------------ */
+	/*
+	 * @see org.eclipse.thread.AbstractLifeCycle#doStop()
+	 */
+	@Override
+	protected void doStop() throws Exception
+	{
+		if (_handler!=null)
+			_handler.stop();
+		super.doStop();
+	}
 
-    /* ------------------------------------------------------------ */
-    public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
-    {
-        if (_handler!=null && isStarted())
-        {
-            _handler.handle(target,baseRequest, request, response);
-        }
-    }
+	/* ------------------------------------------------------------ */
+	public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
+	{
+		if (_handler!=null && isStarted())
+		{
+			_handler.handle(target,baseRequest, request, response);
+		}
+	}
 
 
-    /* ------------------------------------------------------------ */
-    @Override
-    public void setServer(Server server)
-    {
-        Server old_server=getServer();
-        if (server==old_server)
-            return;
+	/* ------------------------------------------------------------ */
+	@Override
+	public void setServer(Server server)
+	{
+		Server old_server=getServer();
+		if (server==old_server)
+			return;
 
-        if (isStarted())
-            throw new IllegalStateException(STARTED);
+		if (isStarted())
+			throw new IllegalStateException(STARTED);
 
-        super.setServer(server);
+		super.setServer(server);
 
-        Handler h=getHandler();
-        if (h!=null)
-            h.setServer(server);
-    }
+		Handler h=getHandler();
+		if (h!=null)
+			h.setServer(server);
+	}
 
 
-    /* ------------------------------------------------------------ */
-    @Override
-    protected Object expandChildren(Object list, Class byClass)
-    {
-        return expandHandler(_handler,list,byClass);
-    }
+	/* ------------------------------------------------------------ */
+	@Override
+	protected Object expandChildren(Object list, Class byClass)
+	{
+		return expandHandler(_handler,list,byClass);
+	}
 
-    /* ------------------------------------------------------------ */
-    public <H extends Handler> H getNestedHandlerByClass(Class<H> byclass)
-    {
-        HandlerWrapper h=this;
-        while (h!=null)
-        {
-            if (byclass.isInstance(h))
-                return (H)h;
-            Handler w = h.getHandler();
-            if (w instanceof HandlerWrapper)
-                h=(HandlerWrapper)w;
-            else break;
-        }
-        return null;
+	/* ------------------------------------------------------------ */
+	public <H extends Handler> H getNestedHandlerByClass(Class<H> byclass)
+	{
+		HandlerWrapper h=this;
+		while (h!=null)
+		{
+			if (byclass.isInstance(h))
+				return (H)h;
+			Handler w = h.getHandler();
+			if (w instanceof HandlerWrapper)
+				h=(HandlerWrapper)w;
+			else break;
+		}
+		return null;
 
-    }
+	}
 
-    /* ------------------------------------------------------------ */
-    @Override
-    public void destroy()
-    {
-        if (!isStopped())
-            throw new IllegalStateException("!STOPPED");
-        Handler child=getHandler();
-        if (child!=null)
-        {
-            setHandler(null);
-            child.destroy();
-        }
-        super.destroy();
-    }
+	/* ------------------------------------------------------------ */
+	@Override
+	public void destroy()
+	{
+		if (!isStopped())
+			throw new IllegalStateException("!STOPPED");
+		Handler child=getHandler();
+		if (child!=null)
+		{
+			setHandler(null);
+			child.destroy();
+		}
+		super.destroy();
+	}
 
 }