Module type

Module type Eliom_registration.ELIOM_APPL

Documentation

Module type ELIOM_APPL = sig end

val application_script : ?async:bool -> unit -> [> `Script ] Eliom_content.Html5.elt

The function application_name () returns a <script> node that represents the javascript part of the application. If you do not include this script in the <head> node of your page, it will be automatically added at the end of the <head> node.

val application_name : string

Unique identifier for this application. Currently, it is just the application name as defined by Appl_params.application_name .

Warning: do not mix up with the "application instance id", that is unique for each instance of the application on a client.

val is_initial_request : unit -> bool

Checks during a request whether it is the initial request of the client process in this Eliom application.

type appl

The type appl is an abstract type for identifying an application. It usually used a phantom parameter for Eliom_registration.application_content .

=== Service registration ===

val register : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> service:('get, 'post, [< Eliom_service.internal_service_kind ], [< Eliom_service.suff ], 'gn, 'pn, [ `Registrable ], [< Eliom_service.non_ocaml_service ]) Eliom_service.service -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> 'post -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> unit

The function register service handler will associate the service to the function handler . The handler function take two parameters, the GET and POST parameters of the current HTTP request, and should returns the corresponding page.

The optional parameter ~scope is Eliom_common.global_scope by default, see the Eliom manual for detailled description .

The optional parameter ~options is specific to each output module, see the type description for more information.

The optional parameters ?charset , ?code , ?content_type and ?headers can be used to modify the HTTP answer sent by Eliom. Use this with care.

The optional parameter ~secure_session has no effect for scope Eliom_common.global_scope . With other scopes, the parameter is used to force the session service table in which the handler will be registered. By default, the service is registred in the unsecure session if the current request's protocol is http , or in the secure session if the protocol is https . If set to false (resp. true ) the handler will be stored in the unsecure (resp. secure) session. See the Eliom manual for an introduction to .

The optional parameter ~error_handler is used to specialize the error page when actual parameters aren't compatible with the expected type. The default error handler is fun l -> raise ( Eliom_common.Eliom_Typing_Error l) .

val register_service : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?https:bool -> ?priority:int -> path:Eliom_lib.Url.path -> get_params:('get, [< Eliom_service.suff ] as 'a, 'gn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> unit -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get, unit, [> `Attached of ([> `Internal of [> `Service ] ], [> `Get ]) Eliom_service.a_s ], 'a, 'gn, unit, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.service followed by Eliom_registration.ELIOM_APPL.register .

val register_coservice : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?name:string -> ?csrf_safe:bool -> ?csrf_scope:[< Eliom_common.user_scope ] -> ?csrf_secure:bool -> ?max_use:int -> ?timeout:float -> ?https:bool -> fallback:(unit, unit, [ `Attached of ([ `Internal of [ `Service ] ], [ `Get ]) Eliom_service.a_s ], [ `WithoutSuffix ], unit, unit, [< Eliom_service.registrable ], [< Eliom_service.non_ocaml_service ]) Eliom_service.service -> get_params:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> unit -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get, unit, [> `Attached of ([> `Internal of [> `Coservice ] ], [> `Get ]) Eliom_service.a_s ], [ `WithoutSuffix ], 'gn, unit, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.coservice followed by Eliom_registration.ELIOM_APPL.register .

val register_coservice' : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?name:string -> ?csrf_safe:bool -> ?csrf_scope:[< Eliom_common.user_scope ] -> ?csrf_secure:bool -> ?max_use:int -> ?timeout:float -> ?https:bool -> get_params:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> unit -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get, unit, [> `Nonattached of [> `Get ] Eliom_service.na_s ], [ `WithoutSuffix ], 'gn, unit, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.coservice' followed by Eliom_registration.ELIOM_APPL.register .

val register_post_service : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?https:bool -> ?priority:int -> fallback:('get, unit, [ `Attached of ([ `Internal of [ `Coservice | `Service ] ], [ `Get ]) Eliom_service.a_s ], [< Eliom_service.suff ] as 'a, 'gn, unit, [< `Registrable ], [< Eliom_service.non_ocaml_service ]) Eliom_service.service -> post_params:('post, [ `WithoutSuffix ], 'pn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> 'post -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get, 'post, [> `Attached of ([> `Internal of [ `Coservice | `Service ] ], [> `Post ]) Eliom_service.a_s ], 'a, 'gn, 'pn, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.post_service followed by Eliom_registration.ELIOM_APPL.register .

val register_post_coservice : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?name:string -> ?csrf_safe:bool -> ?csrf_scope:[< Eliom_common.user_scope ] -> ?csrf_secure:bool -> ?max_use:int -> ?timeout:float -> ?https:bool -> fallback:('get, unit, [ `Attached of ([ `Internal of [< `Coservice | `Service ] ], [ `Get ]) Eliom_service.a_s ], [< Eliom_service.suff ] as 'a, 'gn, unit, [< `Registrable ], [< Eliom_service.non_ocaml_service ]) Eliom_service.service -> post_params:('post, [ `WithoutSuffix ], 'pn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> 'post -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get, 'post, [> `Attached of ([> `Internal of [> `Coservice ] ], [> `Post ]) Eliom_service.a_s ], 'a, 'gn, 'pn, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.post_coservice followed by Eliom_registration.ELIOM_APPL.register .

val register_post_coservice' : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?name:string -> ?csrf_safe:bool -> ?csrf_scope:[< Eliom_common.user_scope ] -> ?csrf_secure:bool -> ?max_use:int -> ?timeout:float -> ?keep_get_na_params:bool -> ?https:bool -> post_params:('post, [ `WithoutSuffix ], 'pn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> (unit -> 'post -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> (unit, 'post, [> `Nonattached of [> `Post ] Eliom_service.na_s ], [ `WithoutSuffix ], unit, 'pn, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.post_coservice' followed by Eliom_registration.ELIOM_APPL.register .

val register_put_service : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?https:bool -> ?priority:int -> path:Eliom_lib.Url.path -> get_params:('get, [< Eliom_service.suff ] as 'a, 'gn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> Eliom_parameter.raw_post_data -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get, Eliom_parameter.raw_post_data, [> `Attached of ([> `Internal of [> `Service ] ], [> `Put ]) Eliom_service.a_s ], 'a, 'gn, Eliom_parameter.no_param_name, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.put_service followed by Eliom_registration.ELIOM_APPL.register .

val register_put_coservice : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?name:string -> ?csrf_safe:bool -> ?csrf_scope:[< Eliom_common.user_scope ] -> ?csrf_secure:bool -> ?max_use:int -> ?timeout:float -> ?https:bool -> fallback:(unit, Eliom_parameter.raw_post_data, [ `Attached of ([ `Internal of [ `Service ] ], [ `Put ]) Eliom_service.a_s ], [ `WithoutSuffix ], unit, Eliom_parameter.no_param_name, [< Eliom_service.registrable ], [< Eliom_service.non_ocaml_service ]) Eliom_service.service -> get_params:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> Eliom_parameter.raw_post_data -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get, Eliom_parameter.raw_post_data, [> `Attached of ([> `Internal of [> `Coservice ] ], [> `Put ]) Eliom_service.a_s ], [ `WithoutSuffix ], 'gn, Eliom_parameter.no_param_name, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.put_coservice followed by Eliom_registration.ELIOM_APPL.register .

val register_put_coservice' : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?name:string -> ?csrf_safe:bool -> ?csrf_scope:[< Eliom_common.user_scope ] -> ?csrf_secure:bool -> ?max_use:int -> ?timeout:float -> ?https:bool -> get_params:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> Eliom_parameter.raw_post_data -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get, Eliom_parameter.raw_post_data, [> `Nonattached of [> `Put ] Eliom_service.na_s ], [ `WithoutSuffix ], 'gn, Eliom_parameter.no_param_name, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.put_coservice' followed by Eliom_registration.ELIOM_APPL.register .

val register_delete_service : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?https:bool -> ?priority:int -> path:Eliom_lib.Url.path -> get_params:('get, [< Eliom_service.suff ] as 'a, 'gn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> Eliom_parameter.raw_post_data -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get, Eliom_parameter.raw_post_data, [> `Attached of ([> `Internal of [> `Service ] ], [> `Delete ]) Eliom_service.a_s ], 'a, 'gn, Eliom_parameter.no_param_name, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.delete_service followed by Eliom_registration.ELIOM_APPL.register .

val register_delete_coservice : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?name:string -> ?csrf_safe:bool -> ?csrf_scope:[< Eliom_common.user_scope ] -> ?csrf_secure:bool -> ?max_use:int -> ?timeout:float -> ?https:bool -> fallback:(unit, Eliom_parameter.raw_post_data, [ `Attached of ([ `Internal of [ `Service ] ], [ `Delete ]) Eliom_service.a_s ], [ `WithoutSuffix ], unit, Eliom_parameter.no_param_name, [< Eliom_service.registrable ], [< Eliom_service.non_ocaml_service ]) Eliom_service.service -> get_params:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> Eliom_parameter.raw_post_data -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get, Eliom_parameter.raw_post_data, [> `Attached of ([> `Internal of [> `Coservice ] ], [> `Delete ]) Eliom_service.a_s ], [ `WithoutSuffix ], 'gn, Eliom_parameter.no_param_name, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.delete_coservice followed by Eliom_registration.ELIOM_APPL.register .

val register_delete_coservice' : ?scope:[< Eliom_common.scope ] -> ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> ?secure_session:bool -> ?name:string -> ?csrf_safe:bool -> ?csrf_scope:[< Eliom_common.user_scope ] -> ?csrf_secure:bool -> ?max_use:int -> ?timeout:float -> ?https:bool -> get_params:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type -> ?error_handler:((string * exn) list -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get -> Eliom_parameter.raw_post_data -> Html5_types.html Eliom_content.Html5.elt Lwt.t) -> ('get, Eliom_parameter.raw_post_data, [> `Nonattached of [> `Delete ] Eliom_service.na_s ], [ `WithoutSuffix ], 'gn, Eliom_parameter.no_param_name, [< Eliom_service.registrable > `Registrable ], [> Eliom_service.appl_service ]) Eliom_service.service

Same as Eliom_service.Http.delete_coservice' followed by Eliom_registration.ELIOM_APPL.register .

=== Low-level function ===

val send : ?options:Eliom_registration.appl_service_options -> ?charset:string -> ?code:int -> ?content_type:string -> ?headers:Http_headers.t -> Html5_types.html Eliom_content.Html5.elt -> appl Eliom_registration.application_content Eliom_registration.kind Lwt.t

The function send page build the HTTP frame corresponding to page . This may be used for example in an service handler registered with Eliom_registration.Any.register or when building a custom output module.