You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "KARR, DAVID" <dk...@att.com> on 2017/01/19 22:02:57 UTC
Confusing timezone marshalling results from CXF
I really have no idea whether this is a problem with CXF, but it was the last element in the chain, where before it the data seemed to be sane.
I have a CXF/Spring app running in Tomcat (TomEE). In the controller method I print a date value and the default timezone to stdout. I also store the date value and tzoffset in an object that I serialize in the return through JAX-RS. Running on my desktop, it looks fine. It shows a time in PST (my local timezone) and the correct tzoffset for that timezone.
I then run that same app in TomEE running in a Docker container on another box.
I first noticed that the container was running in UTC, so I mounted /etc/timezone from the host, and now the container is properly in PST.
In the controller method, just before emitting my object, I print "new Date()" and the timezone offset. Running on that container that appears to think it's in PST, it prints a time value in UTC, with a UTC tzoffset. Even that would be fine, as I'm sending the tzoffset back in the response, so the front-end can shift it. However, what I see in the marshalled response is something brain-damaged, like this:
"@maxStartTime":"2017-01-19T13:59:55.611Z","@tzOffset":0
This is rendered at 13:59PM PST. Note that the "Z" means UTC, along with the "0" value for tzOffset.
What might I be doing wrong?
RE: Confusing timezone marshalling results from CXF
Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: KARR, DAVID
> Sent: Thursday, January 19, 2017 2:03 PM
> To: cxf-users@apache.org
> Subject: Confusing timezone marshalling results from CXF
>
> I really have no idea whether this is a problem with CXF, but it was the
> last element in the chain, where before it the data seemed to be sane.
>
> I have a CXF/Spring app running in Tomcat (TomEE). In the controller
> method I print a date value and the default timezone to stdout. I also
> store the date value and tzoffset in an object that I serialize in the
> return through JAX-RS. Running on my desktop, it looks fine. It shows
> a time in PST (my local timezone) and the correct tzoffset for that
> timezone.
>
> I then run that same app in TomEE running in a Docker container on
> another box.
>
> I first noticed that the container was running in UTC, so I mounted
> /etc/timezone from the host, and now the container is properly in PST.
>
> In the controller method, just before emitting my object, I print "new
> Date()" and the timezone offset. Running on that container that appears
> to think it's in PST, it prints a time value in UTC, with a UTC
> tzoffset. Even that would be fine, as I'm sending the tzoffset back in
> the response, so the front-end can shift it. However, what I see in the
> marshalled response is something brain-damaged, like this:
>
> "@maxStartTime":"2017-01-19T13:59:55.611Z","@tzOffset":0
>
> This is rendered at 13:59PM PST. Note that the "Z" means UTC, along
> with the "0" value for tzOffset.
>
> What might I be doing wrong?
Never mind. Getting the timezone set fully and correctly in a container is not an obvious process.