diff options
author | Jenkins CI <ci@sonarsource.com> | 2015-11-02 08:01:18 +0100 |
---|---|---|
committer | Jenkins CI <ci@sonarsource.com> | 2015-11-02 08:01:18 +0100 |
commit | 787da65b0d08e14cabe9f45e27514f8e418c1375 (patch) | |
tree | 0dd9e09504422a3423e6069cc9e2d2c47bad1a4a /server/sonar-web/src | |
parent | bb5e1718510207c0b3b2159fca12a5867a5e4603 (diff) | |
parent | b1cc1778b3e18b5f0ea2121afc6a72670f4df010 (diff) | |
download | sonarqube-787da65b0d08e14cabe9f45e27514f8e418c1375.tar.gz sonarqube-787da65b0d08e14cabe9f45e27514f8e418c1375.zip |
Automatic merge from branch-5.2
* origin/branch-5.2:
SONAR-5851 Add back the WS /profiles/export web page
Diffstat (limited to 'server/sonar-web/src')
-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 |