Class: TaskJuggler::ReportServlet
- Inherits:
-
WEBrick::HTTPServlet::AbstractServlet
- Object
- WEBrick::HTTPServlet::AbstractServlet
- TaskJuggler::ReportServlet
- Defined in:
- lib/taskjuggler/daemon/ReportServlet.rb
Class Method Summary collapse
Instance Method Summary collapse
- #do_GET(req, res) ⇒ Object
-
#initialize(config, options) ⇒ ReportServlet
constructor
A new instance of ReportServlet.
Constructor Details
#initialize(config, options) ⇒ ReportServlet
Returns a new instance of ReportServlet.
25 26 27 28 29 30 31 |
# File 'lib/taskjuggler/daemon/ReportServlet.rb', line 25 def initialize(config, ) super @authKey = [0] @host = [1] @port = [2] @uri = [3] end |
Class Method Details
.get_instance(config, options) ⇒ Object
33 34 35 |
# File 'lib/taskjuggler/daemon/ReportServlet.rb', line 33 def self.get_instance(config, ) self.new(config, ) end |
Instance Method Details
#do_GET(req, res) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/taskjuggler/daemon/ReportServlet.rb', line 37 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'] || '' unless attributes.empty? attributes = URLParameter.decode(attributes) end debug('', "Attributes: #{attributes}") generateReport(projectId, reportId, attributes) end rescue error('get_req_failed', "Cannot serve GET request: #{req}\n#{$!}") end end |