caldav
  1. Overview
  2. Docs

The resource parent class.

constraint 'body = [> `Empty ]
method virtual content_types_provided : ((string * 'body provider) list, 'body) op
method virtual content_types_accepted : ((string * 'body acceptor) list, 'body) op
method resource_exists : (bool, 'body) op

Returning false will result in a 404 Not Found.

Default: true

method service_available : (bool, 'body) op

Returning false will result in a 503 Service Unavilable.

Default: true

method is_authorized : (auth, 'body) op
method forbidden : (bool, 'body) op

Returning true will result in a 403 Forbidden.

Default: false

method malformed_request : (bool, 'body) op

Returning true will result in a 400 Bad Request.

Default: false

method uri_too_long : (bool, 'body) op

Returning true will result in a 414 Request-URI Too Long.

Default: false

method known_content_type : (bool, 'body) op

Returning false will result in a 415 Unsupported Media Type.

Default: true

method valid_content_headers : (bool, 'body) op

Returning false will result in a 501 Not Implemented.

Default: true

method valid_entity_length : (bool, 'body) op

Returning false will result in 413 Request Entity Too Large.

Default : true

method options : ((string * string) list, 'body) op

If the `OPTIONS method is supported by this resource, the returned list of header name/value pairs will be included in responses to `OPTIONS requests.

Default: [("allow", self#allowed_methods)]

method known_methods : (Cohttp.Code.meth list, 'body) op

A request to this resource whose method is not included in the returned list will result in a 501 Not Implemented.

Default: [`GET; `HEAD; `POST; `PUT; `DELETE; `Other "TRACE"; `Other "CONNECT"; `OPTIONS]

method allowed_methods : (Cohttp.Code.meth list, 'body) op

A request to this resource whose method is not included in the returned list will result in a 405 Method Not Allowed. The response will include an "allow" header that lists the allowed methods.

Default: [`GET; `HEAD]

method delete_resource : (bool, 'body) op

`DELETE requests will call this method. Returning true indicates that the deletion succeeded.

Default: false

method delete_completed : (bool, 'body) op

Only successful delete_resource calls will result in a call to this method. Return false if the deletion was accepted but cannot yet be guaranteed to have finished.

Default: true

method process_post : (bool, 'body) op

`POST requests will call this method. Returning true indicates the POST succeeded.

method process_property : (property_response, 'body) op
method cannot_create : (unit, 'body) op
method create_collection : (collection_created_response, 'body) op
method report : (report_response, 'body) op
method language_available : (bool, 'body) op

Returning false will result in a 406 Not Acceptable.

Default: true

method charsets_provided : ((string * ('body -> 'body)) list, 'body) op
method encodings_provided : ((string * ('body -> 'body)) list, 'body) op
method variances : (string list, 'body) op

Returns a list of header names that should be included in the response's Vary header. The standard content negotiation headers (i.e., Accept, Accept-Encoding, Accept-Charset, Accept-Language) will automatically be added if needed, and therefore do not need to be specified here.

Default: []

method is_conflict : (bool, 'body) op

Returning true will result in a 409 Conflict.

Default: false

method multiple_choices : (bool, 'body) op

Returning true indicates that multiple representations of the resource exist and a single one cannot be automatically chosen, resulting in a 300 Multiple Choices rather than a 200 OK.

Default: false

method previously_existed : (bool, 'body) op
method moved_permanently : (Uri.t option, 'body) op
method moved_temporarily : (Uri.t option, 'body) op
method last_modified : (string option, 'body) op
method expires : (string option, 'body) op
method generate_etag : (string option, 'body) op

Returning Some string will use string for the ETag header.

Default: None

method finish_request : (unit, 'body) op

This method is called just before the final response is constructed and returned.

method post_is_create : (bool, 'body) op

If POST requests should be treated as a request to put content into a (potentially new) resource as opposed to being a generic submission for processing, then this function should return true. If it does return true, then create_path will be called and the rest of the request will be treated much like a PUT to the Path entry returned by that call.

Default: false

method create_path : (string, 'body) op

This will be called on a POST request if post_is_create returns true. It is an error for this function not to produce a Path if post_is_create returns true. The Path returned should be a valid URI part following the dispatcher prefix. That Path will replace the previous one in the return value of wrq:disp_path(ReqData) for all subsequent resource function calls in the course of this request.

method allow_missing_post : (bool, 'body) op

If the resource accepts POST requests to nonexistent resources, then this should return true.

Default : false