Make RESTful operations return 404 Not Found when the target resource
does not exist.

In the original implementation, GET, DELETE and PUT operations on
non-existent resources used to return 500 but not 404.
Merge pull request #486 from yugui/fix/404-if-notfound

Make RESTful operations return 404 Not Found when the target resource does not exist.