diff src/org/eclipse/jetty/server/Response.java @ 1022:3718afd99988

HttpHeaders uses StringCache
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 01 Nov 2016 01:04:46 -0600
parents 6be43ef1eb96
children 27f3dc761452
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/Response.java	Mon Oct 31 22:49:25 2016 -0600
+++ b/src/org/eclipse/jetty/server/Response.java	Tue Nov 01 01:04:46 2016 -0600
@@ -233,8 +233,8 @@
 		}
 		else if (code!=SC_PARTIAL_CONTENT)
 		{
-			_connection._requestFields.remove(HttpHeaders.CONTENT_TYPE_BUFFER);
-			_connection._requestFields.remove(HttpHeaders.CONTENT_LENGTH_BUFFER);
+			_connection._requestFields.remove(HttpHeaders.CONTENT_TYPE);
+			_connection._requestFields.remove(HttpHeaders.CONTENT_LENGTH);
 			_characterEncoding = null;
 			_mimeType = null;
 			_cachedMimeType = null;
@@ -488,9 +488,9 @@
 						_contentType = null;
 
 					if (_contentType==null)
-						_connection._responseFields.remove(HttpHeaders.CONTENT_TYPE_BUFFER);
+						_connection._responseFields.remove(HttpHeaders.CONTENT_TYPE);
 					else
-						_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+						_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 				}
 			}
 			else
@@ -509,14 +509,14 @@
 							if (content_type!=null)
 							{
 								_contentType = content_type.toString();
-								_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type);
+								_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 							}
 						}
 
 						if (_contentType==null)
 						{
 							_contentType = _mimeType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
-							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 						}
 					}
 					else
@@ -535,7 +535,7 @@
 							else
 								_contentType=_contentType.substring(0,i8)+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ")+_contentType.substring(i2);
 						}
-						_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+						_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 					}
 				}
 			}
@@ -590,7 +590,7 @@
 			_mimeType = null;
 			_cachedMimeType = null;
 			_contentType=null;
-			_connection._responseFields.remove(HttpHeaders.CONTENT_TYPE_BUFFER);
+			_connection._responseFields.remove(HttpHeaders.CONTENT_TYPE);
 		}
 		else
 		{
@@ -624,29 +624,29 @@
 								if (content_type!=null)
 								{
 									_contentType=content_type.toString();
-									_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type);
+									_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 								}
 								else
 								{
 									_contentType = _mimeType+";charset="+_characterEncoding;
-									_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+									_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 								}
 							}
 							else
 							{
 								_contentType = _mimeType+";charset="+_characterEncoding;
-								_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+								_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 							}
 						}
 						else if (i2<0)
 						{
 							_contentType=contentType.substring(0,i1)+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
-							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 						}
 						else
 						{
 							_contentType=contentType.substring(0,i1)+contentType.substring(i2)+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
-							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 						}
 					}
 					else if ((i1==i0+1 && i2<0) || (i1==i0+2 && i2<0 && contentType.charAt(i0+1)==' '))
@@ -661,38 +661,38 @@
 							if (content_type!=null)
 							{
 								_contentType=content_type.toString();
-								_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type);
+								_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 							}
 							else
 							{
 								_contentType=contentType;
-								_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+								_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 							}
 						}
 						else
 						{
 							_contentType=contentType;
-							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 						}
 					}
 					else if (i2>0)
 					{
 						_characterEncoding = QuotedStringTokenizer.unquote(contentType.substring(i8,i2));
 						_contentType=contentType;
-						_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+						_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 					}
 					else
 					{
 						_characterEncoding = QuotedStringTokenizer.unquote(contentType.substring(i8));
 						_contentType=contentType;
-						_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+						_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 					}
 				}
 				else // No encoding in the params.
 				{
 					_cachedMimeType = null;
 					_contentType=_characterEncoding==null?contentType:contentType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
-					_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+					_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 				}
 			}
 			else // No params at all
@@ -708,29 +708,29 @@
 						if (content_type!=null)
 						{
 							_contentType=content_type.toString();
-							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type);
+							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 						}
 						else
 						{
 							_contentType = _mimeType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
-							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 						}
 					}
 					else
 					{
 						_contentType=contentType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ");
-						_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+						_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 					}
 				}
 				else if (_cachedMimeType!=null)
 				{
 					_contentType = _cachedMimeType.toString();
-					_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_cachedMimeType);
+					_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 				}
 				else
 				{
 					_contentType=contentType;
-					_connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
+					_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 				}
 			}
 		}
@@ -765,7 +765,7 @@
 		HttpFields response_fields=_connection._responseFields;
 		
 		response_fields.clear();
-		String connection=_connection._requestFields.getStringField(HttpHeaders.CONNECTION_BUFFER);
+		String connection=_connection._requestFields.getStringField(HttpHeaders.CONNECTION);
 		if (connection!=null)
 		{
 			String[] values = connection.split(",");
@@ -778,15 +778,15 @@
 					switch(cb)
 					{
 						case HttpHeaderValues.CLOSE_ORDINAL:
-							response_fields.put(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.CLOSE);
+							response_fields.put(HttpHeaders.CONNECTION,HttpHeaderValues.CLOSE);
 							break;
 
 						case HttpHeaderValues.KEEP_ALIVE_ORDINAL:
 							if (HttpVersions.HTTP_1_0.equalsIgnoreCase(_connection.getRequest().getProtocol()))
-								response_fields.put(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.KEEP_ALIVE);
+								response_fields.put(HttpHeaders.CONNECTION,HttpHeaderValues.KEEP_ALIVE);
 							break;
 						case HttpHeaderValues.TE_ORDINAL:
-							response_fields.put(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.TE);
+							response_fields.put(HttpHeaders.CONNECTION,HttpHeaderValues.TE);
 							break;
 					}
 				}
@@ -825,7 +825,7 @@
 			return;
 
 		_locale = locale;
-		_connection._responseFields.put(HttpHeaders.CONTENT_LANGUAGE_BUFFER,locale.toString().replace('_','-'));
+		_connection._responseFields.put(HttpHeaders.CONTENT_LANGUAGE,locale.toString().replace('_','-'));
 	}
 
 	@Override