diff src/org/eclipse/jetty/server/Response.java @ 1023:27f3dc761452

MimeTypes uses StringCache
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 01 Nov 2016 03:44:46 -0600
parents 3718afd99988
children
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/Response.java	Tue Nov 01 01:04:46 2016 -0600
+++ b/src/org/eclipse/jetty/server/Response.java	Tue Nov 01 03:44:46 2016 -0600
@@ -42,7 +42,6 @@
 import org.eclipse.jetty.http.HttpURI;
 import org.eclipse.jetty.http.HttpVersions;
 import org.eclipse.jetty.http.MimeTypes;
-import org.eclipse.jetty.io.BufferCache.CachedBuffer;
 import org.eclipse.jetty.server.handler.ContextHandler;
 import org.eclipse.jetty.util.ByteArrayISO8859Writer;
 import org.eclipse.jetty.util.QuotedStringTokenizer;
@@ -84,7 +83,7 @@
 	private String _reason;
 	private Locale _locale;
 	private String _mimeType;
-	private CachedBuffer _cachedMimeType;
+	private String _cachedMimeType;
 	private String _characterEncoding;
 	private boolean _explicitEncoding;
 	private String _contentType;
@@ -481,7 +480,7 @@
 				{
 					_characterEncoding=null;
 					if (_cachedMimeType!=null)
-						_contentType = _cachedMimeType.toString();
+						_contentType = _cachedMimeType;
 					else if (_mimeType!=null)
 						_contentType = _mimeType;
 					else
@@ -505,10 +504,10 @@
 						_contentType=null;
 						if(_cachedMimeType!=null)
 						{
-							CachedBuffer content_type = _cachedMimeType.getAssociate(_characterEncoding);
+							String content_type = MimeTypes.getAssociate(_cachedMimeType,_characterEncoding);
 							if (content_type!=null)
 							{
-								_contentType = content_type.toString();
+								_contentType = content_type;
 								_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 							}
 						}
@@ -620,10 +619,10 @@
 						{
 							if (_cachedMimeType!=null)
 							{
-								CachedBuffer content_type = _cachedMimeType.getAssociate(_characterEncoding);
+								String content_type = MimeTypes.getAssociate(_cachedMimeType,_characterEncoding);
 								if (content_type!=null)
 								{
-									_contentType=content_type.toString();
+									_contentType=content_type;
 									_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 								}
 								else
@@ -657,10 +656,10 @@
 
 						if (_cachedMimeType!=null)
 						{
-							CachedBuffer content_type = _cachedMimeType.getAssociate(_characterEncoding);
+							String content_type = MimeTypes.getAssociate(_cachedMimeType,_characterEncoding);
 							if (content_type!=null)
 							{
-								_contentType=content_type.toString();
+								_contentType=content_type;
 								_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 							}
 							else
@@ -704,10 +703,10 @@
 				{
 					if (_cachedMimeType!=null)
 					{
-						CachedBuffer content_type = _cachedMimeType.getAssociate(_characterEncoding);
+						String content_type = MimeTypes.getAssociate(_cachedMimeType,_characterEncoding);
 						if (content_type!=null)
 						{
-							_contentType=content_type.toString();
+							_contentType=content_type;
 							_connection._responseFields.put(HttpHeaders.CONTENT_TYPE,_contentType);
 						}
 						else