module Eliom_registration:Eliom services registration for various kinds of page content: Eliom application, validsig
..end
Eliom_registration.Html5
or Eliom_registration.Xhtml
,
actions, redirections, static files, …type ('a, 'b)
kind
kind
is an abstract type for the HTTP frame returned by
a service. The type parameters are phantom types describing the
content of the frame:
Eliom_service.service
. Currently, one of the
following types:
Eliom_service.service
typehttp_service =
[ `Http ]
http_service
is used as a phantom type parameters for
Eliom_service.service
and Eliom_registration.kind
. It means the
returned content is classical HTTP content described by the
content type header. See Eliom_registration.kind
for a list of others
return types.typebrowser_content =
[ `Browser ]
browser_content
is a refinement of Eliom_registration.http_service
to
be used as a phantom type parameters for Eliom_registration.kind
. It
means the returned content must be interpreted in the browser as
stated by the content-type header. This is most common return type
for an eliom service, see for example Eliom_registration.Html5
,
Eliom_registration.Xhtml
, Eliom_registration.CssText
, Eliom_registration.File
,
Eliom_registration.Redirection
, ….type
block_content
block_content
is a refinement of Eliom_registration.http_service
to be
used as a phantom type parameters for Eliom_registration.kind
. It
means the returned content is a subtree of an XML value. See for
example Eliom_registration.Block5
or Eliom_registration.Make_typed_xml_registration
.type
unknown_content
unknown_content
is a refinement of Eliom_registration.http_service
to
be used as a phantom type parameters for Eliom_registration.kind
when
the content-type can't be determined staticaly. See Eliom_registration.Text
or
Eliom_registration.Any
.typeappl_service =
[ `Appl ]
appl_service
is used as a phantom type parameters for
Eliom_service.service
and Eliom_registration.kind
. It means the
service is part of an Eliom application. See Eliom_registration.kind
for a list of others return types.type'a
application_content =[ `Appl of 'a ]
application_content
is a refinement of Eliom_registration.appl_service
to be used as a phantom type parameters for Eliom_registration.kind
. The
parameter 'a
is phantom type that is unique for a given
application.type 'a
caml_content
caml_content
is an synomyn for Eliom_parameter.caml
to be used as a phantom type parameters for Eliom_registration.kind
. See
Eliom_registration.Ocaml
.typenon_caml_service =
[ `Appl | `Http ]
non_caml_service
is used as phantom type parameters for
the Eliom_registration.kind
. It used to type functions that operates
over service that do not returns OCaml values, like
Eliom_registration.appl_self_redirect
.module type Registration =sig
..end
module Html5_registration:sig
..end
module Html5:sig
..end
module Xhtml:sig
..end
module Xhtml_registration:sig
..end
module type APPL_PARAMS =sig
..end
type
appl_service_options = {
|
do_not_launch : |
If you set do_not_launch
to true
when creating an application
service, it will send the page without launching the client side
program. However, if the program is already lanched, the client
side process won't be stopped. Use this if some of your pages are
not using the client side program and you want to make them load
faster.
false
.val default_appl_service_options : appl_service_options
Eliom_registration.appl_service_options
.module type ELIOM_APPL =sig
..end
module App:
module type TMPL_PARAMS =sig
..end
module Eliom_tmpl:
module Flow5:sig
..end
module Block5:sig
..end
Eliom_registration.Flow5
.
module Block:sig
..end
module Make_typed_xml_registration:functor (
Xml
:
Xml_sigs.Iterable
) ->
functor (
Typed_xml
:
Xml_sigs.Typed_xml
with module Xml := Xml
) ->
module Html_text:sig
..end
module CssText:sig
..end
module Action:sig
..end
module Unit:sig
..end
Actions
with `NoReload
option.
module Redirection:sig
..end
module String_redirection:sig
..end
module File:sig
..end
module Ocaml:sig
..end
module Any:sig
..end
val appl_self_redirect : ('a ->
([< `Appl of 'b | `Browser ], [< non_caml_service ])
kind Lwt.t) ->
'a ->
('c application_content, appl_service)
kind Lwt.t
appl_self_redirect send page
is an helper function
required for defining Eliom_registration.Any
service usable inside an Eliom
application (Eliom_registration.App
). It allows to cast an Eliom senders
that do not returns Eliom_registration.application_content
(like Eliom_registration.File.send
,
Eliom_registration.String.send
, ...) into a senders returns
Eliom_registration.application_content
.
When the service is called from an Eliom application, this is
implemented with half-redirection (a redirection that leaves
the application). Hence, the service may be called two times in a
row and you should not use this function for service that use POST
parameters.
module String:sig
..end
module Text:sig
..end
Eliom_registration.String
.
module Streamlist:sig
..end
module Customize:functor (
R
:
Registration
) ->
functor (
T
:
sig
type
page
val translate :page -> R.page Lwt.t
end
) ->
Registration
with type options := R.options and type return := R.return and type page := T.page and type result := R.result
Customize
functor allows to specialize service registration
functions by customizing the page type.
val set_exn_handler : (exn ->
(browser_content, http_service)
kind Lwt.t) ->
unit
set_exn_handler handler
allows to redefines error pages:
404
or any exception during page generation.
Note that you should not catch every exception here since some Eliom
mechanisms are done using exceptions, like redirections.
Do not catch exception defined in Eliom except Eliom_common.Eliom_404
,
Eliom_common.Eliom_Wrong_parameter
Eliom_common.Eliom_Typing_Error
.
Warning: This functions must be called when the site
information is available, that is, either during a request or
during the initialisation phase of the site. Otherwise, it will
raise the exception
Eliom_common.Eliom_site_information_not_available
. If you are
using static linking, you must delay the call to this function
until the configuration file is read, using
Eliom_service.register_eliom_module
. Otherwise you will also
get this exception.
val cast_unknown_content_kind : (unknown_content, http_service)
kind ->
('a, http_service) kind
val cast_http_result : Ocsigen_http_frame.result -> ('a, 'b) kind
Text.send
or
Streamlist.send
is the same as some other kind, you can cast
it with cast_unknown_content_kind
for use with Any
module.