changeset 998:bf176925e00f

remove Request.getReader()
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 18 Oct 2016 23:01:00 -0600
parents 7d28be82ab75
children 74b9daf2826c
files src/org/eclipse/jetty/server/Request.java
diffstat 1 files changed, 3 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
diff -r 7d28be82ab75 -r bf176925e00f src/org/eclipse/jetty/server/Request.java
--- a/src/org/eclipse/jetty/server/Request.java	Tue Oct 18 22:43:17 2016 -0600
+++ b/src/org/eclipse/jetty/server/Request.java	Tue Oct 18 23:01:00 2016 -0600
@@ -65,7 +65,6 @@
 import org.eclipse.jetty.http.HttpCookie;
 import org.eclipse.jetty.http.HttpFields;
 import org.eclipse.jetty.http.HttpHeaders;
-import org.eclipse.jetty.http.HttpMethods;
 import org.eclipse.jetty.http.HttpParser;
 import org.eclipse.jetty.http.HttpStatus;
 import org.eclipse.jetty.http.HttpURI;
@@ -125,7 +124,7 @@
 	private static final Logger LOG = LoggerFactory.getLogger(Request.class);
 
 	private static final Collection __defaultLocale = Collections.singleton(Locale.getDefault());
-	private static final int __NONE = 0, _STREAM = 1, __READER = 2;
+	private static final int __NONE = 0, _STREAM = 1;
 
 	private volatile Attributes _attributes;
 	private MultiMap<String> _baseParameters;
@@ -145,7 +144,6 @@
 	private int _port;
 	private String _protocol = HttpVersions.HTTP_1_1;
 	private String _queryString;
-	private BufferedReader _reader;
 	private String _readerEncoding;
 	private String _requestURI;
 	private String _scheme = URIUtil.HTTP;
@@ -194,7 +192,7 @@
 				content_type = HttpFields.valueParameters(content_type,null);
 
 				if (MimeTypes.FORM_ENCODED.equalsIgnoreCase(content_type) && _inputState == __NONE
-						&& (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod())))
+						&& ("POST".equals(getMethod()) || "PUT".equals(getMethod())))
 				{
 					int content_length = getContentLength();
 					if (content_length != 0)
@@ -372,8 +370,6 @@
 	@Override
 	public ServletInputStream getInputStream() throws IOException
 	{
-		if (_inputState != __NONE && _inputState != _STREAM)
-			throw new IllegalStateException("READER");
 		_inputState = _STREAM;
 		return _connection.getInputStream();
 	}
@@ -552,31 +548,7 @@
 	@Override
 	public BufferedReader getReader() throws IOException
 	{
-		if (_inputState != __NONE && _inputState != __READER)
-			throw new IllegalStateException("STREAMED");
-
-		if (_inputState == __READER)
-			return _reader;
-
-		String encoding = getCharacterEncoding();
-		if (encoding == null)
-			encoding = StringUtil.__ISO_8859_1;
-
-		if (_reader == null || !encoding.equalsIgnoreCase(_readerEncoding))
-		{
-			final ServletInputStream in = getInputStream();
-			_readerEncoding = encoding;
-			_reader = new BufferedReader(new InputStreamReader(in,encoding))
-			{
-				@Override
-				public void close() throws IOException
-				{
-					in.close();
-				}
-			};
-		}
-		_inputState = __READER;
-		return _reader;
+		throw new UnsupportedOperationException();
 	}
 
 	@Override
@@ -893,21 +865,6 @@
 
 	protected void recycle()
 	{
-		if (_inputState == __READER)
-		{
-			try
-			{
-				int r = _reader.read();
-				while (r != -1)
-					r = _reader.read();
-			}
-			catch (Exception e)
-			{
-				LOG.trace("",e);
-				_reader = null;
-			}
-		}
-
 		_handled = false;
 		if (_contextHandler != null)
 			throw new IllegalStateException("Request in context!");