brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geom...@apache.org
Subject [1/4] brooklyn-server git commit: Fix REST API response of methods with String return type
Date Mon, 10 Jul 2017 13:11:50 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 463910fdf -> 9caf201d1


Fix REST API response of methods with String return type


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/299c2ab8
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/299c2ab8
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/299c2ab8

Branch: refs/heads/master
Commit: 299c2ab8f36439212cbd09cf58f67a4d74f13df9
Parents: 3d8675e
Author: Ivana Yovcheva <ivana.yovcheva@gmail.com>
Authored: Tue Jul 4 17:41:48 2017 +0300
Committer: Ivana Yovcheva <ivana.yovcheva@gmail.com>
Committed: Tue Jul 4 18:02:45 2017 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java  | 1 +
 .../org/apache/brooklyn/rest/resources/PolicyConfigResource.java | 2 +-
 .../java/org/apache/brooklyn/rest/resources/ServerResource.java  | 4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/299c2ab8/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java
----------------------------------------------------------------------
diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java
index 45cd25c..8a2261d 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java
@@ -75,6 +75,7 @@ public interface ActivityApi {
     @ApiResponses(value = {
             @ApiResponse(code = 404, message = "Could not find task or stream")
     })
+    @Produces(MediaType.TEXT_PLAIN)
     public String stream(
             @ApiParam(value = "Task ID", required = true) @PathParam("task") String taskId,
             @ApiParam(value = "Stream ID", required = true) @PathParam("streamId") String
streamId);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/299c2ab8/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/PolicyConfigResource.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/PolicyConfigResource.java
b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/PolicyConfigResource.java
index 6dcdf19..2f6e60d 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/PolicyConfigResource.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/PolicyConfigResource.java
@@ -77,7 +77,7 @@ public class PolicyConfigResource extends AbstractBrooklynRestResource implement
         ConfigKey<?> ck = policy.getPolicyType().getConfigKey(configKeyName);
         if (ck == null) throw WebResourceUtils.notFound("Cannot find config key '%s' in policy
'%s' of entity '%s'", configKeyName, policy, entityToken);
 
-        return getStringValueForDisplay(brooklyn(), policy, policy.getConfig(ck));
+        return (String) WebResourceUtils.getValueForDisplay(mapper(), getStringValueForDisplay(brooklyn(),
policy, policy.getConfig(ck)), true, true);
     }
 
     @SuppressWarnings({ "unchecked", "rawtypes" })

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/299c2ab8/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java
b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java
index 2a6dcbd..20a371a 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java
@@ -383,7 +383,7 @@ public class ServerResource extends AbstractBrooklynRestResource implements
Serv
             throw WebResourceUtils.forbidden("User '%s' is not authorized for this operation",
Entitlements.getEntitlementContext().user());
         }
         ConfigKey<String> config = ConfigKeys.newStringConfigKey(configKey);
-        return mgmt().getConfig().getConfig(config);
+        return (String) WebResourceUtils.getValueForDisplay(mapper(), mgmt().getConfig().getConfig(config),
true, true);
     }
 
     @Override
@@ -446,7 +446,7 @@ public class ServerResource extends AbstractBrooklynRestResource implements
Serv
         request.getSession();
         EntitlementContext entitlementContext = Entitlements.getEntitlementContext();
         if (entitlementContext!=null && entitlementContext.user()!=null){
-            return entitlementContext.user();
+            return (String) WebResourceUtils.getValueForDisplay(mapper(), entitlementContext.user(),
true, true);
         } else {
             return null; //User can be null if no authentication was requested
         }


Mime
View raw message