Commits

Justin Sheehy committed 0266559

Automated commit message

Comments (0)

Files changed (1)

WebmachineResources.wiki

 | encodings_provided | {{{ [{"identity", fun(X) -> X end}] }}} | {{{ [{Encoding, Encoder}] }}} | This must be a list of pairs where in each pair Encoding is a string naming a valid content encoding and Encoder is a callable function in the resource which will be called on the produced body in a GET and ensure that it is so encoded.  One useful setting is to have the function check on method, and on GET requests return {{{ [{"identity", fun(X) -> X end}, {"gzip", fun(X) -> zlib:gzip(X) end}] }}} as this is all that is needed to support gzip content encoding. |
 | variances | {{{ [] }}} | {{{ [HeaderName] }}} | If this function is implemented, it should return a list of strings with header names that should be included in a given response's Vary header. The standard conneg headers (Accept, Accept-Encoding, Accept-Charset, Accept-Language) do not need to be specified here as Webmachine will add the correct elements of those automatically depending on resource behavior. | 
 | is_conflict | false | _ | If this returns true, the client will receive a 409 Conflict. |
+| multiple_choices | false | _ | If this returns true, then it is assumed that multiple representations of the response are possible and a single one cannot be automatically chosen, so a 300 Multiple Choices will be sent instead of a 200. |
+| previously_existed | false | _ | | 
+| moved_permanently | false | {{{ {true, MovedURI} }}} | |
+| moved_temporarily | false | {{{ {true, MovedURI} }}} | |
+| last_modified | undefined | {{{ {{YYYY,MM,DD},{Hour,Min,Sec}} }}} | |
+| expires | undefined | {{{ {{YYYY,MM,DD},{Hour,Min,Sec}} }}} | |
+| generate_etag | undefined | ETag | If this returns a value, it will be used as the value of the ETag header and for comparison in conditional requests. |
+
+The above are all of the supported predefined resource functions. In addition to whichever of these a resource wishes to use, it also must export all of the functions named in the return values of the content_types_provided and content_types_accepted functions.
+
+The functions named in content_types_provided are expected to return {{{ {Body, ReqData, Context} }}} where {{{ Body }}} is the (binary or iolist) content which should make up the response body.
+
+The functions named in content_types_accepted are expected to return {{{ {true, ReqData, Context} }}} if they succeed.