Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed orpc-js examples for c089133

  • Loading branch information...
commit 9cf73102b3f73e9fe234a035eb0f9ae13cecf188 1 parent 8e3a6aa
Jake Donham authored
View
4 examples/clicks/_tags
@@ -3,7 +3,7 @@
<clicks.ml> : pkg_lwt,pkg_orpc-js-client,pkg_dom
<clicks.js> : pkg_lwt,pkg_orpc-js-client,pkg_dom
-<proto_js_srv.ml*> : pkg_nethttpd,pkg_orpc-js-server
+<proto_js_srv.ml*> : pkg_lwt,pkg_nethttpd,pkg_orpc-js-server
<proto_js_aux.ml*> : pkg_orpc-js-server
<server.ml> : pkg_nethttpd,pkg_netplex,pkg_orpc-js-server
-<server.byte> : pkg_nethttpd,pkg_netplex,pkg_orpc-js-server
+<server.byte> : pkg_lwt,pkg_nethttpd,pkg_netplex,pkg_orpc-js-server
View
23 examples/clicks/server.ml
@@ -1,3 +1,24 @@
+let service handler =
+ let process (cgi : Netcgi_types.cgi_activation) =
+ let res =
+ try handler (cgi#argument "BODY")#value
+ with Not_found -> raise (Invalid_argument "bad_request") in
+ (* XXX handle gzip *)
+ cgi#set_header
+ ~content_type:"text/plain; charset=utf-8"
+ ~cache:`No_cache
+ ();
+ cgi#output#output_string res;
+ cgi#output#commit_work () in
+
+ {
+ Nethttpd_services.dyn_handler = (fun _ -> process);
+ dyn_activation = Nethttpd_services.std_activation `Std_activation_unbuffered;
+ dyn_uri = None;
+ dyn_translator = (fun _ -> "");
+ dyn_accept_all_conditionals = false;
+ }
+
let start() =
let (opt_list, cmdline_cfg) = Netplex_main.args() in
@@ -22,7 +43,7 @@ let start() =
let factories =
[ Nethttpd_plex.nethttpd_factory
~config_cgi
- ~handlers:["clicks", Orpc_js_server.service M.handler]
+ ~handlers:["clicks", service M.handler]
();
]
in
View
5 examples/sudoku/_tags
@@ -3,7 +3,8 @@
<sudoku.ml> : pkg_lwt,pkg_orpc-js-client,pkg_dom,syntax_camlp4o,pkg_camlp4.macro
<sudoku.js> : pkg_lwt,pkg_orpc-js-client,pkg_dom
-<proto_js_srv.ml*> : pkg_nethttpd,pkg_orpc-js-server
+<proto_js_srv.ml*> : pkg_nethttpd,pkg_orpc-js-server,pkg_lwt
<proto_js_aux.ml*> : pkg_orpc-js-server
<server.ml> : pkg_nethttpd,pkg_netplex,pkg_orpc-js-server
-<server.byte> : pkg_nethttpd,pkg_netplex,pkg_orpc-js-server
+<server.byte> : pkg_nethttpd,pkg_netplex,pkg_orpc-js-server,pkg_lwt
+
View
23 examples/sudoku/server.ml
@@ -53,6 +53,27 @@ struct
end
+let service handler =
+ let process (cgi : Netcgi_types.cgi_activation) =
+ let res =
+ try handler (cgi#argument "BODY")#value
+ with Not_found -> raise (Invalid_argument "bad_request") in
+ (* XXX handle gzip *)
+ cgi#set_header
+ ~content_type:"text/plain; charset=utf-8"
+ ~cache:`No_cache
+ ();
+ cgi#output#output_string res;
+ cgi#output#commit_work () in
+
+ {
+ Nethttpd_services.dyn_handler = (fun _ -> process);
+ dyn_activation = Nethttpd_services.std_activation `Std_activation_unbuffered;
+ dyn_uri = None;
+ dyn_translator = (fun _ -> "");
+ dyn_accept_all_conditionals = false;
+ }
+
let start() =
let (opt_list, cmdline_cfg) = Netplex_main.args() in
@@ -72,7 +93,7 @@ let start() =
let factories =
[ Nethttpd_plex.nethttpd_factory
~config_cgi
- ~handlers:["sudoku", Orpc_js_server.service M.handler]
+ ~handlers:["sudoku", service M.handler]
();
]
in
Please sign in to comment.
Something went wrong with that request. Please try again.