diff src/org/eclipse/jetty/server/Request.java @ 991:688c39c50ee3

simplify ContextHandler
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 18 Oct 2016 00:22:46 -0600
parents 83cc6e05a58f
children 4e9d373bf6e9
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/Request.java	Mon Oct 17 05:50:47 2016 -0600
+++ b/src/org/eclipse/jetty/server/Request.java	Tue Oct 18 00:22:46 2016 -0600
@@ -121,7 +121,7 @@
  *
  *
  */
-public class Request implements HttpServletRequest
+public final class Request implements HttpServletRequest
 {
 	public static final String __MULTIPART_CONFIG_ELEMENT = "org.eclipse.multipartConfig";
 	public static final String __MULTIPART_INPUT_STREAM = "org.eclipse.multiPartInputStream";
@@ -137,11 +137,9 @@
 	private String _characterEncoding;
 	protected AbstractHttpConnection _connection;
 	private ContextHandler.Context _context;
-	private boolean _newContext;
 	private String _contextPath;
 	private CookieCutter _cookies;
 	private boolean _cookiesExtracted = false;
-	private DispatcherType _dispatcherType;
 	private EndPoint _endp;
 	private boolean _handled = false;
 	private int _inputState = __NONE;
@@ -221,12 +219,6 @@
 							int maxFormContentSize = -1;
 							int maxFormKeys = -1;
 
-							if (_context != null)
-							{
-								maxFormContentSize = _context.getContextHandler().getMaxFormContentSize();
-								maxFormKeys = _context.getContextHandler().getMaxFormKeys();
-							}
-							
 							if (maxFormContentSize < 0)
 							{
 								maxFormContentSize = 200000;
@@ -454,10 +446,10 @@
 		return _connection._requestFields.getDateField(name);
 	}
 
-	/* ------------------------------------------------------------ */
+	@Override
 	public DispatcherType getDispatcherType()
 	{
-		return _dispatcherType;
+		throw new UnsupportedOperationException();
 	}
 
 	/* ------------------------------------------------------------ */
@@ -708,15 +700,10 @@
 		return _pathInfo;
 	}
 
-	/* ------------------------------------------------------------ */
-	/*
-	 * @see javax.servlet.http.HttpServletRequest#getPathTranslated()
-	 */
+	@Override
 	public String getPathTranslated()
 	{
-		if (_pathInfo == null || _context == null)
-			return null;
-		return _context.getRealPath(_pathInfo);
+		return null;
 	}
 
 	/* ------------------------------------------------------------ */
@@ -774,15 +761,10 @@
 		return _reader;
 	}
 
-	/* ------------------------------------------------------------ */
-	/*
-	 * @see javax.servlet.ServletRequest#getRealPath(java.lang.String)
-	 */
+	@Override
 	public String getRealPath(String path)
 	{
-		if (_context == null)
-			return null;
-		return _context.getRealPath(path);
+		return null;
 	}
 
 	/* ------------------------------------------------------------ */
@@ -826,10 +808,7 @@
 		return p.getName();
 	}
 
-	/* ------------------------------------------------------------ */
-	/*
-	 * @see javax.servlet.ServletRequest#getRequestDispatcher(java.lang.String)
-	 */
+	@Override
 	public RequestDispatcher getRequestDispatcher(String path)
 	{
 		throw new UnsupportedOperationException();
@@ -1036,9 +1015,10 @@
 		return _port;
 	}
 
+	@Override
 	public ServletContext getServletContext()
 	{
-		return _context;
+		throw new UnsupportedOperationException();
 	}
 
 	/* ------------------------------------------------------------ */
@@ -1332,24 +1312,11 @@
 	 */
 	public void setContext(Context context)
 	{
-		_newContext = _context != context;
 		_context = context;
 	}
 
 	/* ------------------------------------------------------------ */
 	/**
-	 * @return True if this is the first call of {@link #takeNewContext()} since the last
-	 *         {@link #setContext(org.eclipse.jetty.server.handler.ContextHandler.Context)} call.
-	 */
-	public boolean takeNewContext()
-	{
-		boolean nc = _newContext;
-		_newContext = false;
-		return nc;
-	}
-
-	/* ------------------------------------------------------------ */
-	/**
 	 * Sets the "context path" for this request
 	 *
 	 * @see HttpServletRequest#getContextPath()
@@ -1372,12 +1339,6 @@
 	}
 
 	/* ------------------------------------------------------------ */
-	public void setDispatcherType(DispatcherType type)
-	{
-		_dispatcherType = type;
-	}
-
-	/* ------------------------------------------------------------ */
 	public void setHandled(boolean h)
 	{
 		_handled = h;