/** * Format HTTP date "EEE, dd MMM yyyy HH:mm:ss 'GMT'" or "EEE, dd-MMM-yy HH:mm:ss 'GMT'"for * cookies */ public static String formatDate(Calendar calendar, boolean cookie) { StringBuffer buf = new StringBuffer(32); formatDate(buf, calendar, cookie); return buf.toString(); }
/** * Format HTTP date "EEE, dd MMM yyyy HH:mm:ss 'GMT'" or "EEE, dd-MMM-yy HH:mm:ss 'GMT'"for * cookies */ public static String formatDate(StringBuffer buf, long date, boolean cookie) { GregorianCalendar gc = new GregorianCalendar(__GMT); gc.setTimeInMillis(date); formatDate(buf, gc, cookie); return buf.toString(); }
/** * Format HTTP date "EEE, dd MMM yyyy HH:mm:ss 'GMT'" or "EEE, dd-MMM-yy HH:mm:ss 'GMT'"for * cookies */ public static String formatDate(long date, boolean cookie) { StringBuffer buf = new StringBuffer(32); GregorianCalendar gc = new GregorianCalendar(__GMT); gc.setTimeInMillis(date); formatDate(buf, gc, cookie); return buf.toString(); }
/** * Sets the value of a date field. * * @param name the field name * @param date the field date value */ public void putDateField(Buffer name, long date) { if (_dateBuffer == null) { _dateBuffer = new StringBuffer(32); _calendar = new GregorianCalendar(__GMT); } _dateBuffer.setLength(0); _calendar.setTimeInMillis(date); formatDate(_dateBuffer, _calendar, false); Buffer v = new ByteArrayBuffer(_dateBuffer.toString()); put(name, v, date); }
void cache(String pathInContext) { _key=pathInContext; _next=_mostRecentlyUsed; _mostRecentlyUsed=this; if (_next!=null) _next._prev=this; _prev=null; if (_leastRecentlyUsed==null) _leastRecentlyUsed=this; _cache.put(_key,this); _cachedSize+=_buffer.length(); _cachedFiles++; if (_lastModified!=-1) _lastModifiedBytes=new ByteArrayBuffer(HttpFields.formatDate(_lastModified,false)); }
/** * Sets the value of a date field. * * @param name the field name * @param date the field date value */ public void addDateField(String name, long date) { if (_dateBuffer == null) { _dateBuffer = new StringBuffer(32); _calendar = new GregorianCalendar(__GMT); } _dateBuffer.setLength(0); _calendar.setTimeInMillis(date); formatDate(_dateBuffer, _calendar, false); Buffer n = HttpHeaders.CACHE.lookup(name); Buffer v = new ByteArrayBuffer(_dateBuffer.toString()); add(n, v, date); }
buf.append(__01Jan1970); else formatDate(buf, System.currentTimeMillis() + 1000L * maxAge, true);