This is server API (go to client)

Module Eliom_registration.​Redirection

module Redirection : sig..end

Eliom service registration for services that returns a redirections towards another service. See the Eliom manual for more information about Redirections outputs.

The default returned HTTP code is 302 Found. You could use the optional parameter ~options to change this value:

  • `MovedPermanently to return 301 Moved Permanently.
  • `Found to return 302 Found.
  • `SeeOther to return 303 See Other.
  • `NotNodifed to return 304 Not Modified.
  • `UseProxy to return 305 Use Proxy.
  • `TemporaryRedirect to return 307 Temporary Redirect.

type ('a, 'b) page = 
  (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
  Eliom_service.service
type options = 
  [ `Found
  | `MovedPermanently
  | `NotNodifed
  | `SeeOther
  | `TemporaryRedirect
  | `UseProxy ]
type 'b return = 'b
type 'a result = 'a Eliom_registration.kind

Service registration

val register : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?charset:string ->
  ?code:int ->
  ?content_type:string ->
  ?headers:Http_headers.t ->
  ?secure_session:bool ->
  service:('get, 'post, [< Eliom_service.service_method ],
   [< Eliom_service.attached ],
   [< Eliom_service.internal_service_kind ],
   [< Eliom_service.suff ], 'gn, 'pn, [ `Registrable ], 'b)
   Eliom_service.service ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   'post ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service 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_scope by default, see the Eliom manual for detailled description of different scope.

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_scope. 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 secure state.

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_Errorl).

val register_service : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?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:('get, [< Eliom_service.suff ] as 'a, 'gn)
   Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   unit ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get, unit, [< Eliom_service.service_method > `Get ],
   [< Eliom_service.attached > `Attached ],
   [< Eliom_service.service_kind > `Service ], 'a, 'gn,
   unit, [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service
val register_coservice : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?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, [ `Get ], Eliom_service.attached_kind,
   [ `Service ], [ `WithoutSuffix ], unit, unit,
   [< Eliom_service.registrable ], 'b)
   Eliom_service.service ->
  get_params:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   unit ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get, unit, [< Eliom_service.service_method > `Get ],
   [< Eliom_service.attached > `Attached ],
   [< Eliom_service.service_kind > `AttachedCoservice ],
   [ `WithoutSuffix ], 'gn, unit,
   [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service
val register_coservice' : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?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:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   unit ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get, unit, [< Eliom_service.service_method > `Get ],
   [< Eliom_service.attached > `Nonattached ],
   [< Eliom_service.service_kind > `NonattachedCoservice ],
   [ `WithoutSuffix ], 'gn, unit,
   [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service
val register_post_service : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?charset:string ->
  ?code:int ->
  ?content_type:string ->
  ?headers:Http_headers.t ->
  ?secure_session:bool ->
  ?https:bool ->
  ?priority:int ->
  fallback:('get, unit, [ `Get ], Eliom_service.attached_kind,
   [ `AttachedCoservice | `Service ],
   [< Eliom_service.suff ] as 'a, 'gn, unit, [<
   `Registrable ], 'b)
   Eliom_service.service ->
  post_params:('post, [ `WithoutSuffix ], 'pn)
   Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   'post ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get, 'post, [< Eliom_service.service_method > `Post ],
   [< Eliom_service.attached > `Attached ],
   [ `AttachedCoservice | `Service ], 'a, 'gn, 'pn,
   [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service
val register_post_coservice : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?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:('get, unit, [< `Get ], [< Eliom_service.attached_kind ],
   [< `AttachedCoservice | `Service ],
   [< Eliom_service.suff ] as 'a, 'gn, unit, [<
   `Registrable ], 'b)
   Eliom_service.service ->
  post_params:('post, [ `WithoutSuffix ], 'pn)
   Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   'post ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get, 'post, [< Eliom_service.service_method > `Post ],
   [< Eliom_service.attached > `Attached ],
   [< Eliom_service.service_kind > `AttachedCoservice ], 'a, 'gn, 'pn,
   [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service
val register_post_coservice' : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?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:('post, [ `WithoutSuffix ], 'pn)
   Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  (unit ->
   'post ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  (unit, 'post, [< Eliom_service.service_method > `Post ],
   [< Eliom_service.attached > `Nonattached ],
   [< Eliom_service.service_kind > `NonattachedCoservice ],
   [ `WithoutSuffix ], unit, 'pn,
   [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service
val register_put_service : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?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:('get, [< Eliom_service.suff ] as 'a, 'gn)
   Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   Eliom_parameter.raw_post_data ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get, Eliom_parameter.raw_post_data,
   [< Eliom_service.service_method > `Put ],
   [< Eliom_service.attached > `Attached ],
   [< Eliom_service.service_kind > `Service ], 'a, 'gn,
   Eliom_parameter.no_param_name,
   [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service
val register_put_coservice : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?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, Eliom_parameter.raw_post_data, [ `Put ],
   Eliom_service.attached_kind, [ `Service ],
   [ `WithoutSuffix ], unit, Eliom_parameter.no_param_name,
   [< Eliom_service.registrable ], 'b)
   Eliom_service.service ->
  get_params:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   Eliom_parameter.raw_post_data ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get, Eliom_parameter.raw_post_data,
   [< Eliom_service.service_method > `Put ],
   [< Eliom_service.attached > `Attached ],
   [< Eliom_service.service_kind > `AttachedCoservice ],
   [ `WithoutSuffix ], 'gn, Eliom_parameter.no_param_name,
   [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service
val register_put_coservice' : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?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:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   Eliom_parameter.raw_post_data ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get, Eliom_parameter.raw_post_data,
   [< Eliom_service.service_method > `Put ],
   [< Eliom_service.attached > `Nonattached ],
   [< Eliom_service.service_kind > `NonattachedCoservice ],
   [ `WithoutSuffix ], 'gn, Eliom_parameter.no_param_name,
   [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service
val register_delete_service : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?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:('get, [< Eliom_service.suff ] as 'a, 'gn)
   Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   Eliom_parameter.raw_post_data ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get, Eliom_parameter.raw_post_data,
   [< Eliom_service.service_method > `Delete ],
   [< Eliom_service.attached > `Attached ],
   [< Eliom_service.service_kind > `Service ], 'a, 'gn,
   Eliom_parameter.no_param_name,
   [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service
val register_delete_coservice : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?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, Eliom_parameter.raw_post_data, [ `Delete ],
   Eliom_service.attached_kind, [ `Service ],
   [ `WithoutSuffix ], unit, Eliom_parameter.no_param_name,
   [< Eliom_service.registrable ], 'b)
   Eliom_service.service ->
  get_params:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   Eliom_parameter.raw_post_data ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get, Eliom_parameter.raw_post_data,
   [< Eliom_service.service_method > `Delete ],
   [< Eliom_service.attached > `Attached ],
   [< Eliom_service.service_kind > `AttachedCoservice ],
   [ `WithoutSuffix ], 'gn, Eliom_parameter.no_param_name,
   [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service
val register_delete_coservice' : 
  ?scope:[< Eliom_common.scope ] ->
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?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:('get, [ `WithoutSuffix ], 'gn) Eliom_parameter.params_type ->
  ?error_handler:((string * exn) list ->
   (unit, unit, Eliom_service.get_service_kind,
   Eliom_service.attached, Eliom_service.service_kind,
   [ `WithoutSuffix ], unit, unit,
   Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get ->
   Eliom_parameter.raw_post_data ->
   (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
   Eliom_service.service Lwt.t) ->
  ('get, Eliom_parameter.raw_post_data,
   [< Eliom_service.service_method > `Delete ],
   [< Eliom_service.attached > `Nonattached ],
   [< Eliom_service.service_kind > `NonattachedCoservice ],
   [ `WithoutSuffix ], 'gn, Eliom_parameter.no_param_name,
   [< Eliom_service.registrable > `Registrable ], 'b)
  Eliom_service.service

Low-level function

val send : 
  ?options:[ `Found
   | `MovedPermanently
   | `NotNodifed
   | `SeeOther
   | `TemporaryRedirect
   | `UseProxy ] ->
  ?charset:string ->
  ?code:int ->
  ?content_type:string ->
  ?headers:Http_headers.t ->
  (unit, unit, Eliom_service.get_service_kind, Eliom_service.attached,
   Eliom_service.service_kind, [ `WithoutSuffix ], unit,
   unit, Eliom_service.registrable, 'b)
  Eliom_service.service -> 'a 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.