text stringlengths 12 786k |
|---|
type ' a eref = ( ' a , [ volatile | persistent ] ) eref ' |
module Volatile = struct type ' a eref = ( ' a , volatile ) eref ' let eref_from_fun_ ~ ext ~ scope ? secure f : ' a eref = ( f , ext , match scope with | ` Request -> Req ( Polytables . make_key ( ) ) | ` Global -> Ref ( ref ( Lazy . from_fun f ) ) | ` Site ->... |
let eref_from_fun_ ~ ext ~ scope ? secure ? persistent f : ' a eref = match ( scope : [ < Eliom_common . all_scope ] ) with | ` Request -> ( Volatile . eref_from_fun_ ~ ext ~ scope ? secure f :> _ eref ) | ` Global -> ( match persistent with | None -> ( Volatile . eref_fro... |
let eref_from_fun ~ scope ? secure ? persistent f : ' a eref = eref_from_fun_ ~ ext : false ~ scope ? secure ? persistent f |
let eref ~ scope ? secure ? persistent v = eref_from_fun_ ~ ext : true ~ scope ? secure ? persistent ( fun ( ) -> v ) |
let get_site_id ( ) = let sd = Eliom_common . get_site_data ( ) in sd . Eliom_common . config_info . Ocsigen_extensions . default_hostname ^ " " : ^ sd . Eliom_common . site_dir_string |
let get ( ( f , _ , table ) as eref ) = match table with | Per t -> ( t >>= fun t -> get_persistent_data ~ table : t ( ) >>= function | Data d -> Lwt . return d | _ -> let value = f ( ) in set_persistent_data ~ table : t value >>= fun ( ) -> Lwt . return value ) | Ocs... |
let set ( ( _ , _ , table ) as eref ) value = match table with | Per t -> t >>= fun t -> set_persistent_data ~ table : t value | Ocsiper r -> r >>= fun r -> Ocsipersist . set r ( Some value ) | Ocsiper_sit t -> t >>= fun t -> Ocsipersist . add t ( get_site_id ( ) ) value | ... |
let modify eref f = get eref >>= fun x -> set eref ( f x ) |
let unset ( ( _ , _ , table ) as eref ) = match table with | Per t -> t >>= fun t -> remove_persistent_data ~ table : t ( ) | Ocsiper r -> r >>= fun r -> Ocsipersist . set r None | Ocsiper_sit t -> t >>= fun t -> Ocsipersist . remove t ( get_site_id ( ) ) | _ -> Lwt . r... |
module Ext = struct let get state ( ( f , ext , table ) as r ) = let state = Eliom_state . Ext . untype_state state in match table with | Vol _ -> Lwt . return ( Volatile . Ext . get state r ) | Per t -> t >>= fun t -> Lwt . catch ( fun ( ) -> Eliom_state . Ext . Low_lev... |
let section = Lwt_log_js . Section . make " eliom : registration " |
module type Base = sig type return = Eliom_service . non_ocaml end |
module Base = struct type return = Eliom_service . non_ocaml end |
module Ocaml = struct type ' a return = ' a Eliom_service . ocaml end |
type ' a kind = Eliom_service . result |
type ' a application_content = [ ` Appl of ' a ] |
module type PARAM = sig type page type options type return type result val reset_reload_fun : bool val send : ? options : options -> page -> [ ` Browser ] kind Lwt . t end |
let typed_apply ~ service f gp pp l l ' suffix = try % lwt let % lwt g = let l = Some ( Lwt . return l ) in Eliom_parameter . reconstruct_params ~ sp ( ) : gp l None true suffix and p = let l ' = Some ( Lwt . return l ' ) in Eliom_parameter . reconstruct_params ~ sp ( ) : pp l ... |
let wrap service att f _ suffix = let gp = Eliom_service . get_params_type service and pp = Eliom_service . post_params_type service and l = ( Eliom_request_info . get_sess_info ( ) ) . si_all_get_but_nl and l ' = match ( Eliom_request_info . get_sess_info ( ) ) . si_all_post_params ... |
let wrap_na ( service : ( _ , _ , _ , _ , _ , _ , _ , _ , _ , _ , _ ) Eliom_service . t ) _non_att f _ suffix = let gp = Eliom_service . get_params_type service and pp = Eliom_service . post_params_type service and si = Eliom_request_info . get_sess_info ( ) and... |
let register_att ~ service ~ att f = let key_meth = Eliom_service . which_meth_untyped service and gn = Eliom_service . get_name att and pn = Eliom_service . post_name att and priority = Eliom_service . priority att in let sgpt = Eliom_service . get_params_type service and sppt = Eliom_service . po... |
let register_na ~ service ~ na f = Eliom_route . add_naservice Eliom_service . ( na_name na ) ( wrap_na service na f ) Eliom_route . global_tables |
let register ( type g p att ) ( ~ service : ( g , p , _ , att , _ , _ , _ , _ , _ , _ , _ ) Eliom_service . t ) ( f : g -> p -> _ ) = match Eliom_service . info service with | Eliom_service . Attached att -> register_att ~ service ~ att f | Eliom_service . ... |
module Make ( P : PARAM ) = struct type page = P . page type options = P . options type return = P . return type result = P . result let send ? options ? charset : _ ? code : _ ? content_type : _ ? headers : _ page = P . send ? options page let register ? app ? scope : _ ? option... |
module Html = Make ( struct type page = Html_types . html Eliom_content . Html . elt type options = unit type return = Eliom_service . non_ocaml type result = browser_content kind let reset_reload_fun = false let send ? options : _ page = Lwt . return ( Eliom_service . Dom ( Eliom_content . ... |
module Action = Make ( struct type page = unit type options = [ ` Reload | ` NoReload ] type return = Eliom_service . non_ocaml type result = browser_content kind let reset_reload_fun = true let send ? options _page = match options with | Some ` Reload | None -> Lwt . return Eliom_service .... |
module Unit = Make ( struct type page = unit type options = unit type return = Eliom_service . non_ocaml type result = browser_content kind let reset_reload_fun = true let send ? options : _ _page = Lwt . return Eliom_service . No_contents end ) |
type appl_service_options = { do_not_launch : bool } |
module App ( P : Eliom_registration_sigs . APP_PARAM ) = struct type app_id let application_name = P . application_name include Make ( struct type page = Html_types . html Eliom_content . Html . elt type options = appl_service_options type return = Eliom_service . non_ocaml type result = browse... |
type ' a redirection = | Redirection : ( unit , unit , Eliom_service . get , _ , _ , _ , _ , [ ` WithoutSuffix ] , unit , unit , ' a ) Eliom_service . t -> ' a redirection |
module Redirection = struct type _ page = Eliom_service . non_ocaml redirection type options = [ ` MovedPermanently | ` Found | ` SeeOther | ` NotNodifed | ` UseProxy | ` TemporaryRedirect ] type _ return = Eliom_service . non_ocaml type _ result = browser_content kind let send ? optio... |
module Any = struct type ' a page = ' a kind type ' a return = Eliom_service . non_ocaml type ' a result = ' a kind type options = unit let send ? options : _ ? charset : _ ? code : _ ? content_type : _ ? headers : _ page = Lwt . return page let register ? app ? scope : _ ? optio... |
let appl_self_redirect f x = f x |
let headers_with_content_type ? charset ? content_type headers = match content_type with | Some content_type -> let charset = if charset <> None then charset else if String . length content_type >= 5 && ( String . sub content_type 0 5 = " text " / || let suffix = String . sub content_type ( ... |
let result_of_content ? charset ? content_type ? headers ? status body = let headers = match content_type with | Some content_type -> let headers = Ocsigen_header . of_option headers in Some ( headers_with_content_type ? charset ~ content_type headers ) | None -> headers in let headers = Cohttp . ... |
module Result_types : sig type ' a kind val cast_result : Ocsigen_response . t -> ' a kind val cast_kind : ' a kind -> Ocsigen_response . t val cast_kind_lwt : ' a kind Lwt . t -> Ocsigen_response . t Lwt . t val cast_result_lwt : Ocsigen_response . t Lwt . t -> ' a kind Lwt . t val c... |
type ' a kind = ' a Result_types . kind |
type ' a application_content = [ ` Appl of ' a ] |
let cast_unknown_content_kind ( x : unknown_content kind ) : ' a kind = Result_types . cast_result ( Result_types . cast_kind x ) |
let content_type_html content_type = let sp = Eliom_common . get_sp ( ) in match content_type , sp . Eliom_common . sp_sitedata . Eliom_common . html_content_type with | None , Some content_type -> content_type | Some content_type , _ -> content_type | None , None -> let accept = Ocsigen... |
module Html_base = struct type page = Html_types . html Eliom_content . Html . elt type options = unit type result = browser_content kind let result_of_http_result = Result_types . cast_result let send_appl_content = Eliom_service . XNever let out = let encode x = fst ( Xml_print . Utf8 . normal... |
module Html = Eliom_mkreg . Make ( Html_base ) |
module Flow5_base = struct type options = unit type result = block_content kind type page = Html_types . flow5 Eliom_content . Html . elt list let result_of_http_result = Result_types . cast_result let send_appl_content = Eliom_service . XNever let out = let encode x = fst ( Xml_print . Utf8 . n... |
module Flow5 = Eliom_mkreg . Make ( Flow5_base ) |
let add_cache_header cache headers = let ( <-< ) h ( n , v ) = Cohttp . Header . replace h ( Ocsigen_header . Name . to_string n ) v in match cache with | None -> headers | Some 0 -> headers <-< ( Ocsigen_header . Name . cache_control , " no - cache " ) | Some duration ->... |
module String_base = struct type page = string * string type options = int type result = unknown_content kind let result_of_http_result = Result_types . cast_result let send_appl_content = Eliom_service . XNever let send ? options ? charset ? code ? content_type : _ ? headers ( c , content_type ) ... |
module String = Eliom_mkreg . Make ( String_base ) |
module CssText_base = struct type page = string type options = int type result = browser_content kind let result_of_http_result = Result_types . cast_result let send_appl_content = Eliom_service . XNever let send ? options ? charset ? code ? content_type ? headers content = String_base . send ? optio... |
module CssText = Eliom_mkreg . Make ( CssText_base ) |
module Html_text_base = struct type page = string type options = unit type result = browser_content kind let result_of_http_result = Result_types . cast_result let send_appl_content = Eliom_service . XNever let send ? options : _ ? charset ? code ? content_type ? headers content = String_base . send... |
module Html_text = Eliom_mkreg . Make ( Html_text_base ) |
module Action_base = struct type page = unit type options = [ ` Reload | ` NoReload ] type result = browser_content kind let result_of_http_result = Result_types . cast_result let send_appl_content = Eliom_service . XAlways let send_directly ri res = Polytables . set ( Ocsigen_request . reques... |
module Action = Eliom_mkreg . Make ( Action_base ) |
module Unit_base = struct type page = unit type options = unit type result = browser_content kind let result_of_http_result = Result_types . cast_result let send_appl_content = Eliom_service . XAlways let send ? options : _ ? charset ( ? code = 204 ) ? content_type ? headers _content = let stat... |
module Unit = Eliom_mkreg . Make ( Unit_base ) |
module Any_base = struct type ' a page = ' a kind type options = unit type ' a return = Eliom_service . non_ocaml let send_appl_content = Eliom_service . XAlways let send ? options : _ ? charset ? code : _ ? content_type ? headers : _ ( result : ' a kind ) = let result = Result_types ... |
module Any = struct include Eliom_mkreg . Make_poly ( Any_base ) type ' a result = ' a kind let send ? options ? charset ? code ? content_type ? headers content = Result_types . cast_result_lwt ( Any_base . send ? options ? charset ? code ? content_type ? headers content ) end |
type ' a application_name = string |
let appl_self_redirect send page = if Eliom_request_info . expecting_process_page ( ) then let response = let headers = Cohttp . Header . ( add ( init ( ) ) ) Eliom_common . half_xhr_redir_header ( Eliom_request_info . get_full_url ( ) ) in Cohttp . Response . make ~ headers ( ... |
module File_base = struct type page = string type options = int type result = browser_content kind let result_of_http_result = Result_types . cast_result let send_appl_content = Eliom_service . XNever let send ? options ? charset ? code : _ ? content_type ? headers filename = let sp = Eliom_common . ... |
module File = struct include Eliom_mkreg . Make ( File_base ) let check_file filename = let sp = Eliom_common . get_sp ( ) in let request = Eliom_request_info . get_request_sp sp in try ignore ( Ocsigen_local_files . resolve request filename ( ) ) ; true with | Ocsigen_local_files . Fai... |
module File_ct_base = struct type page = string * string type options = int type result = browser_content kind let result_of_http_result = Result_types . cast_result let send_appl_content = Eliom_service . XNever let send ? options ? charset ? code ? content_type ? headers ( filename , content_type ... |
module File_ct = struct include Eliom_mkreg . Make ( File_ct_base ) let check_file = File . check_file end |
module Customize ( R : Eliom_registration_sigs . S_with_create ) ( T : sig type page val translate : page -> R . page Lwt . t end ) = struct type page = T . page type return = R . return type options = R . options type result = R . result let make_eh = function | None -> None | Some e... |
module Ocaml_base = struct type page = string type options = unit type result = Ocsigen_response . t let result_of_http_result x = x let send_appl_content = Eliom_service . XNever let send ? options : _ ? charset ? code ? content_type ? headers content = Result_types . cast_kind_lwt ( String . s... |
module Ocaml = struct type ' a page = ' a type options = unit type ' a return = ' a Eliom_service . ocaml type ' a result = ' a ocaml_content kind module M = Eliom_mkreg . Make ( Ocaml_base ) let prepare_data data = let ecs_request_data = let data = Eliom_syntax . get_request_data ( ) ... |
type appl_service_options = { do_not_launch : bool } |
let default_appl_service_options = { do_not_launch = false } |
let request_template = Eliom_reference . eref ~ scope : Eliom_common . request_scope None |
let global_data_unwrapper = Eliom_wrap . create_unwrapper ( Eliom_wrap . id_of_int Eliom_runtime . global_data_unwrap_id_int ) |
let get_global_data ~ keep_debug = let data = Eliom_syntax . get_global_data ( ) in let data = if keep_debug then data else Eliom_lib . String_map . map ( fun { Eliom_runtime . server_sections_data ; client_sections_data } -> Array . iter ( Array . iter ( fun d -> Eliom_runtime . Cli... |
let transform_global_app_uri = ref ( fun x -> x ) |
module type APP = sig val application_script : ? defer : bool -> ? async : bool -> unit -> [ > ` Script ] Eliom_content . Html . elt val application_name : string val is_initial_request : unit -> bool type app_id type page = Html_types . html Eliom_content . Html . elt type options = appl... |
module App_base ( App_param : Eliom_registration_sigs . APP_PARAM ) = struct type app_id type page = Html_types . html Eliom_content . Html . elt type options = appl_service_options type result = app_id application_content kind let result_of_http_result = Result_types . cast_result let is_initial_re... |
module App ( App_param : Eliom_registration_sigs . APP_PARAM ) = struct module Base = App_base ( App_param ) type app_id = Base . app_id let is_initial_request = Base . is_initial_request let application_script = Base . application_script include Eliom_mkreg . Make ( Base ) let application_n... |
module type TMPL_PARAMS = sig type t val name : string val make_page : t -> Html_types . html Eliom_content . Html . elt Lwt . t val update : t -> unit Eliom_client_value . t end |
module Eliom_tmpl_reg_make_param ( Appl : APP ) ( Tmpl_param : TMPL_PARAMS ) = struct type page = Tmpl_param . t type options = appl_service_options type result = Appl . app_id application_content kind let result_of_http_result = Result_types . cast_result let send_appl_content = Eliom_service . ... |
module Eliom_tmpl ( App : APP ) ( Tmpl_param : TMPL_PARAMS ) = Eliom_mkreg . Make ( Eliom_tmpl_reg_make_param ( App ) ( Tmpl_param ) ) |
type redirection_options = [ ` MovedPermanently | ` Found | ` SeeOther | ` NotNodifed | ` UseProxy | ` TemporaryRedirect ] |
let status_of_redirection_options options code = match code with | Some code -> Cohttp . Code . status_of_code code | None -> ( match ( options : redirection_options ) with | ` MovedPermanently -> ` Moved_permanently | ` Found -> ` Found | ` SeeOther -> ` See_other | ` NotNodifed -... |
module String_redirection_base = struct type page = Eliom_lib . Url . uri type options = redirection_options type result = browser_content kind let result_of_http_result = Result_types . cast_result let send_appl_content = Eliom_service . XAlways let send ( ? options = ` Found ) ? charset ? code... |
module String_redirection = Eliom_mkreg . Make ( String_redirection_base ) |
type _ redirection = | Redirection : ( unit , unit , Eliom_service . get , _ , _ , _ , _ , [ ` WithoutSuffix ] , unit , unit , ' a ) Eliom_service . t -> ' a redirection |
module Redirection_base = struct type ' a page = ' a redirection type options = redirection_options type ' a return = ' a let send_appl_content = Eliom_service . XAlways let send ( ? options = ` Found ) ? charset ? code ? content_type ? headers ( Redirection service ) = let uri = Eliom_... |
module Redirection = struct include Eliom_mkreg . Make_poly ( Redirection_base ) let send ? options ? charset ? code ? content_type ? headers content = Result_types . cast_result_lwt ( Redirection_base . send ? options ? charset ? code ? content_type ? headers content ) end |
let set_exn_handler h = let sitedata = Eliom_request_info . find_sitedata " set_exn_handler " in Eliom_request_info . set_site_handler sitedata ( Result_types . cast_function_http h ) |
let extension = Ocsigen_server . Site . create_extension_intrusive ( fun vh conf_info site_dir -> let sitedata = Eliommod . create_sitedata vh site_dir conf_info in Eliom_common . absolute_change_sitedata sitedata ; Eliom_common . begin_load_eliom_module ( ) ; Eliommod . site_init ( ref true ... |
let section = Lwt_log . Section . make " eliom : request " |
let short_url_re = new % js Js . regExp ( Js . bytestring " ( [ ] ) ( ( . ) ) " ) ^^\\?*\\?*?$ |
let get_cookie_info_for_uri_js uri_js = match Url . url_of_string ( Js . to_string uri_js ) with | None -> Js . Opt . case short_url_re ## ( exec uri_js ) ( fun ( ) -> assert false ) ( fun res -> let match_result = Js . match_result res in let path = Url . path_of_path_string ( J... |
let get_cookie_info_for_uri uri = let uri_js = Js . bytestring uri in get_cookie_info_for_uri_js uri_js |
type ' a result = XmlHttpRequest . http_frame -> ' a |
let xml_result x = match x . XmlHttpRequest . content_xml ( ) with | None -> raise Non_xml_content | Some v -> v |
let string_result x = x . XmlHttpRequest . content |
let redirect_get ? window_name ? window_features url = match window_name with | None -> Dom_html . window . ## location . ## href := Js . string url | Some window_name -> ignore Dom_html . window ## ( open_ ( Js . string url ) ( Js . string window_name ) ( Js . Opt . map ( Js ... |
let redirect_post ? window_name url params = let f = Dom_html . createForm Dom_html . document in f . ## action := Js . string url ; f . ## _method := Js . string " post " ; ( match window_name with None -> ( ) | Some wn -> f . ## target := Js . string wn ) ; List . iter... |
let redirect_put ? window_name : _ _url _params = Lwt_log . raise_error ~ section " redirect_put not implemented " |
let redirect_delete ? window_name : _ _url _params = Lwt_log . raise_error ~ section " redirect_delete not implemented " |
let nl_template = Eliom_parameter . make_non_localized_parameters ~ prefix " : eliom " ~ name " : template " ( Eliom_parameter . string " name " ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.