comparison src/org/eclipse/jetty/server/Request.java @ 855:fa6158f29c45

remove BufferDateCache and DateCache
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 20 Sep 2016 21:38:44 -0600
parents 86338c0029a9
children 3dcc52e17535
comparison
equal deleted inserted replaced
854:359012f4e797 855:fa6158f29c45
26 import java.io.InputStreamReader; 26 import java.io.InputStreamReader;
27 import java.io.UnsupportedEncodingException; 27 import java.io.UnsupportedEncodingException;
28 import java.net.InetAddress; 28 import java.net.InetAddress;
29 import java.nio.ByteBuffer; 29 import java.nio.ByteBuffer;
30 import java.security.Principal; 30 import java.security.Principal;
31 import java.text.DateFormat;
32 import java.text.SimpleDateFormat;
33 import java.util.TimeZone;
31 import java.util.Collection; 34 import java.util.Collection;
32 import java.util.Collections; 35 import java.util.Collections;
33 import java.util.Enumeration; 36 import java.util.Enumeration;
34 import java.util.EventListener; 37 import java.util.EventListener;
35 import java.util.HashMap; 38 import java.util.HashMap;
1224 * @return The time that the request was received. 1227 * @return The time that the request was received.
1225 */ 1228 */
1226 public Buffer getTimeStampBuffer() 1229 public Buffer getTimeStampBuffer()
1227 { 1230 {
1228 if (_timeStampBuffer == null && _timeStamp > 0) 1231 if (_timeStampBuffer == null && _timeStamp > 0)
1229 _timeStampBuffer = HttpFields.__dateCache.formatBuffer(_timeStamp); 1232 _timeStampBuffer = formatBuffer(_timeStamp);
1230 return _timeStampBuffer; 1233 return _timeStampBuffer;
1231 } 1234 }
1232 1235
1233 /* ------------------------------------------------------------ */ 1236 /* ------------------------------------------------------------ */
1234 /** 1237 /**
1979 } 1982 }
1980 1983
1981 setParameters(parameters); 1984 setParameters(parameters);
1982 setQueryString(query); 1985 setQueryString(query);
1983 } 1986 }
1987
1988
1989 private static Buffer _buffer;
1990 private static String _last;
1991 private static final DateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
1992 static {
1993 dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
1994 }
1995
1996 private static Buffer formatBuffer(long date) {
1997 synchronized(dateFormat) {
1998 String d = dateFormat.format(date);
1999 if (d==_last)
2000 return _buffer;
2001 _last=d;
2002 _buffer=new ByteArrayBuffer(d);
2003 return _buffer;
2004 }
2005 }
2006
1984 } 2007 }