Mercurial > hg > dbtune-rdf-services
diff chord/urispace/urispace.pl @ 27:d95e683fbd35 tip
Enable CORS on urispace redirects as well
author | Chris Cannam |
---|---|
date | Tue, 20 Feb 2018 14:52:02 +0000 |
parents | 7902f428bc60 |
children |
line wrap: on
line diff
--- a/chord/urispace/urispace.pl Tue Feb 20 13:41:09 2018 +0000 +++ b/chord/urispace/urispace.pl Tue Feb 20 14:52:02 2018 +0000 @@ -1,19 +1,20 @@ :- module(urispace,[init/0]). - :- use_module(library('http/thread_httpd')). +:- use_module(library('http/http_cors')). :- use_module(library('semweb/rdf_db')). :- use_module(log). :- use_module(chord_parser). :- style_check(-discontiguous). +:- set_setting_default(http:cors, [*]). + + server(Port, Options) :- http_server(reply,[ port(Port),timeout(20)| Options]). - - namespace('http://dbtune.org/chord'). /** @@ -23,6 +24,7 @@ member(path(Path),Request), atom_concat(SymbolT,'.rdf',Path), atom_concat('/',Symbol,SymbolT), + cors_enable, !, (parse(Symbol,RDF) -> ( @@ -44,6 +46,7 @@ accept_png(AcceptHeader), !, atom_concat('/',Symbol,Path), + cors_enable, (parse(Symbol,RDF) -> ( member(rdf(_,'http://xmlns.com/foaf/0.1/depiction',Pic),RDF), @@ -66,6 +69,7 @@ namespace(NS), format(atom(Redirect),'~w~w.rdf',[NS,Path]), log:log('Sending a 303 towards ~w',Redirect), + cors_enable, throw(http_reply(see_other(Redirect),[])). accept_rdf('application/rdf+xml'). @@ -90,6 +94,7 @@ html(Html),namespace(Namespace), format(atom(Redirect),'~w~w~w',[Html,Namespace,Path]), log:log('Sending a 303 towards ~w',Redirect), + cors_enable, throw(http_reply(see_other(Redirect),[])). port(1111).