2 * Originally this was supposed to intercept http calls and redirect them
3 * but that is not supported in webkit2 (without using the extension api)
5 * so for now we have modified our server to serve use a base url of xhttp:
7 * so all relative urls are based on that
9 * Idea is to serve the files from the file system, so no need to setup apache etc...
10 * This should work for the static content like css / javascript etc.. but
11 * will cause issues with 'dynamic' xhr files (eg. the php stuff)
13 * the idea is nicked from geary.
17 public class FakeServer : Object
21 public FakeServer(WebKit.WebView wkview)
29 //this.view.resource_load_started.connect(on_resource_request_starting);
30 //this.view.navigation_policy_decision_requested.connect(on_navigation_policy_decision_requested);
31 //this.view.new_window_policy_decision_requested.connect(on_navigation_policy_decision_requested);
34 this.view.get_context().register_uri_scheme("xhttp", serve);
38 public void serve(WebKit.URISchemeRequest request)
40 // request is URISchemeRequest
42 print(request.get_path());
44 var file = File.new_for_path ("/home/alan/gitlive" + request.get_path());
46 var stream = file.read();
47 var info = file.query_info(
49 FileQueryInfoFlags.NONE
52 request.finish ( stream, info.get_size(), info.get_content_type());