Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (25 sloc) 846 Bytes
open CadmiumServlet
let handle_get srv req resp =
let out = Response.get_output_stream resp in
match Request.get_path_info req with
| "/Service1" ->
output_string out (Bridge.save ())
| "/Service2" ->
output_string out (Bridge.get ())
| url ->
output_string out "<html><head><title>Hello OCaml World!</title></head><body>";
output_string out (Printf.sprintf "<b>Looks like you asked for: %s</b>" url);
output_string out "</body></html>"
let () = Servlet.register {
Servlet.destroy = ignore;
Servlet.init = ignore;
Servlet.info = "my first servlet";
Servlet.do_delete = None;
Servlet.do_get = Some handle_get;
Servlet.do_head = None;
Servlet.do_options = None;
Servlet.do_post = None;
Servlet.do_put = None;
Servlet.do_trace = None;
Servlet.get_last_modified = None;
}
Something went wrong with that request. Please try again.