Plasma GitLab Archive
Projects Blog Knowledge

Class Pxp_reader.resolve_to_url_obj_channel


class resolve_to_url_obj_channel : ?close:Netchannels.in_obj_channel -> unit -> url_of_id:(Pxp_core_types.I.resolver_id -> Neturl.url) -> base_url_of_id:(Pxp_core_types.I.resolver_id -> Neturl.url) -> channel_of_url:(Pxp_core_types.I.resolver_id -> Neturl.url -> accepted_id) -> unit -> resolver
When this resolver gets an ID to read from, it calls the function url_of_id to get the corresponding URL (such IDs are normally system IDs, but it is also possible to other kinds of IDs to URLs). This URL may be a relative URL; however, a URL scheme must be used which contains a path. The resolver converts the URL to an absolute URL if necessary.

To do so, the resolver calls base_url_of_id to get the URL the relative URL must be interpreted relative to. Usually, this function returns the rid_system_base as URL. This URL must be absolute.

The third function, channel_of_url, is fed with the absolute URL as input. This function opens the resource to read from, and returns the accepted_id like resolve_to_any_obj_channel does. The resolver ID passed to channel_of_url contains the string representation of the absolute URL as system ID.

All functions, url_of_id, base_url_of_id, and channel_of_url, can raise Not_competent to indicate that the object is not able to read from the specified resource. However, there is a difference: A Not_competent from url_of_id or base_url_of_id is left as is, but a Not_competent from channel_of_url is converted to Not_resolvable. So only url_of_id and base_url_of_id decide which URLs are accepted by the resolver and which not, and in the latter case, other resolver can be tried. If channel_of_url raises Not_competent, however, the whole resolution procedure will stop, and no other resolver will be tried.

When the resolver is closed, the function passed by the close argument is called. By default, the channel is closed (i.e. the default is: close:(fun ch -> ch # close_in())).


This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml