class TaskJuggler::ReportServlet

Public Class Methods

get_instance(config, options) click to toggle source
# File lib/taskjuggler/daemon/ReportServlet.rb, line 30
def self.get_instance(config, options)
  self.new(config, options)
end
new(config, options) click to toggle source
# File lib/taskjuggler/daemon/ReportServlet.rb, line 22
def initialize(config, options)
  super
  @authKey = options[0]
  @host = options[1]
  @port = options[2]
  @uri = options[3]
end

Public Instance Methods

do_GET(req, res) click to toggle source
# File lib/taskjuggler/daemon/ReportServlet.rb, line 34
def do_GET(req, res)
  debug('', "Serving URL #{req}")
  @req = req
  @res = res
  begin
    # WEBrick is returning the query elements as FormData objects. We must
    # use to_s to explicitely convert them to String objects.
    projectId = req.query['project'].to_s
    debug('', "Project ID: #{projectId}")
    reportId = req.query['report'].to_s
    debug('', "Report ID: #{reportId}")
    if projectId.empty? || reportId.empty?
      debug('', "Project welcome page requested")
      generateWelcomePage(projectId)
    else
      debug('', "Report #{reportId} of project #{projectId} requested")
      attributes = req.query['attributes'] || ''
      attributes = URLParameter.decode(attributes) unless attributes.empty?
      generateReport(projectId, reportId, attributes)
    end
  rescue
  end
end