Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.9.3-incubating
-
None
Description
According to the documentation at http://johnzon.apache.org/index.html, Johnzon is the default provider on TomEE 7.X, but it does not seem to process any Johnzon annotations when hydrating JSON responses using the default javax.ws.rs.client.Client implementation.
Example:
Search.java
package mypackage.models; import org.apache.johnzon.mapper.JohnzonProperty; public class Search { private Integer page; @JohnzonProperty( "total_pages" ) private Integer totalPages; public Integer getPage() { return page; } public void setPage( Integer page ) { this.page = page; } public Integer getTotalPages() { return totalPages; } public void setTotalPages( Integer totalPages ) { this.totalPages = totalPages; } }
Bootstrap.java
package mypackage; import mypackage.models.Search; import javax.annotation.PostConstruct; import javax.ejb.Singleton; import javax.ejb.Startup; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; @Singleton @Startup public class Bootstrap { private Client client; @PostConstruct private void postConstruct() { client = ClientBuilder.newClient(); Search search = client.target( "http://someurl.json" ) .request() .get( Search.class ); } }
Response.json
{ "page": 1, "total_pages": 114 }
In this case, the field totalPages is null, but I would expect it to be 114. Is there something that I need to do to activate this behaviour? If so, can you add this information to the documentation?
Attachments
Issue Links
- duplicates
-
JOHNZON-89 switch default access mode to method and field
- Closed