diff src/org/eclipse/jetty/server/handler/ContextHandler.java @ 828:8579194add85

some ContextHandler cleanup
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 15 Sep 2016 16:47:49 -0600
parents 0048a843297a
children 7c737c376bc3
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/handler/ContextHandler.java	Thu Sep 15 16:21:56 2016 -0600
+++ b/src/org/eclipse/jetty/server/handler/ContextHandler.java	Thu Sep 15 16:47:49 2016 -0600
@@ -1712,11 +1712,10 @@
 	 *
 	 *
 	 */
-	public class Context implements ServletContext
+	public final class Context implements ServletContext
 	{
 		protected int _majorVersion = 3;
 		protected int _minorVersion = 0;
-		protected boolean _enabled = true; //whether or not the dynamic API is enabled for callers
 
 		/* ------------------------------------------------------------ */
 		protected Context()
@@ -1859,7 +1858,7 @@
 		@Override
 		public RequestDispatcher getNamedDispatcher(String name)
 		{
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		/* ------------------------------------------------------------ */
@@ -1964,7 +1963,7 @@
 		@Deprecated
 		public Servlet getServlet(String name) throws ServletException
 		{
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		/* ------------------------------------------------------------ */
@@ -1976,7 +1975,7 @@
 		@Deprecated
 		public Enumeration getServletNames()
 		{
-			return Collections.enumeration(Collections.EMPTY_LIST);
+			throw new UnsupportedOperationException();
 		}
 
 		/* ------------------------------------------------------------ */
@@ -1988,7 +1987,7 @@
 		@Deprecated
 		public Enumeration getServlets()
 		{
-			return Collections.enumeration(Collections.EMPTY_LIST);
+			throw new UnsupportedOperationException();
 		}
 
 		/* ------------------------------------------------------------ */
@@ -2186,157 +2185,115 @@
 		@Override
 		public Dynamic addFilter(String filterName, Class<? extends Filter> filterClass)
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public Dynamic addFilter(String filterName, Filter filter)
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public Dynamic addFilter(String filterName, String className)
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public javax.servlet.ServletRegistration.Dynamic addServlet(String servletName, Class<? extends Servlet> servletClass)
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public javax.servlet.ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet)
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public javax.servlet.ServletRegistration.Dynamic addServlet(String servletName, String className)
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public <T extends Filter> T createFilter(Class<T> c) throws ServletException
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public <T extends Servlet> T createServlet(Class<T> c) throws ServletException
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public Set<SessionTrackingMode> getDefaultSessionTrackingModes()
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public Set<SessionTrackingMode> getEffectiveSessionTrackingModes()
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public FilterRegistration getFilterRegistration(String filterName)
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public Map<String, ? extends FilterRegistration> getFilterRegistrations()
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public ServletRegistration getServletRegistration(String servletName)
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public Map<String, ? extends ServletRegistration> getServletRegistrations()
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public SessionCookieConfig getSessionCookieConfig()
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes)
 		{
-			LOG.warn(__unimplmented);
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public void addListener(String className)
 		{
-			if (!_enabled)
-				throw new UnsupportedOperationException();
-			
-			try
-			{
-//				Class<? extends EventListener> clazz = _classLoader==null?Loader.loadClass(ContextHandler.class,className):_classLoader.loadClass(className);
-				Class clazz = _classLoader==null?Loader.loadClass(ContextHandler.class,className):_classLoader.loadClass(className);
-				addListener(clazz);
-			}
-			catch (ClassNotFoundException e)
-			{
-				throw new IllegalArgumentException(e);
-			}
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public <T extends EventListener> void addListener(T t)
 		{            
-			if (!_enabled)
-				throw new UnsupportedOperationException();
-			ContextHandler.this.addEventListener(t);
-			ContextHandler.this.restrictEventListener(t);
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
 		public void addListener(Class<? extends EventListener> listenerClass)
 		{            
-			if (!_enabled)
-				throw new UnsupportedOperationException();
-
-			try
-			{
-				EventListener e = createListener(listenerClass);
-				ContextHandler.this.addEventListener(e);
-				ContextHandler.this.restrictEventListener(e);
-			}
-			catch (ServletException e)
-			{
-				throw new IllegalArgumentException(e);
-			}
+			throw new UnsupportedOperationException();
 		}
 
 		@Override
@@ -2388,35 +2345,18 @@
 		@Override
 		public JspConfigDescriptor getJspConfigDescriptor()
 		{
-			LOG.warn(__unimplmented);
-			return null;
+			throw new UnsupportedOperationException();
 		}
 
 		public void setJspConfigDescriptor(JspConfigDescriptor d)
 		{
-			
+			throw new UnsupportedOperationException();
 		}
 		
 		@Override
 		public void declareRoles(String... roleNames)
 		{
-			if (!isStarting())
-				throw new IllegalStateException ();
-			if (!_enabled)
-				throw new UnsupportedOperationException();
-			
-			// TODO Auto-generated method stub
-			
-		}
-
-		public void setEnabled(boolean enabled)
-		{
-			_enabled = enabled;
-		}
-
-		public boolean isEnabled()
-		{
-			return _enabled;
+			throw new UnsupportedOperationException();
 		}
 	}