Another possible workaround may be to use jaxb annotations like
@XmlElement(name = "uptime_hours").

On Thu, Sep 25, 2014 at 5:24 AM, Steve Loughran <[email protected]>
wrote:

> For anyone playing with REST resources in slider, know that the version of
> Jersey we are using appears to ignore all @JsonProperty annotations
>
> https://java.net/jira/browse/JERSEY-989
>
> I found this as the registry entries were adding special "yarn:id" and
> "yarn:persistence" attributes mapped to the fields "id" and "persistence"
> ... they weren't making it into the destination service class because they
> were being published with the field, names, not the declared property
> names.
>
> workaround: give the fields names like "yarn_id" and "yarn_persistence"
>
>
> Scanning the code, the only JSON-marshalled classes that declare their json
> property fields are the Agent ones ... most of which match their field
> names completely.
>
> some are case-different, e.g in
> org.apache.slider.server.appmaster.web.rest.agent.HostInfo:
>
>
>   @JsonProperty("uptime_hours")
>   public long getUptimeHours() {
>     return this.uptime_hours;
>   }
>
>   @JsonProperty("uptime_hours")
>   public void setUpTimeHours(long uptime_hours) {
>     this.uptime_hours = uptime_hours;
>   }
>
>   @JsonProperty("uptime_days")
>   public long getUpTimeDays() {
>     return this.uptime_days;
>   }
>
>   @JsonProperty("uptime_days")
>   public void setUpTimeDays(long
>
> This may work for the agent POSTing data to the AM, as it is not Jersey
> itself publishing it —but if the AM did ever try to serve the same data up
> on its REST endpoints, *the fields would not be marshalled correctly*.
>
> I've created SLIDER-454 to handle the agent code, but everyone needs to be
> aware of it and to not try to use different names for properties than the
> java fields.
>
> -Steve
>
>
>
>
> -steve
>
> --
> CONFIDENTIALITY NOTICE
> NOTICE: This message is intended for the use of the individual or entity to
> which it is addressed and may contain information that is confidential,
> privileged and exempt from disclosure under applicable law. If the reader
> of this message is not the intended recipient, you are hereby notified that
> any printing, copying, dissemination, distribution, disclosure or
> forwarding of this communication is strictly prohibited. If you have
> received this communication in error, please contact the sender immediately
> and delete it from your system. Thank You.
>

Reply via email to