diff options
author | mguetlein <martin.guetlein@gmail.com> | 2010-07-28 10:17:19 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2010-07-28 10:17:19 +0200 |
commit | 70eb08075622b23e128010f64b8e7143bd96fefb (patch) | |
tree | 9d04c8c9a679411d54b743f62eef202dfc2b391f | |
parent | 24ae980022e2531d1d6c3a8700d4c7c89ec5bf3d (diff) |
add text/uri-list support
-rw-r--r-- | application.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/application.rb b/application.rb index 5cebe37..92d350c 100644 --- a/application.rb +++ b/application.rb @@ -34,9 +34,9 @@ get '/:id/?' do task = Task.get(params[:id]) halt 404, "Task '#{params[:id]}' not found." unless task - task_content = {:creator => task.creator, :title => task.title, :date => task.created_at.to_s, :hasStatus => task.hasStatus, + task_content = {:creator => task.creator, :title => task.title, :date => task.created_at, :hasStatus => task.hasStatus, :resultURI => task.resultURI, :percentageCompleted => task.percentageCompleted, :description => task.description, - :due_to_time => task.due_to_time.to_s} + :due_to_time => task.due_to_time } code = task.hasStatus == "Running" ? 202 : 200 @@ -50,6 +50,9 @@ get '/:id/?' do owl = OpenTox::Owl.create 'Task', task.uri task_content.each{ |k,v| owl.set(k.to_s,v)} halt code, owl.rdf + when /text\/uri\-list/ + response['Content-Type'] = 'text/uri-list' + halt code, task.resultURI else halt 400, "MIME type '"+request.env['HTTP_ACCEPT'].to_s+"' not supported, valid Accept-Headers are \"application/rdf+xml\" and \"application/x-yaml\"." end |