private boolean loadCustomErrorPage ( CmsObject cms , HttpServletRequest req , HttpServletResponse res , String rootPath ) { try { // get the site of the error page resource CmsSite errorSite = OpenCms . getSiteManager ( ) . getSiteForRootPath ( rootPath ) ; cms . getRequestContext ( ) . setSiteRoot ( errorSite . getSiteRoot ( ) ) ; String relPath = cms . getRequestContext ( ) . removeSiteRoot ( rootPath ) ; if ( cms . existsResource ( relPath ) ) { cms . getRequestContext ( ) . setUri ( relPath ) ; OpenCms . getResourceManager ( ) . loadResource ( cms , cms . readResource ( relPath ) , req , res ) ; return true ; } else { return false ; } } catch ( Throwable e ) { // something went wrong log the exception and return false LOG . error ( e . getMessage ( ) , e ) ; return false ; } }
Tries to load the custom error page at the given rootPath .