users@jersey.java.net

Re: date parameter?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 25 Feb 2008 12:41:07 +0100

Hi Gabor,

My preference for a date used as part of search information in a URI
would be to choose something human friendly and intuitive and maybe
using java.util.Date or even better the Joda Time classes to validate.

Using UNIX time seems a little opaque for something clients are likely
to want to produce.

Unfortunately at the moment our management of Java types for parameters
is a little limited making it tricky to directly use the DateTime
classes with Date formatters. We need to look more into this.

So i would recommend using a String type and pass this to the date
formatter you need to use. Or create your own type that has a
constructor with a String parameter and encapsulates the date formatter
and validation.

Paul.

Gabor Szokoli wrote:
> Hi there,
>
> Another FAQ candidate:
>
> How do you guys normally pass date parameters in the URL? Some string
> representation, or UNIX time as integer, or something else?
>
> I'm trying to come up with my first RESTful web service for querying a
> database, and dates are common as search parameters.
>
>
> Thanks in advance:
>
> Gabor Szokoli
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

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