summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/config/config_ru.rb1
-rw-r--r--lib/helper.rb20
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/config/config_ru.rb b/lib/config/config_ru.rb
index 3d8dce2..93df867 100644
--- a/lib/config/config_ru.rb
+++ b/lib/config/config_ru.rb
@@ -12,6 +12,7 @@ $stdout.sync = true
$stderr.sync = true
set :logging, false
set :raise_errors, true
+set :lock, true
['public','tmp'].each do |dir|
FileUtils.mkdir_p dir unless File.exists?(dir)
diff --git a/lib/helper.rb b/lib/helper.rb
index b30908c..37238bd 100644
--- a/lib/helper.rb
+++ b/lib/helper.rb
@@ -61,6 +61,26 @@ before do
end
@subjectid = subjectid
protected!(subjectid)
+
+ extension = File.extname(request.path_info) # params[:id] is not yet available
+ unless extension.empty?
+ #request.path_info.sub!(/\.#{extension}$/,'')
+ case extension
+ when "html"
+ @accept = 'text/html'
+ when "yaml"
+ @accept = 'application/x-yaml'
+ when "csv"
+ @accept = 'text/csv'
+ when "rdfxml"
+ @accept = 'application/rdf+xml'
+ when "xls"
+ @accept = 'application/ms-excel'
+ else
+ halt 404, "File format #{extension} not supported."
+ end
+ end
+
end
end