for (Functionality functionality : RootDomainObject.getInstance().getFunctionalities()) { if (! functionality.isPrincipal()) { continue; }  String matchPath = functionality.getMatchPath();  if (matchPath != null && matchPath.equals(requestedPath)) { return functionality; }
Functionality matching = getMatchingFunctionality(requestedPath, nonRelativeFunctionalities); if (matching != null) { return matching; }  matching = getMatchingFunctionality(requestedPath, Functionality.getTopLevelFunctionalities()); if (matching != null) { return matching; }  matching = getMatchingSubFunctionality(requestedPath, Module.getTopLevelModules()); if (matching != null) { return matching;
    private Functionality getFunctionality(HttpServletRequest servletRequest) {        String requestedPath = servletRequest.getServletPath();        if (hasTestingPrefix(servletRequest)) {            requestedPath = requestedPath.substring(getTestingPrefix().length());        }                // HACK: dotIstPortal.do is a redirection and does not map directly to a functionality        if (requestedPath.matches("/dotIstPortal.do")) {            requestedPath = servletRequest.getParameter("prefix") + servletRequest.getParameter("page");        }                for (Functionality functionality : RootDomainObject.getInstance().getFunctionalities()) {            if (! functionality.isPrincipal()) {                continue;            }                        String matchPath = functionality.getMatchPath();                        if (matchPath != null && matchPath.equals(requestedPath)) {                return functionality;            }        }        return null;    }