Module type Eliom_mkreg.ELIOMREGSIG1
module type ELIOMREGSIG1 = sig..end
type page
type options
val send :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
sp:Eliom_sessions.server_params ->
page -> Ocsigen_http_frame.result Lwt.t
val register :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?sp:Eliom_sessions.server_params ->
service:('a, 'b, [< Eliom_services.internal_service_kind ],
[< Eliom_services.suff ], 'c, 'd, [ `Registrable ])
Eliom_services.service ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
'a -> 'b -> page Lwt.t) ->
unit
registers an service in the public service table
with the associated handler function.
register service t f will associate the service service
to the function f.
f is the function that creates a page, called service handler.
That function takes three parameters.* The first one has type Eliom_sessions.server_params and allows to have acces to informations about the request and the session.
- The second and third ones are respectively GET and POST parameters.
For example if t is Eliom_parameters.int "s", then 'get is int.
Warning: If you want to register a service in the global table
after the initialisation phase,
you must give the ~sp parameter, otherwise it will raise the
exception Eliom_common.Eliom_function_forbidden_outside_site_loading.
Registering services and coservices is always done in memory as there is
no means of marshalling closures.
Registering after initialization is not encouraged for coservices
without timeout, as such services will be available only until the end
of the server process!
If you use that for main services, you will dynamically create new URLs!
This may be dangerous as they will disappear if you stop the server.
Be very careful to re-create these URLs when you relaunch the server,
otherwise, some external links or bookmarks may be broken!
Some output modules (for example Redirectmod) define their own options
for that function.
Use the ?options parameter to set them.
val register_for_session :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?session_name:string ->
?secure:bool ->
sp:Eliom_sessions.server_params ->
service:('a, 'b, [< Eliom_services.internal_service_kind ],
[< Eliom_services.suff ], 'c, 'd, [ `Registrable ])
Eliom_services.service ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
'a -> 'b -> page Lwt.t) ->
unit
registers a handler for a service in the session table.
If the same client does a request to this service, this function will be
used instead of the one from the public table.
Warning:* All main services created during initialization must be registered in the public table during initialisation, but never after,
- You can't register a service in a session table when no session is active (i.e. outside a service handler, when you do not have sp)
?session_name is the name of the session, if you want several
service sessions on the same site.
If ~secure is false when the protocol is https, the service will be
registered in the unsecure session,
otherwise in the secure session with https, the unsecure one with http.
(Secure session means that Eliom will ask the browser to send the cookie
only through HTTPS).
Note that in the case of CSRF safe coservices, parameters
?session_name and ?secure must match exactly the session name
and secure option specified while creating the CSRF safe service.
Otherwise, the registration will fail
with
val register_new_service :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?sp:Eliom_sessions.server_params ->
?https:bool ->
path:Ocsigen_lib.url_path ->
get_params:('a, [< Eliom_services.suff ] as 'b, 'c)
Eliom_parameters.params_type ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
'a -> unit -> page Lwt.t) ->
('a, unit,
[> `Attached of
[> `Internal of [> `Service ] * [> `Get ] ] Eliom_services.a_s ],
'b, 'c, unit, [> `Registrable ])
Eliom_services.service
Same as new_service followed by register
val register_new_coservice :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?sp:Eliom_sessions.server_params ->
?name:string ->
?csrf_safe:bool ->
?csrf_session_name:string ->
?csrf_secure_session:bool ->
?max_use:int ->
?timeout:float ->
?https:bool ->
fallback:(unit, unit,
[ `Attached of
[ `Internal of [ `Service ] * [ `Get ] ] Eliom_services.a_s ],
[ `WithoutSuffix ], unit, unit, [< Eliom_services.registrable ])
Eliom_services.service ->
get_params:('a, [ `WithoutSuffix ], 'b) Eliom_parameters.params_type ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
'a -> unit -> page Lwt.t) ->
('a, unit,
[> `Attached of
[> `Internal of [> `Coservice ] * [> `Get ] ] Eliom_services.a_s ],
[ `WithoutSuffix ], 'b, unit, [> `Registrable ])
Eliom_services.service
Same as new_coservice followed by register
val register_new_coservice' :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?sp:Eliom_sessions.server_params ->
?name:string ->
?csrf_safe:bool ->
?csrf_session_name:string ->
?csrf_secure_session:bool ->
?max_use:int ->
?timeout:float ->
?https:bool ->
get_params:('a, [ `WithoutSuffix ], 'b) Eliom_parameters.params_type ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
'a -> unit -> page Lwt.t) ->
('a, unit, [> `Nonattached of [> `Get ] Eliom_services.na_s ],
[ `WithoutSuffix ], 'b, unit, [> `Registrable ])
Eliom_services.service
Same as new_coservice' followed by register
val register_new_coservice_for_session :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?session_name:string ->
?secure:bool ->
sp:Eliom_sessions.server_params ->
?name:string ->
?csrf_safe:bool ->
?max_use:int ->
?timeout:float ->
?https:bool ->
fallback:(unit, unit,
[ `Attached of
[ `Internal of [ `Service ] * [ `Get ] ] Eliom_services.a_s ],
[ `WithoutSuffix ], unit, unit, [< Eliom_services.registrable ])
Eliom_services.service ->
get_params:('a, [ `WithoutSuffix ], 'b) Eliom_parameters.params_type ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
'a -> unit -> page Lwt.t) ->
('a, unit,
[> `Attached of
[> `Internal of [> `Coservice ] * [> `Get ] ] Eliom_services.a_s ],
[ `WithoutSuffix ], 'b, unit, [> `Registrable ])
Eliom_services.service
Same as new_coservice followed by register_for_session
val register_new_coservice_for_session' :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?session_name:string ->
?secure:bool ->
sp:Eliom_sessions.server_params ->
?name:string ->
?csrf_safe:bool ->
?max_use:int ->
?timeout:float ->
?https:bool ->
get_params:('a, [ `WithoutSuffix ], 'b) Eliom_parameters.params_type ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
'a -> unit -> page Lwt.t) ->
('a, unit, [> `Nonattached of [> `Get ] Eliom_services.na_s ],
[ `WithoutSuffix ], 'b, unit, [> `Registrable ])
Eliom_services.service
Same as new_coservice' followed by register_for_session
val register_new_post_service :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?sp:Eliom_sessions.server_params ->
?https:bool ->
fallback:('a, unit,
[ `Attached of
[ `Internal of [ `Coservice | `Service ] * [ `Get ] ]
Eliom_services.a_s ],
[< Eliom_services.suff ] as 'b, 'c, unit, [< `Registrable ])
Eliom_services.service ->
post_params:('d, [ `WithoutSuffix ], 'e) Eliom_parameters.params_type ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
'a -> 'd -> page Lwt.t) ->
('a, 'd,
[> `Attached of
[> `Internal of [ `Coservice | `Service ] * [> `Post ] ]
Eliom_services.a_s ],
'b, 'c, 'e, [> `Registrable ])
Eliom_services.service
Same as new_post_service followed by register
val register_new_post_coservice :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?sp:Eliom_sessions.server_params ->
?name:string ->
?csrf_safe:bool ->
?csrf_session_name:string ->
?csrf_secure_session:bool ->
?max_use:int ->
?timeout:float ->
?https:bool ->
fallback:('a, unit,
[ `Attached of
[ `Internal of [< `Coservice | `Service ] * [ `Get ] ]
Eliom_services.a_s ],
[< Eliom_services.suff ] as 'b, 'c, unit, [< `Registrable ])
Eliom_services.service ->
post_params:('d, [ `WithoutSuffix ], 'e) Eliom_parameters.params_type ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
'a -> 'd -> page Lwt.t) ->
('a, 'd,
[> `Attached of
[> `Internal of [> `Coservice ] * [> `Post ] ] Eliom_services.a_s ],
'b, 'c, 'e, [> `Registrable ])
Eliom_services.service
Same as new_post_coservice followed by register
val register_new_post_coservice' :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?sp:Eliom_sessions.server_params ->
?name:string ->
?csrf_safe:bool ->
?csrf_session_name:string ->
?csrf_secure_session:bool ->
?max_use:int ->
?timeout:float ->
?keep_get_na_params:bool ->
?https:bool ->
post_params:('a, [ `WithoutSuffix ], 'b) Eliom_parameters.params_type ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
unit -> 'a -> page Lwt.t) ->
(unit, 'a, [> `Nonattached of [> `Post ] Eliom_services.na_s ],
[ `WithoutSuffix ], unit, 'b, [> `Registrable ])
Eliom_services.service
Same as new_post_coservice' followed by register
val register_new_post_coservice_for_session :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?session_name:string ->
?secure:bool ->
sp:Eliom_sessions.server_params ->
?name:string ->
?csrf_safe:bool ->
?max_use:int ->
?timeout:float ->
?https:bool ->
fallback:('a, unit,
[ `Attached of
[ `Internal of [< `Coservice | `Service ] * [ `Get ] ]
Eliom_services.a_s ],
[< Eliom_services.suff ] as 'b, 'c, unit, [ `Registrable ])
Eliom_services.service ->
post_params:('d, [ `WithoutSuffix ], 'e) Eliom_parameters.params_type ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
'a -> 'd -> page Lwt.t) ->
('a, 'd,
[> `Attached of
[> `Internal of [> `Coservice ] * [> `Post ] ] Eliom_services.a_s ],
'b, 'c, 'e, [> `Registrable ])
Eliom_services.service
Same as new_post_coservice followed by register_for_session
val register_new_post_coservice_for_session' :
?options:options ->
?cookies:Eliom_services.cookie list ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?session_name:string ->
?secure:bool ->
sp:Eliom_sessions.server_params ->
?name:string ->
?csrf_safe:bool ->
?max_use:int ->
?timeout:float ->
?keep_get_na_params:bool ->
?https:bool ->
post_params:('a, [ `WithoutSuffix ], 'b) Eliom_parameters.params_type ->
?error_handler:(Eliom_sessions.server_params ->
(string * exn) list -> page Lwt.t) ->
(Eliom_sessions.server_params ->
unit -> 'a -> page Lwt.t) ->
(unit, 'a, [> `Nonattached of [> `Post ] Eliom_services.na_s ],
[ `WithoutSuffix ], unit, 'b, [> `Registrable ])
Eliom_services.service
Same as new_post_coservice' followed by register_for_session