@Override public void handle(Request request, Response response) throws Exception { removeFavorite().accept(request); response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { RemoveRequest removeRequest = toWsRequest(request); remove(removeRequest); response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { doHandle(toApplyTemplateWsRequest(request)); response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { doHandle(request.mandatoryParam(PARAM_ID)); response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { doHandle(toWsRequest(request)); response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { doHandle(toWsRequest(request)); response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { AddRequest addRequest = toWsRequest(request); add(addRequest); response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { verifySystemAdministrator(); organisationSupport.enable(requireNonNull(userSession.getLogin())); response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { String eventP = request.mandatoryParam(PARAM_EVENT); try (DbSession dbSession = dbClient.openSession(false)) { Stream.of(getEvent(dbSession, eventP)) .peek(checkPermissions()) .peek(checkModifiable()) .forEach(event -> deleteEvent(dbSession, event)); } response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { userSession.checkLoggedIn(); doHandle(toDeleteTemplateWsRequest(request)); response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { userSession.checkLoggedIn(); String key = request.mandatoryParam(PARAM_KEY); String value = request.mandatoryParam(PARAM_VALUE); setUserSetting(key, value); response.noContent(); }
@Override public void handle(Request wsRequest, Response wsResponse) throws InterruptedException { userSession.checkIsSystemAdministrator(); LoggerLevel level = LoggerLevel.valueOf(wsRequest.mandatoryParam(PARAM_LEVEL)); service.changeLogLevel(level); wsResponse.noContent(); } }
@Override public void handle(Request request, Response response) throws Exception { try (DbSession dbSession = dbClient.openSession(false)) { SetRequest wsRequest = toWsRequest(request); SettingsWsSupport.validateKey(wsRequest.getKey()); doHandle(dbSession, wsRequest); } response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { long id = request.mandatoryParamAsLong(PARAM_ID); try (DbSession dbSession = dbClient.openSession(false)) { CustomMeasureDto customMeasure = dbClient.customMeasureDao().selectById(dbSession, id); checkArgument(customMeasure != null, "Custom measure with id '%s' does not exist", id); checkPermission(dbSession, customMeasure); dbClient.customMeasureDao().delete(dbSession, id); dbSession.commit(); } response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { String name = request.mandatoryParam(PARAM_NAME); try (DbSession dbSession = dbClient.openSession(false)) { UserDto user = userTokenSupport.getUser(dbSession, request); dbClient.userTokenDao().deleteByUserAndName(dbSession, user, name); dbSession.commit(); } response.noContent(); } }
@Override public void handle(Request request, Response response) throws Exception { userSession.checkIsSystemAdministrator(); String key = request.mandatoryParam(PARAM_KEY); PluginUpdate pluginUpdate = findPluginUpdateByKey(key); pluginDownloader.download(key, pluginUpdate.getRelease().getVersion()); response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = wsSupport.getOrganizationByKey(dbSession, request.param(PARAM_ORGANIZATION)); QProfileDto profile = wsSupport.getProfile(dbSession, organization, request.mandatoryParam(PARAM_QUALITY_PROFILE), request.mandatoryParam(PARAM_LANGUAGE)); wsSupport.checkCanEdit(dbSession, organization, profile); UserDto user = wsSupport.getUser(dbSession, organization, request.mandatoryParam(PARAM_LOGIN)); addUser(dbSession, profile, user); } response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = wsSupport.getOrganizationByKey(dbSession, request.param(PARAM_ORGANIZATION)); QProfileDto profile = wsSupport.getProfile(dbSession, organization, request.mandatoryParam(PARAM_QUALITY_PROFILE), request.mandatoryParam(PARAM_LANGUAGE)); wsSupport.checkCanEdit(dbSession, organization, profile); UserDto user = wsSupport.getUser(dbSession, organization, request.mandatoryParam(PARAM_LOGIN)); removeUser(dbSession, profile, user); } response.noContent(); }
@Override public void handle(Request request, Response response) throws Exception { try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = wsSupport.getOrganizationByKey(dbSession, request.param(PARAM_ORGANIZATION)); QProfileDto profile = wsSupport.getProfile(dbSession, organization, request.mandatoryParam(PARAM_QUALITY_PROFILE), request.mandatoryParam(PARAM_LANGUAGE)); wsSupport.checkCanEdit(dbSession, organization, profile); GroupDto user = wsSupport.getGroup(dbSession, organization, request.mandatoryParam(PARAM_GROUP)); addGroup(dbSession, profile, user); } response.noContent(); }
@Test public void test_response_with_no_content() { Request request = new TestRequest().setPath("api/foo"); RequestHandler handler = (req, resp) -> resp.noContent(); DumbResponse response = run(request, newWs("api/foo", a -> a.setHandler(handler))); assertThat(response.stream().outputAsString()).isEmpty(); assertThat(response.stream().status()).isEqualTo(204); }