def download(url, file_name = nil)
      return nil if (url.nil? || url.empty?)
      uri          = URI.parse(url)
      http         = Net::HTTP.new(@host, @port)
      http.use_ssl = true
      if @trust_store.nil?
        http.verify_mode = OpenSSL::SSL::VERIFY_NONE # XXX: security issue
      else
        http.cert_store = @trust_store
      end
      headers = { 'Cookie' => "nexposeCCSessionID=#{@session_id}" }

      if file_name
        http.request_get(uri.to_s, headers) do |resp|
          ::File.open(file_name, 'wb') do |file|
            resp.read_body { |chunk| file.write(chunk) }
          end
        end
      else
        resp = http.get(uri.to_s, headers)
        resp.body
      end
    end
def download(url, file_name = nil)
      return nil if (url.nil? || url.empty?)
      uri          = URI.parse(url)
      http         = Net::HTTP.new(@host, @port)
      http.use_ssl = true
      if @trust_store.nil?
        http.verify_mode = OpenSSL::SSL::VERIFY_NONE # XXX: security issue
      else
        http.cert_store = @trust_store
      end
      headers = { 'Cookie' => "nexposeCCSessionID=#{@session_id}" }

      if file_name
        http.request_get(uri.to_s, headers) do |resp|
          ::File.open(file_name, 'wb') do |file|
            resp.read_body { |chunk| file.write(chunk) }
          end
        end
      else
        resp = http.get(uri.to_s, headers)
        resp.body
      end
    end
Download a specific URL, typically a report.
 Include an optional file_name parameter to write the output to a file.

 Note: XML and HTML reports have charts not downloaded by this method.
       Would need to do something more sophisticated to grab
       all the associated image files.