]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7865 Deprecate XML format of web service responses 1251/head
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 14 Sep 2016 09:51:28 +0000 (11:51 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 15 Sep 2016 13:46:05 +0000 (15:46 +0200)
server/sonar-server/src/main/java/org/sonar/server/component/ws/EventsWs.java
server/sonar-server/src/main/java/org/sonar/server/config/ws/PropertiesWs.java
server/sonar-server/src/main/java/org/sonar/server/user/ws/FavouritesWs.java
server/sonar-server/src/main/java/org/sonar/server/user/ws/UserPropertiesWs.java
sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RailsHandler.java

index c60de5082f0d8249625462c68554cb7d6fd2db23..aa622e704a5531166aa34b5816472d36c06ea8f6 100644 (file)
@@ -36,10 +36,11 @@ public class EventsWs implements WebService {
   }
 
   private void defineIndexAction(NewController controller) {
-    controller.createAction("index")
+    WebService.NewAction action = controller.createAction("index")
       .setDescription("Documentation of this web service is available <a href=\"http://redirect.sonarsource.com/doc/old-web-service-api.html\">here</a>")
       .setResponseExample(getClass().getResource("events-index-example.json"))
       .setSince("2.6")
       .setHandler(RailsHandler.INSTANCE);
+    RailsHandler.addFormatParam(action);
   }
 }
index 3b2a9085b9a5f77e998ecc8abf2d1a1f6abf0df5..3aa3f58d8a0c5e74194fb19eed6273b78a175bed 100644 (file)
@@ -22,6 +22,8 @@ package org.sonar.server.config.ws;
 import org.sonar.api.server.ws.RailsHandler;
 import org.sonar.api.server.ws.WebService;
 
+import static org.sonar.api.server.ws.RailsHandler.addFormatParam;
+
 public class PropertiesWs implements WebService {
 
   @Override
@@ -36,10 +38,11 @@ public class PropertiesWs implements WebService {
   }
 
   private void defineIndexAction(NewController controller) {
-    controller.createAction("index")
+    NewAction action = controller.createAction("index")
       .setDescription("Documentation of this web service is available <a href=\"http://redirect.sonarsource.com/doc/old-web-service-api.html\">here</a>")
       .setResponseExample(getClass().getResource("index-example.xml"))
       .setSince("2.6")
       .setHandler(RailsHandler.INSTANCE);
+    addFormatParam(action);
   }
 }
index 7ec8beccd9002d860e9986262af100bc4fa5b786..543ee6fd39fe8a48522f137ce4f4fee89f4ad726 100644 (file)
@@ -22,6 +22,8 @@ package org.sonar.server.user.ws;
 import org.sonar.api.server.ws.RailsHandler;
 import org.sonar.api.server.ws.WebService;
 
+import static org.sonar.api.server.ws.RailsHandler.addFormatParam;
+
 public class FavouritesWs implements WebService {
 
   @Override
@@ -36,10 +38,11 @@ public class FavouritesWs implements WebService {
   }
 
   private void defineIndexAction(NewController controller) {
-    controller.createAction("index")
+    NewAction action = controller.createAction("index")
       .setDescription("Documentation of this web service is available <a href=\"http://redirect.sonarsource.com/doc/old-web-service-api.html\">here</a>")
       .setResponseExample(getClass().getResource("favourites-index-example.xml"))
       .setSince("2.6")
       .setHandler(RailsHandler.INSTANCE);
+    addFormatParam(action);
   }
 }
index 9736620d95a0f475185a146e0fc9349ddb866180..e4ce7ce692cd03dc4bd37bb4b72f921637209335 100644 (file)
  */
 package org.sonar.server.user.ws;
 
-import org.sonar.api.server.ws.RailsHandler;
 import org.sonar.api.server.ws.WebService;
 
+import static org.sonar.api.server.ws.RailsHandler.INSTANCE;
+import static org.sonar.api.server.ws.RailsHandler.addFormatParam;
+
 public class UserPropertiesWs implements WebService {
 
   @Override
@@ -36,11 +38,12 @@ public class UserPropertiesWs implements WebService {
   }
 
   private void defineIndexAction(NewController controller) {
-    controller.createAction("index")
+    NewAction action = controller.createAction("index")
       .setDescription("Documentation of this web service is available <a href=\"http://redirect.sonarsource.com/doc/old-web-service-api.html\">here</a>")
       .setSince("2.6")
       .setResponseExample(getClass().getResource("user_properties-index-example.xml"))
-      .setHandler(RailsHandler.INSTANCE);
+      .setHandler(INSTANCE);
+    addFormatParam(action);
   }
 
 }
index 40c9f5ad0ba7d49ff191c0203d2ea78b3c22a1b1..3edc0647afa6a473d183b6096b0e76616d1f63e0 100644 (file)
@@ -47,8 +47,10 @@ public class RailsHandler implements RequestHandler {
         "<li>Accept:text/xml</li>" +
         "<li>Accept:application/json</li>" +
         "</ul></li></ul>" +
-        "If nothing is set, json is used")
-      .setPossibleValues("json", "xml");
+        "If nothing is set, json is used.<br/>" +
+        "Since 6.1, XML format is deprecated, only JSON format should be used.")
+      .setPossibleValues("json", "xml")
+      .setDeprecatedSince("6.1");
   }
 
   public static WebService.NewParam addJsonOnlyFormatParam(WebService.NewAction action) {