Add a Controller class to the application
Add a couple of utility functions

These function are aimed at detecting the current request type.
Adapt the controllers to extend the Controller class