public void handleError ( final Throwable error ) throws IOException { LOG . debug ( "Start handleError..." ) ; // Should the session be removed upon error? boolean terminate = ConfigurationProperties . getTerminateSessionOnError ( ) ; // If we are unfriendly, terminate the session if ( terminate ) { invalidateSession ( ) ; } // Are we in developer friendly error mode? boolean friendly = ConfigurationProperties . getDeveloperErrorHandling ( ) ; FatalErrorPageFactory factory = Factory . newInstance ( FatalErrorPageFactory . class ) ; WComponent errorPage = factory . createErrorPage ( friendly , error ) ; String html = renderErrorPageToHTML ( errorPage ) ; // Setup the response Response response = getResponse ( ) ; response . setContentType ( WebUtilities . CONTENT_TYPE_HTML ) ; // Make sure not cached getResponse ( ) . setHeader ( "Cache-Control" , CacheType . NO_CACHE . getSettings ( ) ) ; getResponse ( ) . setHeader ( "Pragma" , "no-cache" ) ; getResponse ( ) . setHeader ( "Expires" , "-1" ) ; getPrintWriter ( ) . println ( html ) ; LOG . debug ( "End handleError" ) ; }
Last resort error handling .