On 20.03.2015 19:33, Sonam Samdupkhangsar wrote:
> I have a jaxrs service that returns a JPA entity called Person with a "dob" 
> property of type java.util.Date.  On the service side, the date is
> dob=2015-03-20
>
> However, on the client side, it comes across as
> dob=Thu Mar 19 18:00:00 MDT 2015
>
>
> The following is my jaxrs client config with service call:
>
> @Autowired
>        private JacksonJsonProvider provider;
>
> @Test
>        public void manaulFindOrderById() {
>               logger.info("testing for manual person retrieval via jaxrs 
> client");
>               Long personId = 6011L;
>               List<Object> providers = new ArrayList<Object>();
>               providers.add(new JacksonJsonProvider());
>               logger.debug("creating jaxrs client");
>               MyWebService myWebService = JAXRSClientFactory.create(
>                            ENDPOINT_ADDRESS, MyWebService.class, providers);
>
>               Person person = myWebService.getPersonById(personId);
>               logger.info("found person {}", person);
>        }
>
>
> Don't know if it's something to with the JacksonJsonProvider.
>

How do you format those dates in JSON?

I have stuff like this in the service:

    @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="dd.MM.yyyy")
    @JsonProperty(value = "startDate", required = true)
    private Date startDate;

Do the server & client use same format?

-- 
jarif.bit


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to