diff jamendo/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 df9685986338
children
line wrap: on
line diff
--- a/jamendo/urispace/urispace.pl	Tue Feb 20 13:41:09 2018 +0000
+++ b/jamendo/urispace/urispace.pl	Tue Feb 20 14:52:02 2018 +0000
@@ -1,17 +1,18 @@
 :- 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(config).
 :- use_module(mapping).
 
+:- set_setting_default(http:cors, [*]).
+
+    
 server(Port, Options) :-
         http_server(reply,[ port(Port),timeout(20)| Options]).
 
-
-
 /**
   * Closes the servlet
   */
@@ -36,7 +37,8 @@
 	mapping:see_other_rdf(requested_pattern(Pattern),redirect_pattern(RedirectP)),
 	!,
 	concat_atom(RedirectP,Redirect),
-	log:log('Sending a 303 towards ~w',Redirect),
+        log:log('Sending a 303 towards ~w',Redirect),
+        cors_enable,
 	throw(http_reply(see_other(Redirect),[])).
 
 accept_rdf('application/rdf+xml').
@@ -58,6 +60,7 @@
         !,
         concat_atom(RedirectP,Redirect),
         log:log('Sending a 303 towards ~w',Redirect),
+        cors_enable,
         throw(http_reply(see_other(Redirect),[])).
 
 init :-