users@jersey.java.net

[Jersey] Re: Provider for Joda's DateTime?

From: Marc CARRÉ <carre.marc_at_gmail.com>
Date: Thu, 22 Nov 2012 08:16:45 +0000

Hi Gili,

I replied to your post on StackOverflow, but I will post here too to
centralize the information.
I would be interested in doing like Jeremy, and I use Jersey with Guice,
but I face a few issues at the moment.
Could you please:

   - add the import statements used for your implementation?
   - add an example of how you bind everything with Guice?

Thank you very much in advance.

M.

2012/11/22 cowwoc <cowwoc_at_bbs.darktech.org>

>
> I must have been out of my mind when I posted this. It's wrong :)
>
> I thought you were talking about request entities, not QueryParam. See
> http://stackoverflow.com/a/13500584/14731 for an updated answer.
>
> Gili
>
>
> On 21/11/2012 2:25 PM, cowwoc wrote:
>
>
> I posted a reply on Stackoverflow. In short: you don't need to inject
> DateTime. Just use it as a normal method parameter and it'll work.
>
> Gili
>
> On 21/11/2012 2:17 PM, Jeremy Johnson wrote:
>
> Ah, thanks, Gili. ****
>
> ** **
>
> Looks like I left out the link to my question on Stack Overflow:****
>
>
> http://stackoverflow.com/questions/13482909/using-joda-datetime-as-a-jersey-parameter
> ****
>
> ** **
>
> The code in your link provides Jackson support for Joda, but doesn’t
> provide for injection of Joda DataTime objects as Jersey query params,
> unless I’m missing something.****
>
> ** **
>
> Thanks!****
>
> Jeremy****
>
> ** **
>
> *From:* cowwoc [mailto:cowwoc_at_bbs.darktech.org <cowwoc_at_bbs.darktech.org>]
> *Sent:* Tuesday, November 20, 2012 6:34 PM
> *To:* users_at_jersey.java.net
> *Subject:* [Jersey] Re: Provider for Joda's DateTime?****
>
> ** **
>
> On 20/11/2012 5:43 PM, Jeremy Johnson wrote:****
>
> I’d like to accept Joda’s DateTime objects as query parameters and
> understand that some flavor of injectable provider is needed. ****
>
> ****
>
> Joda’s DateTime is so ubiquitous, I was surprised to not find an
> implementation already out there beyond a couple of partial implementations
> on this list.****
>
> ****
>
> Does anyone have a working, reliable implementation they’d care to share?
> I also posted this to Stack Overflow, if you’d like to duplicate your
> response there as well for cred.****
>
> ****
>
> Thanks,****
>
> Jeremy****
>
>
> It depends what resource representation format you're using. If you're
> using JSON with the Jackson library this will work:
> https://github.com/FasterXML/jackson-datatype-joda
>
> PS: Where is the Stackoverflow question? :)
>
> Gili****
>
>
>
>