diff src/org/eclipse/jetty/server/Request.java @ 972:5ee36654b383

simplify AbstractHttpConnection
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 15 Oct 2016 22:42:05 -0600
parents 8db5996c8c89
children d35b0a3a7a4a
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/Request.java	Fri Oct 14 13:06:06 2016 -0600
+++ b/src/org/eclipse/jetty/server/Request.java	Sat Oct 15 22:42:05 2016 -0600
@@ -133,7 +133,6 @@
 	private static final int __NONE = 0, _STREAM = 1, __READER = 2;
 
 	
-	/* ------------------------------------------------------------ */
 	public static Request getRequest(HttpServletRequest request)
 	{
 		if (request instanceof Request)
@@ -435,15 +434,15 @@
 	 */
 	public int getContentLength()
 	{
-		return (int)_connection.getRequestFields().getLongField(HttpHeaders.CONTENT_LENGTH_BUFFER);
+		return (int)_connection._requestFields.getLongField(HttpHeaders.CONTENT_LENGTH_BUFFER);
 	}
 
 	public long getContentRead()
 	{
-		if (_connection == null || _connection.getParser() == null)
+		if (_connection == null)
 			return -1;
 
-		return ((HttpParser)_connection.getParser()).getContentRead();
+		return _connection._parser.getContentRead();
 	}
 
 	/* ------------------------------------------------------------ */
@@ -452,7 +451,7 @@
 	 */
 	public String getContentType()
 	{
-		return _connection.getRequestFields().getStringField(HttpHeaders.CONTENT_TYPE_BUFFER);
+		return _connection._requestFields.getStringField(HttpHeaders.CONTENT_TYPE_BUFFER);
 	}
 
 	/* ------------------------------------------------------------ */
@@ -484,7 +483,7 @@
 
 		_cookiesExtracted = true;
 
-		Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.COOKIE_BUFFER);
+		Enumeration enm = _connection._requestFields.getValues(HttpHeaders.COOKIE_BUFFER);
 
 		// Handle no cookies
 		if (enm != null)
@@ -508,7 +507,7 @@
 	 */
 	public long getDateHeader(String name)
 	{
-		return _connection.getRequestFields().getDateField(name);
+		return _connection._requestFields.getDateField(name);
 	}
 
 	/* ------------------------------------------------------------ */
@@ -523,7 +522,7 @@
 	 */
 	public String getHeader(String name)
 	{
-		return _connection.getRequestFields().getStringField(name);
+		return _connection._requestFields.getStringField(name);
 	}
 
 	/* ------------------------------------------------------------ */
@@ -532,7 +531,7 @@
 	 */
 	public Enumeration getHeaderNames()
 	{
-		return _connection.getRequestFields().getFieldNames();
+		return _connection._requestFields.getFieldNames();
 	}
 
 	/* ------------------------------------------------------------ */
@@ -541,7 +540,7 @@
 	 */
 	public Enumeration getHeaders(String name)
 	{
-		Enumeration e = _connection.getRequestFields().getValues(name);
+		Enumeration e = _connection._requestFields.getValues(name);
 		if (e == null)
 			return Collections.enumeration(Collections.EMPTY_LIST);
 		return e;
@@ -574,7 +573,7 @@
 	 */
 	public int getIntHeader(String name)
 	{
-		return (int)_connection.getRequestFields().getLongField(name);
+		return (int)_connection._requestFields.getLongField(name);
 	}
 
 	/* ------------------------------------------------------------ */
@@ -592,7 +591,7 @@
 	 */
 	public Locale getLocale()
 	{
-		Enumeration enm = _connection.getRequestFields().getValues( "Accept-Language", ", \t" );
+		Enumeration enm = _connection._requestFields.getValues( "Accept-Language", ", \t" );
 
 		// handle no locale
 		if (enm == null || !enm.hasMoreElements())
@@ -629,7 +628,7 @@
 	public Enumeration getLocales()
 	{
 
-		Enumeration enm = _connection.getRequestFields().getValues( "Accept-Language", ", \t" );
+		Enumeration enm = _connection._requestFields.getValues( "Accept-Language", ", \t" );
 
 		// handle no locale
 		if (enm == null || !enm.hasMoreElements())
@@ -1011,7 +1010,7 @@
 			return _serverName;
 
 		// Return host from header field
-		Buffer hostPort = _connection.getRequestFields().get(HttpHeaders.HOST_BUFFER);
+		Buffer hostPort = _connection._requestFields.get(HttpHeaders.HOST_BUFFER);
 		if (hostPort != null)
 		{
 			loop: for (int i = hostPort.putIndex(); i-- > hostPort.getIndex();)
@@ -1255,7 +1254,7 @@
 	 */
 	public boolean isSecure()
 	{
-		return _connection.isConfidential(this);
+		return _connection.getConnector().isConfidential();
 	}
 
 	/* ------------------------------------------------------------ */
@@ -1490,7 +1489,7 @@
 	 */
 	public void setContentType(String contentType)
 	{
-		_connection.getRequestFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,contentType);
+		_connection._requestFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,contentType);
 
 	}