예제 #1
0
void noit_http_rest_init() {
  noit_http_init();
  eventer_name_callback("noit_wire_rest_api/1.0", noit_http_rest_handler);
  eventer_name_callback("http_rest_api", noit_http_rest_raw_handler);

  noit_http_rest_load_rules();

  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_DELETE,
                                 noit_http_rest_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_MERGE,
                                 noit_http_rest_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_GET,
                                 noit_http_rest_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_HEAD,
                                 noit_http_rest_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_POST,
                                 noit_http_rest_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_PUT,
                                 noit_http_rest_handler);
}
예제 #2
0
void noit_http_rest_init() {
  noit_http_init();
  eventer_name_callback("noit_wire_rest_api/1.0", noit_http_rest_handler);
  eventer_name_callback("http_rest_api", noit_http_rest_raw_handler);

  /* some default mime types */
#define ADD_MIME_TYPE(ext, type) \
noit_hash_store(&mime_type_defaults, strdup(ext), strlen(ext), strdup(type))
  ADD_MIME_TYPE("html", "text/html");
  ADD_MIME_TYPE("htm", "text/html");
  ADD_MIME_TYPE("js", "text/javascript");
  ADD_MIME_TYPE("css", "text/css");
  ADD_MIME_TYPE("ico", "image/x-icon");
  ADD_MIME_TYPE("gif", "image/gif");
  ADD_MIME_TYPE("png", "image/png");
  ADD_MIME_TYPE("jpg", "image/jpg");
  ADD_MIME_TYPE("jpeg", "image/jpg");
  ADD_MIME_TYPE("json", "application/javascript");

  noit_http_rest_load_rules();

  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_DELETE,
                                 noit_http_rest_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_MERGE,
                                 noit_http_rest_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_GET,
                                 noit_http_rest_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_HEAD,
                                 noit_http_rest_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_POST,
                                 noit_http_rest_handler);
  noit_control_dispatch_delegate(noit_control_dispatch,
                                 NOIT_CONTROL_PUT,
                                 noit_http_rest_handler);
}