module Ocsigen:Ocsigen.ml defines the functions you need to interact with the Ocsigenmod module:sig
..end
val get_config : unit -> Simplexmlparser.xml list
Put your options between <module ...> and </module>
val sync : ('a -> 'b -> 'c -> 'd) -> 'a -> 'b -> 'c -> 'd Lwt.t
let sync f sp g p = Lwt.return (f sp g p)
typeservice_kind =
[ `External_Service
| `Internal_Service of [ `Local_Service | `Public_Service ] ]
type ('a, 'b, +'c, +'d, +'e, +'f)
service
'kind
parameter is subset of service_kind. 'get
and 'post
are the type of GET and POST parameters.typeurl_path =
string list
coucou/ciao
is represented by the list ["coucou";"ciao"]
unit
for a page without parameter.(int "myvalue")
for a page that takes one parameter, of type int
, called myvalue
. (You must register a function of type int ->
page
).(int "myvalue" ** string "mystring")
for a page that takes two parameters, one of type int
called myvalue
, and one of type string
called mystring
. (The function you will register has a parameter of type (int * string)
).list "l" (int "myvalue" ** string "mystring")
for a page that takes a list of pairs. (The function you will register has a parameter of type (int * string) list
).type
server_params
val get_user_agent : server_params -> string
val get_hostname : server_params -> string option
val get_full_url : server_params -> string
val get_inet_addr : server_params -> Unix.inet_addr
val get_ip : server_params -> string
val get_port : server_params -> int
val get_get_params : server_params -> (string * string) list
val get_post_params : server_params -> (string * string) list Lwt.t
val get_current_url : server_params -> url_path
val get_tmp_filename : Extensions.file_info -> string
val get_filesize : Extensions.file_info -> int64
val get_original_filename : Extensions.file_info -> string
type ('a, 'b)
binsum =
| |
Inj1 of |
|||
| |
Inj2 of |
(* | Binary sums | *) |
type 'a
param_name
type ('a, 'b, 'c)
params_type
type 'a
listnames = {
|
it : |
val int : string ->
(int, [ `WithoutSuffix ], int param_name) params_type
int s
tells that the page takes an integer as parameter, labeled s
val float : string ->
(float, [ `WithoutSuffix ], float param_name) params_type
float s
tells that the page takes a floating point number as parameter, labeled s
val string : string ->
(string, [ `WithoutSuffix ], string param_name) params_type
string s
tells that the page takes a string as parameter, labeled s
val bool : string ->
(bool, [ `WithoutSuffix ], bool param_name) params_type
bool s
tells that the page takes a boolean as parameter, labeled s
(to use for example with boolean checkboxes)val file : string ->
(Extensions.file_info, [ `WithoutSuffix ],
Extensions.file_info param_name)
params_type
file s
tells that the page takes a file as parameter, labeled s
val radio_answer : string ->
(string option, [ `WithoutSuffix ], string option param_name)
params_type
radio_answer s
tells that the page takes the result of a click on
a radio button as parameter.val unit : (unit, [ `WithoutSuffix ], unit param_name) params_type
val user_type : (string -> 'a) ->
('a -> string) ->
string -> ('a, [ `WithoutSuffix ], 'a param_name) params_type
user_type s_to_t t_to_s s
tells that the page take a parameter, labeled s
, and that the server will have to use s_to_t
and t_to_s
to make the conversion from and to string.val sum : ('a, [ `WithoutSuffix ], 'b) params_type ->
('a, [ `WithoutSuffix ], 'b) params_type ->
(('a, 'a) binsum, [ `WithoutSuffix ], 'b * 'b) params_type
val prod : ('a, [ `WithoutSuffix ], 'b) params_type ->
('c, [ `WithoutSuffix ], 'd) params_type ->
('a * 'c, [ `WithoutSuffix ], 'b * 'd) params_type
**
aboveval opt : ('a, [ `WithoutSuffix ], 'b) params_type ->
('a option, [ `WithoutSuffix ], 'b) params_type
val list : string ->
('a, [ `WithoutSuffix ], 'b) params_type ->
('a list, [ `WithoutSuffix ], 'b listnames) params_type
val (**) : ('a, [ `WithoutSuffix ], 'b) params_type ->
('c, [ `WithoutSuffix ], 'd) params_type ->
('a * 'c, [ `WithoutSuffix ], 'b * 'd) params_type
val suffix_only : (string, [ `WithSuffix ], string param_name) params_type
register_new_service
)val suffix : ('a, [ `WithoutSuffix ], 'b) params_type ->
(string * 'a, [ `WithSuffix ], string param_name * 'b)
params_type
register_new_service
). e.g. suffix (int "i" ** string "s")
val static_dir : server_params ->
(string, unit, [ `Internal_Service of [ `Public_Service ] ], [ `WithSuffix ],
string param_name, unit param_name)
service
The service that correponds to the directory where static pages are.
This directory is chosen in the config file (ocsigen.conf).
This service takes the name of the static file as a parameter.
val close_session : server_params -> unit
type ('a, 'b)
action
val new_action : post_params:('a, [ `WithoutSuffix ], 'b) params_type ->
('a, 'b) action
val register_action : action:('a, 'b) action ->
(server_params -> 'a -> unit Lwt.t) -> unit
val register_action_for_session : server_params ->
action:('a, 'b) action ->
(server_params -> 'a -> unit Lwt.t) -> unit
val register_new_action : post_params:('a, [ `WithoutSuffix ], 'b) params_type ->
(server_params -> 'a -> unit Lwt.t) -> ('a, 'b) action
new_action
followed by register_action
val register_new_action_for_session : server_params ->
post_params:('a, [ `WithoutSuffix ], 'b) params_type ->
(server_params -> 'a -> unit Lwt.t) -> ('a, 'b) action
new_action
followed by register_action_for_session
val new_service : url:url_path ->
?prefix:bool ->
get_params:('a, [< `WithSuffix | `WithoutSuffix ] as 'b, 'c)
params_type ->
unit ->
('a, unit, [ `Internal_Service of [ `Public_Service ] ], 'b, 'c,
unit param_name)
service
new_service ~url:p ~get_params:pa ()
creates an service
associated to the url_path
p
and that takes the parameters pa
.
If you specify ~prefix:true
, your service will match all requests from client beginning by path
. You can have access to the suffix of the URL using suffix
or suffix_only
. For example new_service ["mysite";"mywiki"] ~prefix:true suffix_only
will match all the URL of the shape http://myserver/mysite/mywiki/thesuffix
val new_external_service : url:url_path ->
?prefix:bool ->
get_params:('a, [< `WithSuffix | `WithoutSuffix ] as 'b, 'c)
params_type ->
post_params:('d, [ `WithoutSuffix ], 'e) params_type ->
unit -> ('a, 'd, [ `External_Service ], 'b, 'c, 'e) service
val new_auxiliary_service : fallback:('a, unit, [ `Internal_Service of [ `Public_Service ] ], 'b, 'c, 'd)
service ->
('a, unit, [ `Internal_Service of [ `Local_Service ] ], 'b, 'c, 'd)
service
val new_post_service : fallback:('a, unit, [ `Internal_Service of [ `Public_Service ] ], 'b, 'c,
unit param_name)
service ->
post_params:('d, [ `WithoutSuffix ], 'e) params_type ->
('a, 'd, [ `Internal_Service of [ `Public_Service ] ], 'b, 'c, 'e)
service
fallback
is the same service without POST parameters.
You can create an service with POST parameters if the same service does not exist
without POST parameters. Thus, the user can't bookmark a page that does not
exist.val new_post_auxiliary_service : fallback:('a, 'b, [ `Internal_Service of [ `Public_Service ] ], 'c, 'd, 'e)
service ->
post_params:('f, [ `WithoutSuffix ], 'g) params_type ->
('a, 'f, [ `Internal_Service of [ `Local_Service ] ], 'c, 'd, 'g)
service
module Xhtml:sig
..end
module type REGCREATE =sig
..end
module type FORMCREATE =sig
..end
module type OCSIGENFORMSIG =sig
..end
module type OCSIGENREGSIG =sig
..end
module type OCSIGENSIG =sig
..end
module MakeRegister:
module MakeForms:functor (
Pages
:
FORMCREATE
) ->
OCSIGENFORMSIG
with type form_content_elt = Pages.form_content_elt and type form_content_elt_list = Pages.form_content_elt_list and type form_elt = Pages.form_elt and type a_content_elt = Pages.a_content_elt and type a_content_elt_list = Pages.a_content_elt_list and type a_elt = Pages.a_elt and type a_elt_list = Pages.a_elt_list and type div_content_elt = Pages.div_content_elt and type div_content_elt_list = Pages.div_content_elt_list and type uri = Pages.uri and type link_elt = Pages.link_elt and type script_elt = Pages.script_elt and type textarea_elt = Pages.textarea_elt and type select_elt = Pages.select_elt and type input_elt = Pages.input_elt and type pcdata_elt = Pages.pcdata_elt and type a_attrib_t = Pages.a_attrib_t and type form_attrib_t = Pages.form_attrib_t and type input_attrib_t = Pages.input_attrib_t and type textarea_attrib_t = Pages.textarea_attrib_t and type select_attrib_t = Pages.select_attrib_t and type link_attrib_t = Pages.link_attrib_t and type script_attrib_t = Pages.script_attrib_t and type input_type_t = Pages.input_type_t
module Text:OCSIGENSIG
with type page = string and type form_content_elt = string and type form_content_elt_list = string and type form_elt = string and type a_content_elt = string and type a_content_elt_list = string and type a_elt = string and type a_elt_list = string and type div_content_elt = string and type div_content_elt_list = string and type uri = string and type link_elt = string and type script_elt = string and type textarea_elt = string and type select_elt = string and type input_elt = string and type pcdata_elt = string and type a_attrib_t = string and type form_attrib_t = string and type input_attrib_t = string and type textarea_attrib_t = string and type select_attrib_t = string and type link_attrib_t = string and type script_attrib_t = string and type input_type_t = string