diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-10-29 17:42:33 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-10-30 09:48:53 +0100 |
commit | b1cc1778b3e18b5f0ea2121afc6a72670f4df010 (patch) | |
tree | 22f7f7f8a651c9866ce138a6d1b28e66298becd7 /server/sonar-web | |
parent | 9d0db7ccf1b038e4b17729499cedda8b167b2770 (diff) | |
download | sonarqube-b1cc1778b3e18b5f0ea2121afc6a72670f4df010.tar.gz sonarqube-b1cc1778b3e18b5f0ea2121afc6a72670f4df010.zip |
SONAR-5851 Add back the WS /profiles/export web page
Diffstat (limited to 'server/sonar-web')
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb index a1316df9366..aa8d7613397 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb @@ -36,4 +36,25 @@ class ProfilesController < ApplicationController render :action => 'index' end + # GET /profiles/export?name=<profile name>&language=<language>&format=<exporter key> + def export + language = params[:language] + if params[:name].blank? + profile = Internal.qprofile_service.getDefault(language) + else + profile = Internal.qprofile_loader.getByLangAndName(language, CGI::unescape(params[:name])) + end + not_found('Profile not found') unless profile + + if params[:format].blank? + # standard sonar format + result = Internal.qprofile_service.backup(profile.getKee()) + send_data(result, :type => 'text/xml', :disposition => 'inline') + else + exporter_key = params[:format] + result = Internal.qprofile_exporters.export(profile.getKee(), exporter_key) + send_data(result, :type => Internal.qprofile_exporters.mimeType(exporter_key), :disposition => 'inline') + end + end + end |