Shouldn't the root "record" be included with a JSON response?
@XmlRootElement(name="record")
public class ReturnedClass {
private String term;
private Date time;
@XmlElement(name="searchTerm")
public String getTerm() { return term; }
@XmlTransient
public Date getTime() { return time; }
@XmlElement(name="searchTime")
public long getTimeInMilliseconds() { return time.getTime();}
}
*Result:*
{
"searchTerm":"myTerm",
"searchTime":"987654321"
}
*Expected:*
{
"record" : {
"searchTerm":"myTerm",
"searchTime":"987654321"
}
}
*This is the resource method:*
@GET
@Path("/myPath/{searchTerm}/{searchTime}")
@Produces("application/json")
public ReturnedClass getResult(@PathParam("searchTerm") String term,
@PathParam("searchTime") long
milliseconds) {
ReturnedClass rc = new ReturnedClass();
rc.setTerm(term);
rc.setTime(new Date(milliseconds));
return rc;
}