Package org.sonar.api.server.ws

Examples of org.sonar.api.server.ws.RequestHandler


  private void defineIndexAction(NewController controller) {
    controller.createAction("index")
      .setInternal(true)
      .setDescription("List the JAR files to be downloaded by source analyzer")
      .setHandler(new RequestHandler() {
        @Override
        public void handle(Request request, Response response) {
          try {
            response.stream().setMediaType("text/plain");
            IOUtils.write(batchIndex.getIndex(), response.stream().output());
View Full Code Here


  private void defineFileAction(NewController controller) {
    controller.createAction("file")
      .setInternal(true)
      .setDescription("Download a JAR file required by source analyzer")
      .setHandler(new RequestHandler() {
        @Override
        public void handle(Request request, Response response) {
          String filename = request.mandatoryParam("name");
          try {
            response.stream().setMediaType("application/java-archive");
View Full Code Here

  private void defineActivateAction(WebService.NewController controller) {
    WebService.NewAction activate = controller
      .createAction(ACTIVATE_ACTION)
      .setDescription("Activate a rule on a Quality profile")
      .setHandler(new RequestHandler() {
        @Override
        public void handle(Request request, Response response) throws Exception {
          activate(request, response);
        }
      })
View Full Code Here

  private void defineDeactivateAction(WebService.NewController controller) {
    WebService.NewAction deactivate = controller
      .createAction(DEACTIVATE_ACTION)
      .setDescription("Deactivate a rule on a Quality profile")
      .setHandler(new RequestHandler() {
        @Override
        public void handle(Request request, Response response) throws Exception {
          deactivate(request, response);
        }
      })
View Full Code Here

    WebService.NewAction activate = controller
      .createAction(BULK_ACTIVATE_ACTION)
      .setDescription("Bulk-activate rules on one or several Quality profiles")
      .setPost(true)
      .setSince("4.4")
      .setHandler(new RequestHandler() {
        @Override
        public void handle(Request request, Response response) throws Exception {
          bulkActivate(request, response);
        }
      });
View Full Code Here

    WebService.NewAction deactivate = controller
      .createAction(BULK_DEACTIVATE_ACTION)
      .setDescription("Bulk deactivate rules on Quality profiles")
      .setPost(true)
      .setSince("4.4")
      .setHandler(new RequestHandler() {
        @Override
        public void handle(Request request, Response response) throws Exception {
          bulkDeactivate(request, response);
        }
      });
View Full Code Here

  private void defineList(final Context context, NewController controller) {
    NewAction action = controller
      .createAction("list")
      .setSince("4.2")
      .setDescription("List web services")
      .setHandler(new RequestHandler() {
        @Override
        public void handle(Request request, Response response) {
          handleList(context.controllers(), request, response);
        }
      });
View Full Code Here

  private void defineResponseExample(final Context context, NewController controller) {
    NewAction action = controller
      .createAction("response_example")
      .setDescription("Display web service response example")
      .setSince("4.4")
      .setHandler(new RequestHandler() {
        @Override
        public void handle(Request request, Response response) throws Exception {
          String controllerKey = request.mandatoryParam("controller");
          Controller controller = context.controller(controllerKey);
          if (controller == null) {
View Full Code Here

    l10n.setDescription("Localization")
      .setSince("4.4");
    NewAction indexAction = l10n.createAction("index")
      .setInternal(true)
      .setDescription("Get all localization messages for a given locale")
      .setHandler(new RequestHandler() {
        @Override
        public void handle(Request request, Response response) throws Exception {
          serializeMessages(request, response);
        }
      });
View Full Code Here

        .setDescription("Metrics")
        .setSince("3.2");

      // action with default values
      newController.createAction("show")
        .setHandler(new RequestHandler() {
          @Override
          public void handle(Request request, Response response) {
          }
        });


      // action with a lot of overridden values
      NewAction create = newController.createAction("create")
        .setDescription("Create metric")
        .setSince("4.1")
        .setPost(true)
        .setResponseExample(Resources.getResource(getClass(), "ListingWsTest/metrics_example.json"))
        .setHandler(new RequestHandler() {
          @Override
          public void handle(Request request, Response response) {
          }
        });
      create
        .createParam("severity")
        .setDescription("Severity")
        .setRequired(true)
        .setPossibleValues("BLOCKER", "INFO")
        .setExampleValue("INFO")
        .setDefaultValue("BLOCKER");
      create.createParam("name");

      newController.createAction("internal_action").setInternal(true).setHandler(new RequestHandler() {
        @Override
        public void handle(Request request, Response response) throws Exception {

        }
      });
View Full Code Here

TOP

Related Classes of org.sonar.api.server.ws.RequestHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.