find resource name using rfind

this fixes a bug where app name and resource name are the same.
/projects/api/v1/projects/1/ should return projects/1/ not projects/api/v1/projects/1/
make sure we throw exception if not found
add test
Merge branch 'app-resource-same-name'