summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-01-13 13:04:56 +0100
committermguetlein <martin.guetlein@gmail.com>2011-01-13 13:04:56 +0100
commit95a0c849f593936ef7d92226330d7193cd83b1f8 (patch)
treef5fb020e9c6ae95775f507c48931be97566ea9ab
parente752dc0646a48e01acddf0d710d25d82d44e8df5 (diff)
add html support for get dataset
-rw-r--r--application.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/application.rb b/application.rb
index 84babae..802cb88 100644
--- a/application.rb
+++ b/application.rb
@@ -16,7 +16,7 @@ class Dataset
after :save, :check_policy
def load(params,request)
-
+
data = request.env["rack.input"].read
content_type = request.content_type
content_type = "application/rdf+xml" if content_type.nil?
@@ -124,6 +124,8 @@ get '/:id' do
unless extension.empty?
params[:id].sub!(/\.#{extension}$/,'')
case extension
+ when "html"
+ @accept = 'text/html'
when "yaml"
@accept = 'application/x-yaml'
when "csv"
@@ -152,7 +154,11 @@ get '/:id' do
when /yaml/
response['Content-Type'] = 'application/x-yaml'
dataset.to_yaml
-
+
+ when /html/
+ response['Content-Type'] = 'text/html'
+ OpenTox.text_to_html dataset.to_yaml
+
when "text/csv"
response['Content-Type'] = 'text/csv'
dataset.to_csv
@@ -255,6 +261,7 @@ end
# @param [optional] file, for file uploads, Content-type should be multipart/form-data, please specify the file type `application/rdf+xml, application-x-yaml, text/csv, application/ms-excel`
# @return [text/uri-list] Task URI or Dataset URI (empty datasets)
post '/?' do
+
@dataset = Dataset.create
response['Content-Type'] = 'text/uri-list'
@dataset.subjectid = params[:subjectid] if params[:subjectid]