Hello,

   Let me clarify the issue I have. I would like to be able to customize
the way the JSON plugin formats the date when converting an objecto to
json. Specifically, when I'm returning a JSONResult to a client. In order
to do that I need to modify the DateFormatter used by JSONWriter so I can
change its timezone. I took a look at the code, and it seems that make that
modification is going to be hard. It would be something like this:

  Extend JSONWriter to be able to use timezone with a Date(Maybe receiving
the timezone as a parameter, or using annotation at the field level)
  Extend JSONUtil to call my custom JSONWriter.
  Extend JSONResult to call my customer JSONUtil, by overriding the method
createJSONString. This would pretty much imply copy the whole code, as the
method has a bunch of dependences from private variables when calling
JSONUtil.

Can anyone suggest a better approach?

JL

2015-11-03 14:13 GMT-05:00 JOSE L MARTINEZ-AVIAL <jlm...@gmail.com>:

> Hello,
>    I'm using Struts 2.3.16.3. I use the json plugin to return information
> to the client (browser and ios App). The problem I have is that the
> dates/times are local to my server, and since I have the option to know the
> client's timezone, I would like to return the date to the client converted
> to his local time. In order to do that I need to set the timezone of the
> DateFormatter used by the json plugin. I don't see any issue way to do
> that, apart from extending JSONWriter. Is that something possible? how I
> would indicate the plugin to use my own version of JSONWriter?
>
> Thanks
>
> JL
>

Reply via email to