You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Tom Beerbower <tb...@hortonworks.com> on 2014/06/05 15:42:54 UTC

Review Request 22262: Views: View managed resources need @Produces({"text/plain"}) to generate JSON

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22262/
-----------------------------------------------------------

Review request for Ambari, John Speidel and Nate Cole.


Bugs: AMBARI-6028
    https://issues.apache.org/jira/browse/AMBARI-6028


Repository: ambari


Description
-------

For managed resource GET calls I wanted JSON response. 
{code}
{
 "a": "b"
}
{code}

Keeping {code}@Produces({"application/json"}){code}  on the @GET method gives a string-serialized output of the JSON
{code}
"{\"a\":\"b\"}"
{code}

However when I keep {code}@Produces({"text/plain", "application/json"}){code} correctly produces JSON.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java 8953796 
  ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java 135cd78 
  ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewSubResourceServiceTest.java 2b2c269 
  ambari-views/examples/weather-view/src/main/java/org/apache/ambari/view/weather/CityService.java 0c7f0c5 
  ambari-views/src/main/java/org/apache/ambari/view/ViewResourceHandler.java 2d42454 

Diff: https://reviews.apache.org/r/22262/diff/


Testing
-------

Manual test with ambari-views/examples.  Added new unit tests.  All existing tests pass ...

Results :

Tests run: 1654, Failures: 0, Errors: 0, Skipped: 13
…


[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22:37.650s
[INFO] Finished at: Thu Jun 05 09:33:20 EDT 2014
[INFO] Final Memory: 37M/123M
[INFO] ------------------------------------------------------------------------


Thanks,

Tom Beerbower


Re: Review Request 22262: Views: View managed resources need @Produces({"text/plain"}) to generate JSON

Posted by John Speidel <js...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22262/#review44853
-----------------------------------------------------------

Ship it!


Ship It!

- John Speidel


On June 5, 2014, 1:42 p.m., Tom Beerbower wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/22262/
> -----------------------------------------------------------
> 
> (Updated June 5, 2014, 1:42 p.m.)
> 
> 
> Review request for Ambari, John Speidel and Nate Cole.
> 
> 
> Bugs: AMBARI-6028
>     https://issues.apache.org/jira/browse/AMBARI-6028
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> For managed resource GET calls I wanted JSON response. 
> {code}
> {
>  "a": "b"
> }
> {code}
> 
> Keeping {code}@Produces({"application/json"}){code}  on the @GET method gives a string-serialized output of the JSON
> {code}
> "{\"a\":\"b\"}"
> {code}
> 
> However when I keep {code}@Produces({"text/plain", "application/json"}){code} correctly produces JSON.
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java 8953796 
>   ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java 135cd78 
>   ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewSubResourceServiceTest.java 2b2c269 
>   ambari-views/examples/weather-view/src/main/java/org/apache/ambari/view/weather/CityService.java 0c7f0c5 
>   ambari-views/src/main/java/org/apache/ambari/view/ViewResourceHandler.java 2d42454 
> 
> Diff: https://reviews.apache.org/r/22262/diff/
> 
> 
> Testing
> -------
> 
> Manual test with ambari-views/examples.  Added new unit tests.  All existing tests pass ...
> 
> Results :
> 
> Tests run: 1654, Failures: 0, Errors: 0, Skipped: 13
> …
> 
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 22:37.650s
> [INFO] Finished at: Thu Jun 05 09:33:20 EDT 2014
> [INFO] Final Memory: 37M/123M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Tom Beerbower
> 
>