users@jersey.java.net

Re: [Jersey] Bug in Jersey's header parser?

From: Gili <cowwoc_at_bbs.darktech.org>
Date: Sun, 2 Nov 2008 10:46:11 -0800 (PST)

Paul Sandoz wrote:
>
> Jersey will format date objects according to RFC 1123 (US locale) which
> is the recommended format for HTTP dates. Annoyingly:
>
> new GregorianCalendar(2003, Calendar.FEBRUARY, 1).getTime()
>
> returns a header of:
>
> Last-Modified Fri, 31 Jan 2003 23:00:00 GMT
>
> i.e. one day behind what is declared. I think it is a rounding error
> when formatting.
>

Paul,

Can you please clarify this? How did you end up with January 31st 2003? When
I run:

System.out.println(new GregorianCalendar(2003, Calendar.FEBRUARY,
1).getTime().toString());

I get February 1st, 2003. Are you saying there is a bug in Jersey's Date ->
String conversion algorithms? Also, is there a JAX-RS or Jersey equivalent
to RestEasy's DateUtil class?

http://www.jboss.org/file-access/default/members/resteasy/freezone/docs/1.0-beta-6/javadocs/resteasy-jaxrs/org/jboss/resteasy/util/DateUtil.html

I want to embed dates inside some XML body and it probably makes sense to
use the same format throughout. It's not clear how to easily transform a
Date to the RFC1123 format.

Gili
-- 
View this message in context: http://n2.nabble.com/Re%3A-Bug-in-Jersey%27s-header-parser--tp581274p1446307.html
Sent from the Jersey mailing list archive at Nabble.com.