import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.sonar.api.server.ws.RailsHandler;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.web.ServletFilter;
webServiceEngine.controllers()
.forEach(controller -> controller.actions()
.forEach(action -> {
- // Rails, Rest and servlet filter WS should not be executed by the web service engine
- if (isJavaWs(controller, action)) {
+ // Rest and servlet filter WS should not be executed by the web service engine
+ if (shouldBeExecutedByWebServiceEngine(controller, action)) {
includeUrls.add("/" + controller.path() + "/*");
} else {
excludeUrls.add("/" + action.path() + "*");
// Nothing to do
}
- private static boolean isJavaWs(WebService.Controller controller, WebService.Action action) {
- return !(action.handler() instanceof RailsHandler)
- && !(action.handler() instanceof ServletFilterHandler)
+ private static boolean shouldBeExecutedByWebServiceEngine(WebService.Controller controller, WebService.Action action) {
+ return !(action.handler() instanceof ServletFilterHandler)
&& !controller.path().equals(CONTROLLER_PROPERTIES);
}
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.sonar.api.server.ws.RailsHandler;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.RequestHandler;
import org.sonar.api.server.ws.Response;
initWebServiceEngine(
newWsUrl("api/issues", "search"),
newWsUrl("batch", "index"),
- newWsUrl("api/authentication", "login").setHandler(ServletFilterHandler.INSTANCE),
- newWsUrl("api/resources", "index").setHandler(RailsHandler.INSTANCE),
- newWsUrl("api/issues", "deprecatedSearch").setHandler(RailsHandler.INSTANCE));
+ newWsUrl("api/authentication", "login").setHandler(ServletFilterHandler.INSTANCE));
assertThat(underTest.doGetPattern().matches("/api/issues/search")).isTrue();
assertThat(underTest.doGetPattern().matches("/api/issues/search.protobuf")).isTrue();
assertThat(underTest.doGetPattern().matches("/api/resources/index")).isFalse();
assertThat(underTest.doGetPattern().matches("/api/authentication/login")).isFalse();
- assertThat(underTest.doGetPattern().matches("/api/issues/deprecatedSearch")).isFalse();
assertThat(underTest.doGetPattern().matches("/api/properties")).isFalse();
assertThat(underTest.doGetPattern().matches("/foo")).isFalse();
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.server.ws;
-
-/**
- * Used to declare web services that are still implemented in Ruby on Rails.
- *
- * @since 4.4
- */
-public class RailsHandler implements RequestHandler {
-
- public static final RequestHandler INSTANCE = new RailsHandler();
-
- private RailsHandler() {
- // Nothing
- }
-
- @Override
- public void handle(Request request, Response response) {
- throw new UnsupportedOperationException("This web service is implemented in rails");
- }
-
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.server.ws;
-
-import org.junit.Test;
-
-public class RailsHandlerTest {
-
- @Test(expected = UnsupportedOperationException.class)
- public void throw_unsupported_operation_exception() throws Exception {
- RailsHandler.INSTANCE.handle(null, null);
- }
-}