Fork me on GitHub

List of Decisions

Liberator supports a whole lot of decisions points. Some of them are needed for next to every resource definition. Others are seldom used or there is no other sensible implementation.

Typical decision points for resource implementors

The following decisions points will be typically specified depending on the desired resource behaviour.

key description default
allowed? Is the request allowed? true
authorized? Is the request authorized? true
charset-available? Is any of requested charsets available? Should set :charset in representation to the negotiated character set. Uses value at :available-charsets
can-post-to-gone? Process a post to a resource that existed before or trigger response 410 gone false
can-post-to-missing? Process a post to a resource that does not exist or send 404 not-found true
can-put-to-missing? Process a put to a resource that does not exist or send 501 not-implemented since 0.9.0 true
conflict? Does the put request emerge a conflict? false
delete-enacted? Was the delete request finally processed? true
encoding-available? Is the requested encoding available? Should set :media-type in representation Uses values at :available-media-types
etag-matches-for-if-match? Does the etag of the current resource state match the If-Match-Header? Uses value generated by :etag by default.
etag-matches-for-if-none? Does does etag of the current resource state match the If-Match-None-Header? Uses value generated by :etag by default.
existed? Did the resource exist before? false
exists? Does the resource exist? true
known-content-type? Is the Content-Type of the body known? true
known-method? Is the request method known? Uses :known-methods
language-available? Is the requested language available? Should set :language in representation Uses value at :available-languages
malformed? Is the request malformed? false
media-type-available? Is the requested media-type available? Should set :media-type in representation Uses value at :available-media-types
method-allowed? Is the request method allowed for this resource? Uses value at :allowed-methods
modified-since? Was the resource modified since the date given in the headers “If-Modified-Since”? Uses the value from :last-modified
moved-permanently? Was the resource moved permanently? false
moved-temporarily? Was the resource moved temporarily? false
multiple-representations? Should the response be 310 multiple representations? false
new? Was the resource created by this request? true
post-redirect? Shall the response redirect after a POST? false
put-to-different-url? Should the PUT request be made to a different url? false
processable? Process the request body or send 422 unprocessable-entity if not since 0.9.0 true
respond-with-entity? Shall the response contain a representation of the entity? false
service-available? Is the service available? true
unmodified-since? Was the resource not modified since the date in “If-Unmodified-Since”? Uses the value from :last-modified
uri-too-long? Is the request URI to long? false
valid-content-header? Is the Content-Type of the body valid? true
valid-entity-length? Is the length of the body valid? true

Internal decision points

These decision points are used internally by liberator and provide reasonable defaults. Overriding is possible, but not useful in general.

key description
accept-charset-exists? checks if header “Accept-Charset” exists
accept-encoding-exists? checks if header “Accept-Encoding” exists
accept-exists? checks if header “Accept” exists
accept-language-exists? checks if header “Accept-Language” exists
if-match-exists? checks if header “If-Match” exists
if-match-star? checks if header “If-Match” is “*”
if-match-star-exists-for-missing? checks if header “If-Match” exists for a resource that does not exist
if-modified-since-exists? checks if header “If-Modified-Since” exists
if-modified-since-valid-date? checks if header “If-Modified-Since” is a valid HTTP date
if-none-match? checks the request method to handle failed if-none-match
if-none-match-exists? checks if header “If-None-Match” exists
if-none-match-star? checks if header “If-None-Match” is “*”
if-unmodified-since-exists? checks if header “If-Unmodified-Since” exists
if-unmodified-since-valid-date? checks if header “If-Unmodified-Since” is a valid HTTP date
is-options? checks if the request method is options
method-delete? checks if the request method is delete
method-put? checks if the request method is put
method-patch? checks if the request method is patch
post-to-gone? checks if the request method is post for resources that do not exist anymore
post-to-existing? checks if the request method is post for resources that do exist
post-to-missing? checks if the request method is post for resources that do not exist
put-to-existing? checks if the request method is put for resources that exists

The flowchart: a decision graph

The Liberator flowchart - mousewheel to zoom, click-and-drag to pan. (if you don’t see anything below, please open it)