/usr/lib/ocaml/eliom/client/eliom_service.mli is in libeliom-ocaml-dev 2.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | (* Ocsigen
* http://www.ocsigen.org
* Copyright (C) 2007 Vincent Balat
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
(** Functions to add non localised parameters to services and
client side declaration of void coservices. Void coservices are the only ones
defined on client side. *)
open Eliom_parameter
open Eliom_lib
open Eliom_content_core
(** {2 Types of services} *)
type suff = [ `WithSuffix | `WithoutSuffix ]
type servcoserv = [ `Service | `Coservice ]
type getpost = [ `Get | `Post ]
(* `Post means that there is at least one post param
(possibly only the state post param).
`Get is for all the other cases.
*)
type attached_service_kind =
[ `Internal of servcoserv
| `External ]
type internal =
[ `Internal of servcoserv ]
type registrable = [ `Registrable | `Unregistrable ]
(** You can call register function only on registrable services *)
(* Registrable means not pre-applied *)
type (+'a, +'b) a_s
type +'a na_s
type service_kind =
[ `Attached of (attached_service_kind, getpost) a_s
| `Nonattached of getpost na_s ]
type internal_service_kind =
[ `Attached of (internal, getpost) a_s
| `Nonattached of getpost na_s ]
type get_service_kind =
[ `Attached of (attached_service_kind, [ `Get ]) a_s
| `Nonattached of [ `Get ] na_s ]
type post_service_kind =
[ `Attached of (attached_service_kind, [ `Post ]) a_s
| `Nonattached of [ `Post ] na_s ]
type attached =
[ `Attached of (attached_service_kind, getpost) a_s ]
type nonattached =
[ `Nonattached of getpost na_s ]
type http (** default return type for services *)
type appl_service (** return type for service that are entry points for an
application *)
(** Type of services.
- [ 'a] is the type of GET parameters expected by the service.
- [ 'b] is the type of POST parameters expected by the service.
- [ 'c] describes the services's kind: attached or non-attached,
internal or external, GET only or with POST
parameters. It is a subtype of {!service_kind}.
- [ 'd] is a phantom type, subtype of {!suff} stating the kind
of parameters it uses: suffix or not.
- [ 'e] is the type of GET parameters names. See {!Eliom_parameter.param_name} and
form generation functions (e. g. {!Eliom_registration.Html5.get_form}).
- [ 'f] is the type of POST parameters names. See {!Eliom_parameter.param_name} and
form generation functions (e. g. {!Eliom_registration.Html5.post_form}).
- [ 'g] is a phantom type, subtype of {!registrable},
telling if it is possible to register a handler
on this service.
- [ 'h] is an information on what the service returns.
See {!Eliom_registration.kind}.
*)
type ('a,'b,+'c,+'d,+'e,+'f,+'g,+'h) service
constraint 'd = [< suff ]
constraint 'g = [< registrable ]
(** {3 Void non-attached coservices} *)
val void_coservice' :
(unit, unit, [> `Nonattached of 'a na_s ],
[ `WithoutSuffix ],
unit, unit, [> `Unregistrable ], 'return)
service
(** A predefined non-attached action with special behaviour:
it has no parameter at all, even non-attached parameters.
Use it if you want to make a link to the current page without non-attached
parameters.
It is almost equivalent to a POST non-attached service without POST
parameters, on which you register an action that does nothing,
but you can use it with <a> links, not only forms.
It does not keep non attached GET parameters.
*)
val https_void_coservice' :
(unit, unit, [> `Nonattached of 'a na_s ],
[ `WithoutSuffix ],
unit, unit, [> `Unregistrable ], 'return)
service
(** The same, but forcing https. *)
val void_hidden_coservice' :
(unit, unit, [> `Nonattached of 'a na_s ],
[ `WithoutSuffix ],
unit, unit, [> `Unregistrable ], 'return)
service
(** Same as [void_coservice'] but keeps non attached GET parameters.
*)
val https_void_hidden_coservice' :
(unit, unit, [> `Nonattached of 'a na_s ],
[ `WithoutSuffix ],
unit, unit, [> `Unregistrable ], 'return)
service
(** The same, but forcing https. *)
(** {2 Miscellaneous} *)
(** {3 Localized parameters} *)
val add_non_localized_get_parameters :
params:('p, [ `WithoutSuffix ], 'pn) non_localized_params ->
service:('a, 'b, 'c, 'd, 'e, 'f, 'g, 'return) service ->
('a * 'p, 'b, 'c, 'd, 'e * 'pn, 'f, 'g, 'return) service
(** Adds non localized GET parameters to a service *)
val add_non_localized_post_parameters :
params:('p, [ `WithoutSuffix ], 'pn) non_localized_params ->
service:('a, 'b, 'c, 'd, 'e, 'f, 'g, 'return) service ->
('a, 'b * 'p, 'c, 'd, 'e, 'f * 'pn, 'g, 'return) service
(** Adds non localized POST parameters to a service *)
(** {3 Static files} *)
(** The predefined service [static_dir] allows one to create links to
static files. This service takes the name of a static file as a
parameter (a string list, slash separated). The actual directory
in filesystem where static pages will be found must be set up in
the configuration file with the staticmod extension. *)
val static_dir :
unit ->
(string list, unit, [> `Attached of
([> `Internal of [> `Service ] ], [> `Get]) a_s ],
[ `WithSuffix ],
[ `One of string list ] param_name, unit, [> `Unregistrable ], 'return)
service
(** Same as {!static_dir} but forcing https link. *)
val https_static_dir :
unit ->
(string list, unit, [> `Attached of
([> `Internal of [> `Service ] ], [> `Get]) a_s ],
[ `WithSuffix ],
[ `One of string list ] param_name, unit, [> `Unregistrable ], 'return)
service
(** Like [static_dir], but allows one to put GET parameters *)
val static_dir_with_params :
?keep_nl_params:[ `All | `Persistent | `None ] ->
get_params:('a, [`WithoutSuffix], 'an) params_type ->
unit ->
((string list * 'a), unit,
[> `Attached of
([> `Internal of [> `Service ] ], [> `Get]) a_s ],
[ `WithSuffix ],
[ `One of string list ] param_name *'an, unit, [> `Unregistrable ], 'return)
service
(** Same as {!static_dir_with_params} but forcing https link. *)
val https_static_dir_with_params :
?keep_nl_params:[ `All | `Persistent | `None ] ->
get_params:('a, [`WithoutSuffix], 'an) params_type ->
unit ->
((string list * 'a), unit,
[> `Attached of
([> `Internal of [> `Service ] ], [> `Get]) a_s ],
[ `WithSuffix ],
[ `One of string list ] param_name *'an, unit, [> `Unregistrable ], 'return)
service
(**/**)
(* used by Eliom_uri *)
val get_get_or_post :
('a, 'b,
[< `Attached of (attached_service_kind, [< getpost]) a_s
| `Nonattached of [< getpost ] na_s ], 'd, 'e, 'f, 'g, 'h) service ->
getpost
val get_kind_ : ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'return) service -> 'c
val get_pre_applied_parameters_ : ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'return) service ->
(string * string) list String.Table.t *
(string * string) list
val get_get_params_type_ : ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'return) service ->
('a, 'd, 'e) Eliom_parameter.params_type
val get_post_params_type_ : ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'return) service ->
('b, [ `WithoutSuffix ], 'f) Eliom_parameter.params_type
val get_att_kind_ : ('a, 'b) a_s -> 'a
val get_sub_path_ : ('a, 'b) a_s -> Url.path
val get_full_path_ : ('a, 'b) a_s -> Url.path
val get_prefix_ : ('a, 'b) a_s -> string
val get_get_name_ : ('a, 'b) a_s -> Eliom_common.att_key_serv
val get_post_name_ : ('a, 'b) a_s -> Eliom_common.att_key_serv
val get_redirect_suffix_ : ('a, 'b) a_s -> bool
val get_na_name_ : 'a na_s -> Eliom_common.na_key_serv
val get_na_kind_ : 'a na_s -> [ `Get | `Post of bool ]
val get_max_use_ : ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'return) service -> int option
val get_timeout_ : ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'return) service -> float option
val get_https : ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'return) service -> bool
val get_priority_ : ('a, 'b) a_s -> int
val keep_nl_params : ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'return) service ->
[ `All | `Persistent | `None ]
val change_get_num :
('a, 'b, 'c, 'd, 'e, 'f, 'g, 'return) service ->
('h, 'hh) a_s ->
Eliom_common.att_key_serv ->
('a, 'b, [> `Attached of ('h, 'hh) a_s ], 'd, 'e, 'f, 'i, 'return) service
(* Not implemented on client side: TODO should not be called in Eliom_uri *)
val register_delayed_get_or_na_coservice :
sp:Eliom_common.server_params ->
(int * Eliom_common.user_scope * bool option) ->
string
val register_delayed_post_coservice :
sp:Eliom_common.server_params ->
(int * Eliom_common.user_scope * bool option) ->
Eliom_common.att_key_serv -> string
(* used by eliommod_mkform *)
type send_appl_content =
| XNever
| XAlways
| XSame_appl of string * string option
(** Whether the service is capable to send application content or not.
(application content has type Eliom_service.eliom_appl_answer:
content of the application container, or xhr redirection ...).
A link towards a service with send_appl_content = XNever will
always answer a regular http frame (this will stop the application if
used in a regular link or form, but not with XHR).
XAlways means "for all applications" (like redirections/actions).
XSame_appl means "only for this application".
If there is a client side application, and the service has
XAlways or XSame_appl when it is the same application,
then the link (or form or change_page) will expect application content.
*)
(** Returns the name of the application to which belongs the service, if any. *)
val get_send_appl_content : ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h) service -> send_appl_content
val xhr_with_cookies :
('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h) service -> string option option
|