protected String getHeaderValueAsString(Object headerValue) { if (headerValue == null) return null; if (headerValue instanceof Date) { // return date strings (ie Last-Modified) in HTTP format, rather // than Java format return FastHttpDateFormat.formatDate(((Date) headerValue).getTime(), null); } return headerValue.toString(); }
/** * Add the specified date header to the specified value. * * @param name Name of the header to set * @param value Date value to be set */ @Override public void addDateHeader(String name, long value) { if (name == null || name.length() == 0) { return; } if (isCommitted()) { return; } // Ignore any call from an included servlet if (included) { return; } if (format == null) { format = new SimpleDateFormat(FastHttpDateFormat.RFC1123_DATE, Locale.US); format.setTimeZone(TimeZone.getTimeZone("GMT")); } addHeader(name, FastHttpDateFormat.formatDate(value, format)); }