I ended up posting this on stackover flow for advice, and I got back a
really complete answer:
http://stackoverflow.com/questions/19229341/changing-default-json-time-format-with-resteasy-3-x
.

The only issue is that I think there is a bug in RESTEasy 3.x that prevents
this from working, seeing that it works perfectly in RESTEasy 2.3.5.  I
filed a bug with JBoss to track this issue.


On Mon, Oct 7, 2013 at 8:59 PM, 刘日新 <liuri...@linxun.com> wrote:

>  Why not add an extra field which hold  value of timezone?****
>
> ** **
>
> *发件人:* Ian Anderson [mailto:insanes...@gmail.com]
> *发送时间:* 2013年10月8日 2:42
> *收件人:* resteasy-users@lists.sourceforge.net
> *主题:* [Resteasy-users] Changing Default JSON Time Format with RESTEasy 3.x
> ****
>
> ** **
>
> I am using RESTEasy to implement a REST Service using JSON serialization.
> Currently, Dates are getting serialized to milliseconds since 1970.  To
> improve compatibility, I would like to get my dates into one of two
> formats; milliseconds + timezone offset or ISO 8061.****
>
> It seems that RESTEasy used to use Jettison for JSON serialization, but
> from what I've been reading they've switch to Jackson ... all of this has
> made googling for help pretty hit or miss.****
>
> From what I can tell, I need to implement a ContextResolver<ObjectMapper>
> along the lines of:****
>
>         public class JacksonConfig impelments ContextResolver<ObjectMapper>
>         {
>             private final OBjectMapper objectMapper;****
>
>             public JacksonConfig() throws Exception
>             {
>                 objectMapper = new ObjectMapper.configure(
>
> SerializationFeature.WRITE_DATE_AS_TIMESTAMPS, false);
>             }****
>
>             @Override
>             public ObjectMapper getContext(Class<?> arg0)
>             {
>                 return objectMapper;
>             }
>          }****
>
> The thing I haven't been able to find, is what do I do with this?  Where
> do I put it?****
>
> So the larger questions are, am I heading in the right direction and are
> my assumptions correct?
> ****
>
> Thanks!****
>
>
> --
> Ian****
>



-- 
Ian T. W. Anderson
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to