You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by "Romain Manni-Bucau (JIRA)" <ji...@apache.org> on 2016/07/02 19:24:11 UTC
[jira] [Resolved] (JOHNZON-88) Johnzon does not process Johnzon
annotations when hydrating models using javax.ws.rs.client.Client
[ https://issues.apache.org/jira/browse/JOHNZON-88?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Romain Manni-Bucau resolved JOHNZON-88.
---------------------------------------
Resolution: Fixed
Assignee: Romain Manni-Bucau
Fix Version/s: 0.9.4
Side effects were very limited so implemented https://issues.apache.org/jira/browse/JOHNZON-89, closing since I think it solves this issue.
Johnzon doc mentions the access mode but if you think it is not clear enough feel free to do a PR to enhance the doc in src/site.
Thanks for the report! Like the outcome :)
> Johnzon does not process Johnzon annotations when hydrating models using javax.ws.rs.client.Client
> --------------------------------------------------------------------------------------------------
>
> Key: JOHNZON-88
> URL: https://issues.apache.org/jira/browse/JOHNZON-88
> Project: Johnzon
> Issue Type: Improvement
> Components: JAX-RS
> Affects Versions: 0.9.3-incubating
> Environment: Server version: Apache Tomcat (TomEE)/8.5.2 (7.0.0)
> Server built: May 11 2016 21:49:07 UTC
> Server number: 8.5.2.0
> OS Name: Windows 10
> OS Version: 10.0
> Architecture: amd64
> Java Home: C:\Program Files\Java\home\jre
> JVM Version: 1.8.0_73-b02
> JVM Vendor: Oracle Corporation
> Reporter: Jerome Doby
> Assignee: Romain Manni-Bucau
> Priority: Minor
> Fix For: 0.9.4
>
>
> 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:
> {code:title=Search.java|borderStyle=solid}
> 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;
> }
> }
> {code}
> {code:title=Bootstrap.java|borderStyle=solid}
> 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 );
> }
> }
> {code}
> {code:title=Response.json|borderStyle=solid}
> {
> "page": 1,
> "total_pages": 114
> }
> {code}
> 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?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)