NAME¶
Eliom_registration.Streamlist - Eliom service registration for services that
returns "byte" contents with {% <<a_api
project="ocsigenserver" text="Ocsigen's streams"| module
Ocsigen_stream>> %}.
Module¶
Module Eliom_registration.Streamlist
Documentation¶
Module
Streamlist
:
sig end
Eliom service registration for services that returns "byte" contents
with . The page content is a couple
(stream_creator_list, content_type)
. See also
Eliom_registration.String for another kind of service that
returns "byte" contents.
Streams are created by calling the functions in the list and is called at the
end of the stream. If something goes wrong while processing a stream, the
current stream is closed and the following streams are not created.
=== Service registration ===
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_service.internal_service_kind ], [< Eliom_service.suff ], 'c,
'd, [ `Registrable ], Eliom_registration.http_service)
Eliom_service.service -> ?error_handler:((string * exn) list
-> ((unit -> string Ocsigen_stream.t Lwt.t) list * string) Lwt.t)
-> ('a -> 'b -> ((unit -> string Ocsigen_stream.t Lwt.t)
list * string) 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 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 . 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:unit -> ?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:('a, [<
Eliom_service.suff ] as 'b, 'c) Eliom_parameter.params_type ->
?error_handler:((string * exn) list -> ((unit -> string
Ocsigen_stream.t Lwt.t) list * string) Lwt.t) -> ('a -> unit
-> ((unit -> string Ocsigen_stream.t Lwt.t) list * string) Lwt.t)
-> ('a, unit, [> `Attached of ([> `Internal of
[> `Service ] ], [> `Get ]) Eliom_service.a_s ], 'b, 'c, unit,
[< Eliom_service.registrable > `Registrable ],
Eliom_registration.http_service) Eliom_service.service
Same as
Eliom_service.service followed by
Eliom_registration.Streamlist.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_service.a_s ],
[ `WithoutSuffix ], unit, unit, [< Eliom_service.registrable ],
Eliom_registration.http_service) Eliom_service.service ->
get_params:('a, [ `WithoutSuffix ], 'b) Eliom_parameter.params_type
-> ?error_handler:((string * exn) list -> ((unit ->
string Ocsigen_stream.t Lwt.t) list * string) Lwt.t) -> ('a ->
unit -> ((unit -> string Ocsigen_stream.t Lwt.t) list * string) Lwt.t)
-> ('a, unit, [> `Attached of ([> `Internal of
[> `Coservice ] ], [> `Get ]) Eliom_service.a_s ], [
`WithoutSuffix ], 'b, unit, [< Eliom_service.registrable > `Registrable
], Eliom_registration.http_service) Eliom_service.service
Same as
Eliom_service.coservice followed by
Eliom_registration.Streamlist.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_parameter.params_type -> ?error_handler:((string * exn) list
-> ((unit -> string Ocsigen_stream.t Lwt.t) list * string) Lwt.t)
-> ('a -> unit -> ((unit -> string Ocsigen_stream.t Lwt.t)
list * string) Lwt.t) -> ('a, unit, [> `Nonattached of [> `Get
] Eliom_service.na_s ], [ `WithoutSuffix ], 'b, unit, [<
Eliom_service.registrable > `Registrable ],
Eliom_registration.http_service) Eliom_service.service
Same as
Eliom_service.coservice' followed by
Eliom_registration.Streamlist.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_service.a_s ], [< Eliom_service.suff ] as 'b, 'c, unit,
[< `Registrable ], 'd) Eliom_service.service ->
post_params:('e, [ `WithoutSuffix ], 'f) Eliom_parameter.params_type
-> ?error_handler:((string * exn) list -> ((unit ->
string Ocsigen_stream.t Lwt.t) list * string) Lwt.t) -> ('a -> 'e
-> ((unit -> string Ocsigen_stream.t Lwt.t) list * string) Lwt.t)
-> ('a, 'e, [> `Attached of ([> `Internal of [
`Coservice | `Service ] ], [> `Post ]) Eliom_service.a_s ],
'b, 'c, 'f, [< Eliom_service.registrable > `Registrable ],
Eliom_registration.http_service) Eliom_service.service
Same as
Eliom_service.post_service followed by
Eliom_registration.Streamlist.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_service.a_s ], [< Eliom_service.suff ]
as 'b, 'c, unit, [< `Registrable ],
Eliom_registration.http_service) Eliom_service.service ->
post_params:('d, [ `WithoutSuffix ], 'e) Eliom_parameter.params_type
-> ?error_handler:((string * exn) list -> ((unit ->
string Ocsigen_stream.t Lwt.t) list * string) Lwt.t) -> ('a -> 'd
-> ((unit -> string Ocsigen_stream.t Lwt.t) list * string) Lwt.t)
-> ('a, 'd, [> `Attached of ([> `Internal of
[> `Coservice ] ], [> `Post ]) Eliom_service.a_s ], 'b, 'c, 'e,
[< Eliom_service.registrable > `Registrable ],
Eliom_registration.http_service) Eliom_service.service
Same as
Eliom_service.post_coservice followed by
Eliom_registration.Streamlist.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_parameter.params_type -> ?error_handler:((string * exn) list
-> ((unit -> string Ocsigen_stream.t Lwt.t) list * string) Lwt.t)
-> (unit -> 'a -> ((unit -> string Ocsigen_stream.t Lwt.t)
list * string) Lwt.t) -> (unit, 'a, [> `Nonattached of [>
`Post ] Eliom_service.na_s ], [ `WithoutSuffix ], unit, 'b, [<
Eliom_service.registrable > `Registrable ],
Eliom_registration.http_service) Eliom_service.service
Same as
Eliom_service.post_coservice' followed by
Eliom_registration.Streamlist.register .
=== Low-level function ===
val send :
?options:unit -> ?charset:string ->
?code:int -> ?content_type:string ->
?headers:Http_headers.t -> (unit -> string Ocsigen_stream.t
Lwt.t) list * string -> (Eliom_registration.unknown_content,
Eliom_registration.http_service) 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.