Bug 204119 Unable to change baseURL using HTMLRenderOption.setBaseUrl() from value set in first HTTPRequest/HTTPResopnse cycle
I have two portlets running in the same application context (they are packaged in the same war file). Both portlets share the same instance of IReportEngine. Within Portlet 1 I create a runAndRenderTask as follows: IRunAndRenderTask task = birtEngine.createRunAndRenderTask( design ) HTMLRenderOption options = new HTMLRenderOption(); options.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML ); options.setEmbeddable( true ); //options.setBaseURL( response.createRenderURL().toString() + "&" ); options.setBaseURL( "portlet1" ); options.setHtmlPagination( true ); options.setHtmlRtLFlag( false ); task.setRenderOption(options); Within Portlet 2 I create a runAndRenderTask in an identical manner except I set the baseURl to something different. E.g: IRunAndRenderTask task = birtEngine.createRunAndRenderTask( design ) HTMLRenderOption options = new HTMLRenderOption(); options.setOutputFormat( HTMLRenderOption.OUTPUT_FORMAT_HTML ); options.setEmbeddable( true ); //options.setBaseURL( response.createRenderURL().toString() + "&" ); options.setBaseURL( "portlet2" ); options.setHtmlPagination( true ); options.setHtmlRtLFlag( false ); task.setRenderOption(options); When I start up the application and first view the report generated by Portlet 1 and then view the report generated by Portlet 2 the baseUrl for the report shown in Portlet 2 is the base url that was set in when generating the report in Portlet 1. Similarly if I restart the application and then navigate to Portlet 2 and then Portlet 1, the base url for the report shown in Portlet 1 is equal to that set when generating reports in Portlet 2. The baseUrl is being cached and can only be set once using HTMLRenderOption.setBaseUrl(). One workaround is to retrieve HTMLRenderContext from the task ( via the application context) and then set the base URl using HTMLRenderContext.setBaseURl as follows: IRunAndRenderTask task = birtEngine.createRunAndRenderTask( design ) Map appContext = task.getAppContext(); for ( Iterator i= appContext.keySet().iterator(); i.hasNext(); ) { String key = (String) i.next(); logger.info( "key = " + key ); logger.info( "value = " + appContext.get( key ) ); if ( key.equals( "HTML_RENDER_CONTEXT") ) { logger.info( "inspecting html_render_context" ); HTMLRenderContext context = (HTMLRenderContext) appContext.get( key ); logger.info( "HTML_RENDER_CONTEXT BASE URL = " + context.getBaseURL() ); context.setBaseURL( response.createRenderURL().toString() + "&" ); logger.info( "HTML_RENDER_CONTEXT BASE URL = " + context.getBaseURL() ); } } I have two concerns with this work around: 1) HTMLRenderContext is deprecated in Birt 2.2. 2) Concurrency issues - while the two portlets share the same application context, they require independent baseURls so if you have one user rendering a report in portlet 1 and another user rendering a report in portlet 2 simultaneously, only one of them is going to have the correct baseUrl. Surely storing the baseURL in the application context is a problem in itself and the base URL should be specific to each IEngineTask? Environment: Birt 2.2, JBoss Portal 2.4.2 running on JBoss AS 4.0.4
engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/impl/EngineTask.java
* the execution context
	 */
	protected ExecutionContext executionContext;
	/**
	 * task identifier. Could be used for logging
	 */
	protected int taskID;
	protected IReportRunnable runnable;
	/**
	 * options used to render the report design.
	 */
	protected IRenderOption renderOptions;
	/**
	 * emitter id
	 */
	protected String emitterID;
	/**
	 * does the parameter has been changed by the user.
	 */
	protected boolean parameterChanged = true;
	/**
	 * The parameter values that the caller has set explicitly
	 */
	protected HashMap inputValues = new HashMap( );
	/**
	 * The parameter values that will be used to run the report. It is a merged
	 * map between the input value and the default values.
	 */
	protected HashMap runValues = new HashMap( );
	/**