changeset 990:83cc6e05a58f

remove special attribute handling
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 17 Oct 2016 05:50:47 -0600
parents 900e5b8ccd19
children 688c39c50ee3
files src/org/eclipse/jetty/http/HttpGenerator.java src/org/eclipse/jetty/server/AbstractHttpConnection.java src/org/eclipse/jetty/server/Request.java
diffstat 3 files changed, 3 insertions(+), 128 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpGenerator.java	Mon Oct 17 05:39:54 2016 -0600
+++ b/src/org/eclipse/jetty/http/HttpGenerator.java	Mon Oct 17 05:50:47 2016 -0600
@@ -216,28 +216,6 @@
 	}
 
 	/* ------------------------------------------------------------ */
-	/**
-	 * send complete response.
-	 *
-	 * @param response
-	 */
-	public void sendResponse(Buffer response) throws IOException
-	{
-		if (_noContent || _state!=STATE_HEADER || _content!=null && _content.length()>0 || _bufferChunked || _head )
-			throw new IllegalStateException();
-
-		_last = true;
-
-		_content = response;
-		_bypass = true;
-		_state = STATE_FLUSHING;
-
-		// TODO this is not exactly right, but should do.
-		_contentLength =_contentWritten = response.length();
-
-	}
-
-	/* ------------------------------------------------------------ */
 	/** Prepare buffer for unchecked writes.
 	 * Prepare the generator buffer to receive unchecked writes
 	 * @return the available space in the buffer.
--- a/src/org/eclipse/jetty/server/AbstractHttpConnection.java	Mon Oct 17 05:39:54 2016 -0600
+++ b/src/org/eclipse/jetty/server/AbstractHttpConnection.java	Mon Oct 17 05:50:47 2016 -0600
@@ -840,11 +840,6 @@
 			writer.print(s);
 		}
 
-		public void sendResponse(Buffer response) throws IOException
-		{
-			_generator.sendResponse(response);
-		}
-
 		public void sendContent(Object content) throws IOException
 		{
 			Resource resource=null;
--- a/src/org/eclipse/jetty/server/Request.java	Mon Oct 17 05:39:54 2016 -0600
+++ b/src/org/eclipse/jetty/server/Request.java	Mon Oct 17 05:50:47 2016 -0600
@@ -151,7 +151,6 @@
 	private String _pathInfo;
 	private int _port;
 	private String _protocol = HttpVersions.HTTP_1_1;
-	private String _queryEncoding;
 	private String _queryString;
 	private BufferedReader _reader;
 	private String _readerEncoding;
@@ -201,22 +200,7 @@
 			// Handle query string
 			if (_uri != null && _uri.hasQuery())
 			{
-				if (_queryEncoding == null)
-					_uri.decodeQueryTo(_baseParameters);
-				else
-				{
-					try
-					{
-						_uri.decodeQueryTo(_baseParameters,_queryEncoding);
-					}
-					catch (UnsupportedEncodingException e)
-					{
-						if (LOG.isDebugEnabled())
-							LOG.warn("",e);
-						else
-							LOG.warn(e.toString());
-					}
-				}
+				_uri.decodeQueryTo(_baseParameters);
 			}
 
 			// handle any _content.
@@ -745,12 +729,6 @@
 	}
 
 	/* ------------------------------------------------------------ */
-	public String getQueryEncoding()
-	{
-		return _queryEncoding;
-	}
-
-	/* ------------------------------------------------------------ */
 	/*
 	 * @see javax.servlet.http.HttpServletRequest#getQueryString()
 	 */
@@ -758,10 +736,7 @@
 	{
 		if (_queryString == null && _uri != null)
 		{
-			if (_queryEncoding == null)
-				_queryString = _uri.getQuery();
-			else
-				_queryString = _uri.getQuery(_queryEncoding);
+			_queryString = _uri.getQuery();
 		}
 		return _queryString;
 	}
@@ -1264,7 +1239,6 @@
 		_pathInfo = null;
 		_port = 0;
 		_protocol = HttpVersions.HTTP_1_1;
-		_queryEncoding = null;
 		_queryString = null;
 		_requestURI = null;
 		_scheme = URIUtil.HTTP;
@@ -1300,52 +1274,6 @@
 	 */
 	public void setAttribute(String name, Object value)
 	{
-		Object old_value = _attributes == null?null:_attributes.getAttribute(name);
-
-		if (name.startsWith("org.eclipse.jetty."))
-		{
-			if ("org.eclipse.jetty.server.Request.queryEncoding".equals(name))
-				setQueryEncoding(value == null?null:value.toString());
-			else if ("org.eclipse.jetty.server.sendContent".equals(name))
-			{
-				try
-				{
-					((AbstractHttpConnection.Output)getServletResponse().getOutputStream()).sendContent(value);
-				}
-				catch (IOException e)
-				{
-					throw new RuntimeException(e);
-				}
-			}
-			else if ("org.eclipse.jetty.server.ResponseBuffer".equals(name))
-			{
-				try
-				{
-					final ByteBuffer byteBuffer = (ByteBuffer)value;
-					synchronized (byteBuffer)
-					{
-						NIOBuffer buffer = byteBuffer.isDirect()?new DirectNIOBuffer(byteBuffer,true):new IndirectNIOBuffer(byteBuffer,true);
-						((AbstractHttpConnection.Output)getServletResponse().getOutputStream()).sendResponse(buffer);
-					}
-				}
-				catch (IOException e)
-				{
-					throw new RuntimeException(e);
-				}
-			}
-			else if ("org.eclipse.jetty.io.EndPoint.maxIdleTime".equalsIgnoreCase(name))
-			{
-				try
-				{
-					getConnection().getEndPoint().setMaxIdleTime(Integer.valueOf(value.toString()));
-				}
-				catch (IOException e)
-				{
-					throw new RuntimeException(e);
-				}
-			}
-		}
-
 		if (_attributes == null)
 			_attributes = new AttributesMap();
 		_attributes.setAttribute(name,value);
@@ -1353,16 +1281,6 @@
 
 	/* ------------------------------------------------------------ */
 	/*
-	 */
-	public void setAttributes(Attributes attributes)
-	{
-		_attributes = attributes;
-	}
-
-	/* ------------------------------------------------------------ */
-
-	/* ------------------------------------------------------------ */
-	/*
 	 * @see javax.servlet.ServletRequest#setCharacterEncoding(java.lang.String)
 	 */
 	public void setCharacterEncoding(String encoding) throws UnsupportedEncodingException
@@ -1509,28 +1427,12 @@
 
 	/* ------------------------------------------------------------ */
 	/**
-	 * Set the character encoding used for the query string. This call will effect the return of getQueryString and getParamaters. It must be called before any
-	 * geParameter methods.
-	 *
-	 * The request attribute "org.eclipse.jetty.server.server.Request.queryEncoding" may be set as an alternate method of calling setQueryEncoding.
-	 *
-	 * @param queryEncoding
-	 */
-	public void setQueryEncoding(String queryEncoding)
-	{
-		_queryEncoding = queryEncoding;
-		_queryString = null;
-	}
-
-	/* ------------------------------------------------------------ */
-	/**
 	 * @param queryString
 	 *            The queryString to set.
 	 */
 	public void setQueryString(String queryString)
 	{
 		_queryString = queryString;
-		_queryEncoding = null; //assume utf-8
 	}
 
 	/* ------------------------------------------------------------ */
@@ -1727,7 +1629,7 @@
 			{
 				StringBuilder overridden_query_string = new StringBuilder();
 				MultiMap<String> overridden_old_query = new MultiMap<String>();
-				UrlEncoded.decodeTo(_queryString,overridden_old_query,getQueryEncoding());//decode using any queryencoding set for the request
+				UrlEncoded.decodeTo(_queryString,overridden_old_query,null);//decode using any queryencoding set for the request
 				
 				
 				MultiMap<String> overridden_new_query = new MultiMap<String>();