private boolean isVisibleForSite ( final HttpServletRequest request , final Page page ) { final Site site = page . getSite ( ) ; if ( site == null ) { return true ; } final String serverName = request . getServerName ( ) ; final int serverPort = request . getServerPort ( ) ; if ( StringUtils . isNotBlank ( serverName ) && ! serverName . equals ( site . getHostname ( ) ) ) { return false ; } final Integer sitePort = site . getPort ( ) ; if ( sitePort != null && serverPort != sitePort ) { return false ; } return true ; }
Check if the given page is visible for the requested site defined by a hostname and a port .