I'm writing a servlet-filter as the solution of this question:
Is it a good idea to filter inside a JSF template?
now, the idea is to create a big filter to check all privilegies and give the access or not to a certain user. I create a Map to contains all privilegies for all sub applications and it has the sub application's id (a Long value) as Key and for the value another Map that contains other important informations. The controller classes are named class1Controller, class2Controller ecc and the subapplications are stored in many folder named class1, class2 ecc... The last thing that I must say is that all classes have a parameter called applicationID that is the same key of the Map that I mentioned previously. So, what I would do? I can retrieve the subapplication visited by the user using getRequestURI() method from HttpServletRequest, the problem is that I should take the application id from the class linked to that application, so I wrote this code:
Long id= ((Class.forName(packageName+applicationName+"Controller"))session.getAttribute(applicationName+"Controller")).getApplicationId();
The problem is that the compiler returns that it can't find method getApplicationId()! Can I do something to resolve this problem? Or I must find another way to do that?