Module Eliom_atom.Reg
module Reg : sig..end
type page = Atom_feed.feed
type options = unit
type return = Eliom_output.http_service
type result =
(Eliom_output.browser_content, Eliom_output.http_service)
Eliom_output.kind
val send :
?options:unit ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
Atom_feed.feed ->
(Eliom_output.browser_content, Eliom_output.http_service)
Eliom_output.kind Lwt.t
val register :
?scope:[< Eliom_common.scope ] ->
?options:unit ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?secure_session:bool ->
service:('a, 'b, [< Eliom_services.internal_service_kind ],
[< Eliom_services.suff ], 'c, 'd, [ `Registrable ],
Eliom_output.http_service)
Eliom_services.service ->
?error_handler:((string * exn) list -> Atom_feed.feed Lwt.t) ->
('a -> 'b -> Atom_feed.feed Lwt.t) -> unit
Register a service with the associated handler function.
register s t f will associate the service s to the function f.
f is the function that creates a page, called service handler.
The handler function takes two parameters.* The second and third ones are respectively GET and POST parameters.
For example if t is Eliom_parameters.int "s", then 'get is int.
The ?scope optional parameter is Eliom_common.global by default, which means that the
service will be registered in the global table and be available to any client.
If you want to restrict the visibility of the service to a browser session,
use ~scope:Eliom_common.session.
If you want to restrict the visibility of the service to a group of sessions,
use ~scope:Eliom_common.session_group.
If you have a client side Eliom program running, and you want to restrict
the visibility of the service to this instance of the program,
use ~scope:Eliom_common.client_process. You can create new scopes with
Eliom_common.create_session_group_scope, Eliom_common.create_session_scope
and Eliom_common.create_client_process_scope if you want several service
sessions on the same site.
If the same service is registered several times with different visibilities,
Eliom will choose the service for handling a request in that order:
`Client_process, `Session, `Session_group and finally `Global. It means for example
that you can register a specialized version of a public service for a session.
Warning: All public services created during initialization must be
registered in the public table during initialisation, never after,
Registering services and coservices is always done in memory as there is
no means of marshalling closures.
If you register new services dynamically, be aware that they will disappear
if you stop the server. If you create dynamically new URLs,
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.
The optional parameters ?charset, ?code, ?content_type and ?headers
can be used to modify the HTTP answer sent by Eliom. Use this with care.
If ~secure_session 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). It has no effect for scope `Global.
Note that in the case of CSRF safe coservices, parameters
?scope and ?secure_session must match exactly the scope
and secure option specified while creating the CSRF safe service.
Otherwise, the registration will fail
with
val register_service :
?scope:[< Eliom_common.scope ] ->
?options:unit ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?secure_session:bool ->
?https:bool ->
?priority:int ->
path:Eliom_pervasives.Url.path ->
get_params:('a, [< Eliom_services.suff ] as 'b, 'c)
Eliom_parameters.params_type ->
?error_handler:((string * exn) list -> Atom_feed.feed Lwt.t) ->
('a -> unit -> Atom_feed.feed Lwt.t) ->
('a, unit,
[> `Attached of
([> `Internal of [> `Service ] ], [> `Get ]) Eliom_services.a_s ],
'b, 'c, unit, [> `Registrable ], Eliom_output.http_service)
Eliom_services.service
Same as service followed by register
val register_coservice :
?scope:[< Eliom_common.scope ] ->
?options:unit ->
?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_services.a_s ],
[ `WithoutSuffix ], unit, unit,
[< Eliom_services.registrable ], Eliom_output.http_service)
Eliom_services.service ->
get_params:('a, [ `WithoutSuffix ], 'b) Eliom_parameters.params_type ->
?error_handler:((string * exn) list -> Atom_feed.feed Lwt.t) ->
('a -> unit -> Atom_feed.feed Lwt.t) ->
('a, unit,
[> `Attached of
([> `Internal of [> `Coservice ] ], [> `Get ])
Eliom_services.a_s ],
[ `WithoutSuffix ], 'b, unit, [> `Registrable ],
Eliom_output.http_service)
Eliom_services.service
Same as coservice followed by register
val register_coservice' :
?scope:[< Eliom_common.scope ] ->
?options:unit ->
?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:('a, [ `WithoutSuffix ], 'b) Eliom_parameters.params_type ->
?error_handler:((string * exn) list -> Atom_feed.feed Lwt.t) ->
('a -> unit -> Atom_feed.feed Lwt.t) ->
('a, unit, [> `Nonattached of [> `Get ] Eliom_services.na_s ],
[ `WithoutSuffix ], 'b, unit, [> `Registrable ],
Eliom_output.http_service)
Eliom_services.service
Same as coservice' followed by register
val register_post_service :
?scope:[< Eliom_common.scope ] ->
?options:unit ->
?charset:string ->
?code:int ->
?content_type:string ->
?headers:Http_headers.t ->
?secure_session:bool ->
?https:bool ->
?priority:int ->
fallback:('a, unit,
[ `Attached of
([ `Internal of [ `Coservice | `Service ] ], [ `Get ])
Eliom_services.a_s ],
[< Eliom_services.suff ] as 'b, 'c, unit, [<
`Registrable ], 'd)
Eliom_services.service ->
post_params:('e, [ `WithoutSuffix ], 'f) Eliom_parameters.params_type ->
?error_handler:((string * exn) list -> Atom_feed.feed Lwt.t) ->
('a -> 'e -> Atom_feed.feed Lwt.t) ->
('a, 'e,
[> `Attached of
([> `Internal of [ `Coservice | `Service ] ], [> `Post ])
Eliom_services.a_s ],
'b, 'c, 'f, [> `Registrable ], Eliom_output.http_service)
Eliom_services.service
Same as post_service followed by register
val register_post_coservice :
?scope:[< Eliom_common.scope ] ->
?options:unit ->
?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:('a, unit,
[ `Attached of
([ `Internal of [< `Coservice | `Service ] ], [ `Get ])
Eliom_services.a_s ],
[< Eliom_services.suff ] as 'b, 'c, unit, [<
`Registrable ], Eliom_output.http_service)
Eliom_services.service ->
post_params:('d, [ `WithoutSuffix ], 'e) Eliom_parameters.params_type ->
?error_handler:((string * exn) list -> Atom_feed.feed Lwt.t) ->
('a -> 'd -> Atom_feed.feed Lwt.t) ->
('a, 'd,
[> `Attached of
([> `Internal of [> `Coservice ] ], [> `Post ])
Eliom_services.a_s ],
'b, 'c, 'e, [> `Registrable ], Eliom_output.http_service)
Eliom_services.service
Same as post_coservice followed by register
val register_post_coservice' :
?scope:[< Eliom_common.scope ] ->
?options:unit ->
?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:('a, [ `WithoutSuffix ], 'b) Eliom_parameters.params_type ->
?error_handler:((string * exn) list -> Atom_feed.feed Lwt.t) ->
(unit -> 'a -> Atom_feed.feed Lwt.t) ->
(unit, 'a, [> `Nonattached of [> `Post ] Eliom_services.na_s ],
[ `WithoutSuffix ], unit, 'b, [> `Registrable ],
Eliom_output.http_service)
Eliom_services.service
Same as post_coservice' followed by register
