lib/buildmaster/source_file_handler.rb in BuildMaster-0.7.0 vs lib/buildmaster/source_file_handler.rb in BuildMaster-0.8.0

- old
+ new

@@ -25,18 +25,23 @@ extension = File.extname(path) if (extension == '') path = "#{path}index.html" extension = '.html' end - if (extension.casecmp('.html') == 0) + file_processor = FileProcessor.for_request_path(path, @spec) + if (file_processor.is_html?) begin - serve_generated_file(path[0, path.length - 5], req, res) + content = file_processor.generate_document.to_s rescue Exception @logger.error("error serving the file #{path}") @logger.error($!) raise WEBrick::HTTPStatus::InternalServerError, "#{$!}", caller end + res['content-type'] = 'text/html' + res['content-length'] = content.length + res['last-modified'] = DateTime.new + res.body = content else @delegate.service(req, res) end end \ No newline at end of file