# File lib/rhc-common.rb, line 813
  def self.ctl_app(libra_server, net_http, app_name, rhlogin, password, action, embedded=false, framework=nil, server_alias=nil, print_result=true)
    data = {:action => action,
            :app_name => app_name,
            :rhlogin => rhlogin
           }
    
    data[:server_alias] = server_alias if server_alias
    if framework
      data[:cartridge] = framework
    end
    
    if @mydebug
      data[:debug] = true
    end
    
    json_data = generate_json(data)

    url = nil
    if embedded
      url = URI.parse("https://#{libra_server}/broker/embed_cartridge")
    else
      url = URI.parse("https://#{libra_server}/broker/cartridge")
    end
    response = http_post(net_http, url, json_data, password)
    
    if response.code == '200'
      json_resp = JSON.parse(response.body)
      print_response_success(json_resp, print_result || @mydebug)
    else
        print_response_err(response)
    end
    JSON.parse(response.body)
  end