Commits

jus...@basho.com  committed 2bee2dc

add defaults to alloweds

  • Participants
  • Parent commits 6ba63a9

Comments (0)

Files changed (1)

File WebmachineResources.wiki

 |=Function|=Default|=Halt|=Allowed |=Description         |
 |resource_exists | true | X | true {{{|}}} false | Returning non-true values will result in 404 Not Found. |
 |service_available | true | X | true {{{|}}} false |  |
-|is_authorized | true | X | AuthHead | If this returns anything other than true, the response will be 401 Unauthorized. The AuthHead return value will be used as the value in the WWW-Authenticate header. |
+|is_authorized | true | X | true {{{|}}} AuthHead | If this returns anything other than true, the response will be 401 Unauthorized. The AuthHead return value will be used as the value in the WWW-Authenticate header. |
 | forbidden | false | X | true {{{|}}} false | |
 | allow_missing_post | false | X | true {{{|}}} false | If the resource accepts POST requests to nonexistent resources, then this should return true. |
 | malformed_request | false | X | true {{{|}}} false | |
 | process_post | false | X | true {{{|}}} false | If post_is_create returns false, then this will be called to process any POST requests. If it succeeds, it should return true. |
 | content_types_provided | {{{ [{"text/html", to_html}] }}} |  | {{{ [{Mediatype, Handler}] }}} | This should return a list of pairs where each pair is of the form {{{ {Mediatype, Handler} }}} where {{{Mediatype}}} is a string of content-type format and the {{{Handler}}} is an atom naming the function which can provide a resource representation in that media type.  Content negotiation is driven by this return value. For example, if a client request includes an Accept header with a value that does not appear as a first element in any of the return tuples, then a 406 Not Acceptable will be sent. |
 | content_types_accepted | {{{ [] }}} |  | {{{ [{Mediatype, Handler}] }}} | This is used similarly to content_types_provided, except that it is for incoming resource representations -- for example, PUT requests. Instances of this function usually want to use {{{ wrq:req_body(ReqData) }}} to access the incoming request body.|
-| charsets_provided | no_charset |  | {{{ [{Charset, CharsetConverter}] }}} | If this is anything other than the atom no_charset, it must be a list of pairs where each pair is of the form Charset, Converter where Charset is a string naming a charset and Converter is a callable function in the resource which will be called on the produced body in a GET and ensure that it is in Charset. |
+| charsets_provided | no_charset |  | no_charset {{{|}}} {{{ [{Charset, CharsetConverter}] }}} | If this is anything other than the atom no_charset, it must be a list of pairs where each pair is of the form Charset, Converter where Charset is a string naming a charset and Converter is a callable function in the resource which will be called on the produced body in a GET and ensure that it is in Charset. |
 | 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 |  | true {{{|}}} false | If this returns true, the client will receive a 409 Conflict. |
 | multiple_choices | false | X | true {{{|}}} 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 | X | true {{{|}}} false | | 
-| moved_permanently | false | X | {{{ {true, MovedURI} }}} | |
-| moved_temporarily | false | X | {{{ {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. |
+| moved_permanently | false | X | {{{ {true, MovedURI} }}} {{{|}}} false | |
+| moved_temporarily | false | X | {{{ {true, MovedURI} }}} {{{|}}} false | |
+| last_modified | undefined |  | undefined {{{|}}} {{{ {{YYYY,MM,DD},{Hour,Min,Sec}} }}} | |
+| expires | undefined |  | undefined {{{|}}} {{{ {{YYYY,MM,DD},{Hour,Min,Sec}} }}} | |
+| generate_etag | undefined |  | undefined {{{|}}} ETag | If this returns a value, it will be used as the value of the ETag header and for comparison in conditional requests. |
 | finish_request | true | | true {{{|}}} false | This function, if exported, is called just before the final response is constructed and sent.  The {{{ Result }}} is ignored, so any effect of this function must be by returning a modified {{{ ReqData }}}. |
 
 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.