On Aug 1, 2008, at 5:10 AM, Paul Sandoz wrote:
> Marc Hadley wrote:
>> On Jul 27, 2008, at 12:29 PM, Paul Sandoz wrote:
>>> Markus KARG wrote:
>>>> The HTTP/1.1 specification uses special formatting for date and
>>>> time values, e. g. in the Expires-header. It would be great if
>>>> the response builder API would provide an easy means to create
>>>> that format, unless there is an .expires(Date) method (currently
>>>> there is not and resource authors must use SimpleDateFormat
>>>> and .header("Expires", String) to send it).
>>>>
>>>
>>> The parameter signature of "header" is:
>>>
>>> header(String, Object)
>>>
>>> So you can pass a Date object for the header value and you can use
>>> a constant String value for the header name:
>>>
>>> Date d = ...
>>> responseBuilder.header(HttpHeaders.Expires, d);
>>>
>> The header method says that it will use the toString method to
>> obtain a value for the header so I don't think this will work
>> unless we special case the Date class.
>
> Ah, i implemented it using the HeaderDelegate so it would be
> consistent if using the particular methods or the general method.
>
> How about this:
>
> If there is a HeaderDelegate present for the class of the object use
> that otherwise call the toString method.
>
> ?
>
Yes, I made that change and required impls to provide a header
delegate for Date.
>
>> Adding an expires method might be cleaner.
>>
>
> Agreed, if it is a common case.
>
I did this too.
Marc.
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.