.TH "Eliom_registration.Redirection" 3o 2012-06-11 OCamldoc "" .SH NAME Eliom_registration.Redirection \- Eliom service registration for services that returns a redirections towards another service. .SH Module Module Eliom_registration.Redirection .SH Documentation .sp Module .BI "Redirection" : .B sig end .sp Eliom service registration for services that returns a redirections towards another service\&. See the Eliom manual for more information about \&. .sp The default returned HTTP code is .B 302 Found \&. You could use the optional parameter .B ~options to change this value: .sp .sp \- .B `MovedPermanently to return .B 301 Moved Permanently \&. .sp \- .B `Found to return .B 302 Found \&. .sp \- .B `SeeOther to return .B 303 See Other \&. .sp \- .B `NotNodifed to return .B 304 Not Modified \&. .sp \- .B `UseProxy to return .B 305 Use Proxy \&. .sp \- .B `TemporaryRedirect to return .B 301 Temporary Redirect \&. .sp .sp .sp .sp .I type .B ('a, 'b) .I page = .B (unit, unit, Eliom_service.get_service_kind, [ `WithoutSuffix ], unit, .B unit, Eliom_service.registrable, 'b) .B Eliom_service.service .sp .sp .I type options = .B [ `Found .B | `MovedPermanently .B | `NotNodifed .B | `SeeOther .B | `TemporaryRedirect .B | `UseProxy ] .sp .sp .I type .B 'a .I return = .B 'a .sp .sp .I type .B ('a, 'b) .I result = .B ('a, 'b) Eliom_registration.kind .sp .sp .PP .B === .B Service registration .B === .PP .I val register : .B ?scope:[< Eliom_common.scope ] -> .B ?options:[ `Found .B | `MovedPermanently .B | `NotNodifed .B | `SeeOther .B | `TemporaryRedirect .B | `UseProxy ] -> .B ?charset:string -> .B ?code:int -> .B ?content_type:string -> .B ?headers:Http_headers.t -> .B ?secure_session:bool -> .B service:('a, 'b, [< Eliom_service.internal_service_kind ], .B [< Eliom_service.suff ], 'c, 'd, [ `Registrable ], 'e) .B Eliom_service.service -> .B ?error_handler:((string * exn) list -> .B (unit, unit, Eliom_service.get_service_kind, .B [ `WithoutSuffix ], unit, unit, Eliom_service.registrable, .B 'e) .B Eliom_service.service Lwt.t) -> .B ('a -> .B 'b -> .B (unit, unit, Eliom_service.get_service_kind, [ `WithoutSuffix ], unit, .B unit, Eliom_service.registrable, 'e) .B Eliom_service.service Lwt.t) -> .B unit .sp The function .B register service handler will associate the .B service to the function .B handler \&. The .B handler function take two parameters, the GET and POST parameters of the current HTTP request, and should returns the corresponding page\&. .sp The optional parameter .B ~scope is .B Eliom_common\&.global by default, see the Eliom manual for detailled description \&. .sp The optional parameter .B ~options is specific to each output module, see the type description for more information\&. .sp The optional parameters .B ?charset , .B ?code , .B ?content_type and .B ?headers can be used to modify the HTTP answer sent by Eliom\&. Use this with care\&. .sp The optional parameter .B ~secure_session has no effect for scope .B Eliom_common\&.global \&. With other scopes, the parameter is used to force the session service table in which the .B handler will be registered\&. By default, the service is registred in the unsecure session if the current request\&'s protocol is .B http , or in the secure session if the protocol is .B https \&. If set to .B false (resp\&. .B true ) the .B handler will be stored in the unsecure (resp\&. secure) session\&. See the Eliom manual for an introduction to \&. .sp The optional parameter .B ~error_handler is used to specialize the error page when actual parameters aren\&'t compatible with the expected type\&. The default error handler is .B fun l \-> raise ( .B Eliom_common\&.Eliom_Typing_Error .B l) \&. .sp .sp .I val register_service : .B ?scope:[< Eliom_common.scope ] -> .B ?options:[ `Found .B | `MovedPermanently .B | `NotNodifed .B | `SeeOther .B | `TemporaryRedirect .B | `UseProxy ] -> .B ?charset:string -> .B ?code:int -> .B ?content_type:string -> .B ?headers:Http_headers.t -> .B ?secure_session:bool -> .B ?https:bool -> .B ?priority:int -> .B path:Eliom_lib.Url.path -> .B get_params:('a, [< Eliom_service.suff ] as 'b, 'c) .B Eliom_parameter.params_type -> .B ?error_handler:((string * exn) list -> .B (unit, unit, Eliom_service.get_service_kind, .B [ `WithoutSuffix ], unit, unit, Eliom_service.registrable, .B 'd) .B Eliom_service.service Lwt.t) -> .B ('a -> .B unit -> .B (unit, unit, Eliom_service.get_service_kind, [ `WithoutSuffix ], unit, .B unit, Eliom_service.registrable, 'd) .B Eliom_service.service Lwt.t) -> .B ('a, unit, .B [> `Attached of .B ([> `Internal of [> `Service ] ], [> `Get ]) Eliom_service.a_s ], .B 'b, 'c, unit, [< Eliom_service.registrable > `Registrable ], 'd) .B Eliom_service.service .sp Same as .B Eliom_service\&.service followed by .B Eliom_registration\&.Redirection\&.register \&. .sp .sp .I val register_coservice : .B ?scope:[< Eliom_common.scope ] -> .B ?options:[ `Found .B | `MovedPermanently .B | `NotNodifed .B | `SeeOther .B | `TemporaryRedirect .B | `UseProxy ] -> .B ?charset:string -> .B ?code:int -> .B ?content_type:string -> .B ?headers:Http_headers.t -> .B ?secure_session:bool -> .B ?name:string -> .B ?csrf_safe:bool -> .B ?csrf_scope:[< Eliom_common.user_scope ] -> .B ?csrf_secure:bool -> .B ?max_use:int -> .B ?timeout:float -> .B ?https:bool -> .B fallback:(unit, unit, .B [ `Attached of .B ([ `Internal of [ `Service ] ], [ `Get ]) Eliom_service.a_s ], .B [ `WithoutSuffix ], unit, unit, [< Eliom_service.registrable ], 'a) .B Eliom_service.service -> .B get_params:('b, [ `WithoutSuffix ], 'c) Eliom_parameter.params_type -> .B ?error_handler:((string * exn) list -> .B (unit, unit, Eliom_service.get_service_kind, .B [ `WithoutSuffix ], unit, unit, Eliom_service.registrable, .B 'a) .B Eliom_service.service Lwt.t) -> .B ('b -> .B unit -> .B (unit, unit, Eliom_service.get_service_kind, [ `WithoutSuffix ], unit, .B unit, Eliom_service.registrable, 'a) .B Eliom_service.service Lwt.t) -> .B ('b, unit, .B [> `Attached of .B ([> `Internal of [> `Coservice ] ], [> `Get ]) Eliom_service.a_s ], .B [ `WithoutSuffix ], 'c, unit, [< Eliom_service.registrable > `Registrable ], .B 'a) .B Eliom_service.service .sp Same as .B Eliom_service\&.coservice followed by .B Eliom_registration\&.Redirection\&.register \&. .sp .sp .I val register_coservice' : .B ?scope:[< Eliom_common.scope ] -> .B ?options:[ `Found .B | `MovedPermanently .B | `NotNodifed .B | `SeeOther .B | `TemporaryRedirect .B | `UseProxy ] -> .B ?charset:string -> .B ?code:int -> .B ?content_type:string -> .B ?headers:Http_headers.t -> .B ?secure_session:bool -> .B ?name:string -> .B ?csrf_safe:bool -> .B ?csrf_scope:[< Eliom_common.user_scope ] -> .B ?csrf_secure:bool -> .B ?max_use:int -> .B ?timeout:float -> .B ?https:bool -> .B get_params:('a, [ `WithoutSuffix ], 'b) Eliom_parameter.params_type -> .B ?error_handler:((string * exn) list -> .B (unit, unit, Eliom_service.get_service_kind, .B [ `WithoutSuffix ], unit, unit, Eliom_service.registrable, .B 'c) .B Eliom_service.service Lwt.t) -> .B ('a -> .B unit -> .B (unit, unit, Eliom_service.get_service_kind, [ `WithoutSuffix ], unit, .B unit, Eliom_service.registrable, 'c) .B Eliom_service.service Lwt.t) -> .B ('a, unit, [> `Nonattached of [> `Get ] Eliom_service.na_s ], .B [ `WithoutSuffix ], 'b, unit, [< Eliom_service.registrable > `Registrable ], .B 'c) .B Eliom_service.service .sp Same as .B Eliom_service\&.coservice\&' followed by .B Eliom_registration\&.Redirection\&.register \&. .sp .sp .I val register_post_service : .B ?scope:[< Eliom_common.scope ] -> .B ?options:[ `Found .B | `MovedPermanently .B | `NotNodifed .B | `SeeOther .B | `TemporaryRedirect .B | `UseProxy ] -> .B ?charset:string -> .B ?code:int -> .B ?content_type:string -> .B ?headers:Http_headers.t -> .B ?secure_session:bool -> .B ?https:bool -> .B ?priority:int -> .B fallback:('a, unit, .B [ `Attached of .B ([ `Internal of [ `Coservice | `Service ] ], [ `Get ]) .B Eliom_service.a_s ], .B [< Eliom_service.suff ] as 'b, 'c, unit, [< `Registrable ], 'd) .B Eliom_service.service -> .B post_params:('e, [ `WithoutSuffix ], 'f) Eliom_parameter.params_type -> .B ?error_handler:((string * exn) list -> .B (unit, unit, Eliom_service.get_service_kind, .B [ `WithoutSuffix ], unit, unit, Eliom_service.registrable, .B 'g) .B Eliom_service.service Lwt.t) -> .B ('a -> .B 'e -> .B (unit, unit, Eliom_service.get_service_kind, [ `WithoutSuffix ], unit, .B unit, Eliom_service.registrable, 'g) .B Eliom_service.service Lwt.t) -> .B ('a, 'e, .B [> `Attached of .B ([> `Internal of [ `Coservice | `Service ] ], [> `Post ]) .B Eliom_service.a_s ], .B 'b, 'c, 'f, [< Eliom_service.registrable > `Registrable ], 'g) .B Eliom_service.service .sp Same as .B Eliom_service\&.post_service followed by .B Eliom_registration\&.Redirection\&.register \&. .sp .sp .I val register_post_coservice : .B ?scope:[< Eliom_common.scope ] -> .B ?options:[ `Found .B | `MovedPermanently .B | `NotNodifed .B | `SeeOther .B | `TemporaryRedirect .B | `UseProxy ] -> .B ?charset:string -> .B ?code:int -> .B ?content_type:string -> .B ?headers:Http_headers.t -> .B ?secure_session:bool -> .B ?name:string -> .B ?csrf_safe:bool -> .B ?csrf_scope:[< Eliom_common.user_scope ] -> .B ?csrf_secure:bool -> .B ?max_use:int -> .B ?timeout:float -> .B ?https:bool -> .B fallback:('a, unit, .B [ `Attached of .B ([ `Internal of [< `Coservice | `Service ] ], [ `Get ]) .B Eliom_service.a_s ], .B [< Eliom_service.suff ] as 'b, 'c, unit, [< `Registrable ], 'd) .B Eliom_service.service -> .B post_params:('e, [ `WithoutSuffix ], 'f) Eliom_parameter.params_type -> .B ?error_handler:((string * exn) list -> .B (unit, unit, Eliom_service.get_service_kind, .B [ `WithoutSuffix ], unit, unit, Eliom_service.registrable, .B 'd) .B Eliom_service.service Lwt.t) -> .B ('a -> .B 'e -> .B (unit, unit, Eliom_service.get_service_kind, [ `WithoutSuffix ], unit, .B unit, Eliom_service.registrable, 'd) .B Eliom_service.service Lwt.t) -> .B ('a, 'e, .B [> `Attached of .B ([> `Internal of [> `Coservice ] ], [> `Post ]) Eliom_service.a_s ], .B 'b, 'c, 'f, [< Eliom_service.registrable > `Registrable ], 'd) .B Eliom_service.service .sp Same as .B Eliom_service\&.post_coservice followed by .B Eliom_registration\&.Redirection\&.register \&. .sp .sp .I val register_post_coservice' : .B ?scope:[< Eliom_common.scope ] -> .B ?options:[ `Found .B | `MovedPermanently .B | `NotNodifed .B | `SeeOther .B | `TemporaryRedirect .B | `UseProxy ] -> .B ?charset:string -> .B ?code:int -> .B ?content_type:string -> .B ?headers:Http_headers.t -> .B ?secure_session:bool -> .B ?name:string -> .B ?csrf_safe:bool -> .B ?csrf_scope:[< Eliom_common.user_scope ] -> .B ?csrf_secure:bool -> .B ?max_use:int -> .B ?timeout:float -> .B ?keep_get_na_params:bool -> .B ?https:bool -> .B post_params:('a, [ `WithoutSuffix ], 'b) Eliom_parameter.params_type -> .B ?error_handler:((string * exn) list -> .B (unit, unit, Eliom_service.get_service_kind, .B [ `WithoutSuffix ], unit, unit, Eliom_service.registrable, .B 'c) .B Eliom_service.service Lwt.t) -> .B (unit -> .B 'a -> .B (unit, unit, Eliom_service.get_service_kind, [ `WithoutSuffix ], unit, .B unit, Eliom_service.registrable, 'c) .B Eliom_service.service Lwt.t) -> .B (unit, 'a, [> `Nonattached of [> `Post ] Eliom_service.na_s ], .B [ `WithoutSuffix ], unit, 'b, [< Eliom_service.registrable > `Registrable ], .B 'c) .B Eliom_service.service .sp Same as .B Eliom_service\&.post_coservice\&' followed by .B Eliom_registration\&.Redirection\&.register \&. .sp .sp .PP .B === .B Low\-level function .B === .PP .I val send : .B ?options:[ `Found .B | `MovedPermanently .B | `NotNodifed .B | `SeeOther .B | `TemporaryRedirect .B | `UseProxy ] -> .B ?charset:string -> .B ?code:int -> .B ?content_type:string -> .B ?headers:Http_headers.t -> .B (unit, unit, Eliom_service.get_service_kind, [ `WithoutSuffix ], unit, .B unit, Eliom_service.registrable, 'a) .B Eliom_service.service -> ('b, 'a) Eliom_registration.kind Lwt.t .sp The function .B send page build the HTTP frame corresponding to .B page \&. This may be used for example in an service handler registered with .B Eliom_registration\&.Any\&.register or when building a custom output module\&. .sp .sp