From 95a0c849f593936ef7d92226330d7193cd83b1f8 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Thu, 13 Jan 2011 13:04:56 +0100 Subject: add html support for get dataset --- application.rb | 11 +++++++++-- 1 file 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] -- cgit v1.2.3