You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by pr...@apache.org on 2016/02/25 01:56:00 UTC

incubator-apex-core git commit: APEXCORE-350 clear content-type header for each request, otherwise there will be two conflicting content-type headers for each response

Repository: incubator-apex-core
Updated Branches:
  refs/heads/release-3.2 fd2a7e821 -> b2838e47e


APEXCORE-350 clear content-type header for each request, otherwise there will be two conflicting content-type headers for each response

Conflicts:
	engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java

Conflicts:
	engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java

Conflicts:
	engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java


Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/commit/b2838e47
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/tree/b2838e47
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/diff/b2838e47

Branch: refs/heads/release-3.2
Commit: b2838e47e72bdcb84ee49e7f58687a737394c76b
Parents: fd2a7e8
Author: David Yan <da...@datatorrent.com>
Authored: Fri Feb 19 09:58:44 2016 -0800
Committer: David Yan <da...@datatorrent.com>
Committed: Wed Feb 24 14:45:17 2016 -0800

----------------------------------------------------------------------
 .../stram/webapp/StramWebServices.java          | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/b2838e47/engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java b/engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java
index de085cd..ee1bc78 100644
--- a/engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java
+++ b/engine/src/main/java/com/datatorrent/stram/webapp/StramWebServices.java
@@ -198,6 +198,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getPhysicalPlan() throws Exception
   {
+    init();
     Map<String, Object> result = new HashMap<String, Object>();
     result.put("operators", dagManager.getOperatorInfoList());
     result.put("streams", dagManager.getStreamInfoList());
@@ -278,6 +279,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getOperatorClasses(@QueryParam("q") String searchTerm, @QueryParam("parent") String parent)
   {
+    init();
     JSONObject result = new JSONObject();
     JSONArray classNames = new JSONArray();
 
@@ -315,6 +317,7 @@ public class StramWebServices
   @SuppressWarnings("unchecked")
   public JSONObject describeOperator(@PathParam("className") String className)
   {
+    init();
     if (className == null) {
       throw new UnsupportedOperationException();
     }
@@ -337,6 +340,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject shutdown()
   {
+    init();
     LOG.debug("Shutdown requested");
     dagManager.shutdownAllContainers("Shutdown requested externally.");
     return new JSONObject();
@@ -358,6 +362,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject startRecording(@PathParam("opId") int opId, String content) throws JSONException
   {
+    init();
     LOG.debug("Start recording on {} requested", opId);
     JSONObject response = new JSONObject();
     long numWindows = 0;
@@ -376,6 +381,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject startRecording(@PathParam("opId") int opId, @PathParam("portName") String portName, String content) throws JSONException
   {
+    init();
     LOG.debug("Start recording on {}.{} requested", opId, portName);
     JSONObject response = new JSONObject();
     long numWindows = 0;
@@ -394,6 +400,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject stopRecording(@PathParam("opId") int opId)
   {
+    init();
     LOG.debug("Start recording on {} requested", opId);
     JSONObject response = new JSONObject();
     dagManager.stopRecording(opId, null);
@@ -405,6 +412,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject stopRecording(@PathParam("opId") int opId, @PathParam("portName") String portName)
   {
+    init();
     LOG.debug("Stop recording on {}.{} requested", opId, portName);
     JSONObject response = new JSONObject();
     dagManager.stopRecording(opId, portName);
@@ -477,6 +485,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject killContainer(@PathParam("containerId") String containerId)
   {
+    init();
     JSONObject response = new JSONObject();
     if (containerId.equals(System.getenv(ApplicationConstants.Environment.CONTAINER_ID.toString()))) {
       LOG.info("Received a kill request on application master container. Exiting.");
@@ -507,6 +516,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getLogicalOperators() throws Exception
   {
+    init();
     LogicalOperatorsInfo nodeList = new LogicalOperatorsInfo();
     nodeList.operators = dagManager.getLogicalOperatorInfoList();
     return new JSONObject(objectMapper.writeValueAsString(nodeList));
@@ -517,6 +527,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getLogicalOperator(@PathParam("operatorName") String operatorName) throws Exception
   {
+    init();
     OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
     if (logicalOperator == null) {
       throw new NotFoundException();
@@ -531,6 +542,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getOperatorAggregation(@PathParam("operatorName") String operatorName) throws Exception
   {
+    init();
     OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
     if (logicalOperator == null) {
       throw new NotFoundException();
@@ -600,6 +612,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getOperatorAttributes(@PathParam("operatorName") String operatorName, @QueryParam("attributeName") String attributeName)
   {
+    init();
     OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
     if (logicalOperator == null) {
       throw new NotFoundException();
@@ -618,6 +631,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getApplicationAttributes(@QueryParam("attributeName") String attributeName)
   {
+    init();
     HashMap<String, Object> map = new HashMap<String, Object>();
     for (Entry<Attribute<?>, Object> entry : dagManager.getApplicationAttributes().entrySet()) {
       if (attributeName == null || entry.getKey().name.equals(attributeName)) {
@@ -632,6 +646,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getPorts(@PathParam("operatorName") String operatorName)
   {
+    init();
     OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
     if (logicalOperator == null) {
       throw new NotFoundException();
@@ -664,6 +679,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getPort(@PathParam("operatorName") String operatorName, @PathParam("portName") String portName)
   {
+    init();
     OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
     if (logicalOperator == null) {
       throw new NotFoundException();
@@ -697,6 +713,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getPortAttributes(@PathParam("operatorName") String operatorName, @PathParam("portName") String portName, @QueryParam("attributeName") String attributeName)
   {
+    init();
     OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
     if (logicalOperator == null) {
       throw new NotFoundException();
@@ -743,6 +760,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getPhysicalOperatorProperties(@PathParam("operatorId") int operatorId, @QueryParam("propertyName") String propertyName, @QueryParam("waitTime") long waitTime)
   {
+    init();
     if (waitTime == 0) {
       waitTime = WAIT_TIME;
     }
@@ -767,6 +785,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject getLogicalPlan() throws JSONException, IOException
   {
+    init();
     LogicalPlan lp = dagManager.getLogicalPlan();
     return new JSONObject(objectMapper.writeValueAsString(LogicalPlanSerializer.convertToMap(lp)));
   }
@@ -777,6 +796,7 @@ public class StramWebServices
   @Produces(MediaType.APPLICATION_JSON)
   public JSONObject logicalPlanModification(JSONObject request)
   {
+    init();
     JSONObject response = new JSONObject();
     try {
       JSONArray jsonArray = request.getJSONArray("requests");