/** * Removes the IPentahoRequestContext for the current thread. It is important that the framework calls this to * prevent RequestContext bleed- through between requests as threads are re-used by the server. */ public static void removeRequestContext() { strategy.removeRequestContext(); }
/** * Sets an IPentahoRequestContext for the current thread * * @param requestContext */ public static void setRequestContext( IPentahoRequestContext requestContext ) { strategy.setRequestContext( requestContext ); }
/** * Returns the IPentahoRequestContext for the current thread * * @return thread requestContext */ public static IPentahoRequestContext getRequestContext() { if ( strategy != null && strategy.getRequestContext() != null ) { return strategy.getRequestContext(); } else { if ( PentahoSystem.getInitializedOK() ) { return new BasePentahoRequestContext( PentahoSystem.getApplicationContext().getFullyQualifiedServerURL() ); } else { try{ logger.debug( "Something went wrong. Trying to proceed. System is in status " + PentahoSystem.getInitializedStatus() ); if( PentahoSystem.getApplicationContext() != null && PentahoSystem.getApplicationContext().getFullyQualifiedServerURL() != null ){ return new BasePentahoRequestContext( PentahoSystem.getApplicationContext().getFullyQualifiedServerURL() ); } } catch(Exception ex){ logger.debug( "Restore attempt failed ", ex ); } return null; } } }