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

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