[BUGFIX] Resource locator validation and check template before generating cache class

__Tasks:__

- [x] test coverage
- [ ] gather feedback for my changes

__Depending PR:__

* https://github.com/sulu-cmf/sulu/pull/215

__Informations:__

| Q             | A
| ------------- | ---
| Tests pass?   | yes
| Fixed tickets | #208 , https://github.com/sulu-cmf/sulu-standard/issues/227 
| BC Breaks     | none
| Doc           | none