users@jsr311.java.net

Re: Creating date and time formats

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Sun, 27 Jul 2008 18:29:41 +0200

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);

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109