diff options
author | mguetlein <martin.guetlein@gmail.com> | 2010-09-13 13:29:09 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2010-09-13 13:29:09 +0200 |
commit | eb5d72a15942b2367c2c1178a0a50d10261c5132 (patch) | |
tree | 0487d593ef884e68d87b03a886a7cd19f8d0bd35 /report/report_application.rb | |
parent | ede7b60f62fb4385ce1358f49e92dd325ed251f6 (diff) |
fix report dtd - v3
Diffstat (limited to 'report/report_application.rb')
-rw-r--r-- | report/report_application.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/report/report_application.rb b/report/report_application.rb index b8f7eed..31f5ac6 100644 --- a/report/report_application.rb +++ b/report/report_application.rb @@ -17,12 +17,23 @@ def perform end end +def get_docbook_resource(filepath) + perform do |rs| + halt 404,"not found: "+filepath unless File.exist?(filepath) + types = MIME::Types.type_for(filepath) + content_type(types[0].content_type) if types and types.size>0 and types[0] + result = body(File.new(filepath)) + end +end -get '/'+ENV['REPORT_DTD'] do - content_type "application/xml-dtd" - body(File.new(ENV['REPORT_DTD'])) +get '/'+ENV['DOCBOOK_DIRECTORY']+'/:subdir/:resource' do + path_array = request.env['REQUEST_URI'].split("/") + get_docbook_resource ENV['DOCBOOK_DIRECTORY']+"/"+path_array[-2]+"/"+path_array[-1] end +get '/'+ENV['DOCBOOK_DIRECTORY']+'/:resource' do + get_docbook_resource ENV['DOCBOOK_DIRECTORY']+"/"+request.env['REQUEST_URI'].split("/")[-1] +end get '/report/:type/css_style_sheet/?' do perform do |rs| @@ -30,7 +41,6 @@ get '/report/:type/css_style_sheet/?' do end end - get '/report/?' do perform do |rs| content_type "text/uri-list" |