Unable to update HTMLRenderOption baseUrl [message #255842] |
Wed, 19 September 2007 11:02  |
Eclipse User |
|
|
|
I hope somebody is able to help me here as this is a bit of a show stopper
for me:
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. (I have adapted
the BirtReportEngine wrapper class used in the examples and injected it
into each portlet instance using Spring Portlet MVC).
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 runAndderTask 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 my application and first navigate in the portal to Portlet
1 and then to Portlet 2. The baseUrl for the report shown in Portlet 2 is
the base url that was set in when generating reports in Portlet 1.
If I restart my 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.
Since Portlet2 is on a sub page of the page Portlet 1 is onI need to be
able to update the baseUrls independently otherwise my drilldown urls do
not work.
It appears that the IReportEngine is caching the baseUrl. This might make
sense in a Servlet context but not for portlets.
????
Any help would be greatly appreciated.
I am using Birt 2.2, JBoss Portal 2.4.2 running on JBoss AS 4.0.4
|
|
|
Re: Unable to update HTMLRenderOption baseUrl [message #255868 is a reply to message #255842] |
Thu, 20 September 2007 09:54  |
Eclipse User |
|
|
|
Please see email correspondence below:
Bug entered into bugzilla:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=204119
-----Original Message-----
From: Jason Weathersby
Sent: 20 September 2007 14:19
To: Dewar, Allan
Subject: Re: Help - Unable to update Base URL once set in application
context
Allan,
This is most likely a bug. To enter it go to
http://www.eclipse.org/birt/phoenix/reportabug.php
If you do not have a bugzilla account, do the sign up and then select the
second link to report the bug.
Be sure to specify BIRT 2.2.
You can change the appcontex in a report as well, but this may be a lot of
work for a work around.
Jason
Dewar, Allan wrote:
> Hi Jason
>
> Thanks for your help. I am attempting to reset the base URL using the
> setBaseURL method on the HTMLRenderOption object. The problem is it
> that once I have set the base URL on a HTMLRenderOption object any
> attempt to set the base url on a different instance of an
> HTMLRenderOption in a subsequent HTTPRequest/HTTPResponse cycle is
> ignored.
>
> After your suggestion I retrieved the application context from the task
> as follows:
>
> 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() );
> }
> }
>
> While there is not baseURl directly in the appContext map, I noticed
> that the appContext map contains a HTMLRenderContext object. If I
> update the baseURL using the setBaseUrl on the HTMLRenderContext object
> stored in the appContext map the update happens and the urls in my
> report are correct.
>
> However I have two concerns with this work around:
>
> 1) HTMLRenderContext is deprecated in Birt 2.2.
> 2) Concurrency issues - while my two portlets share the same application
> context, they require independent baseURls so if I 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?
>
> I will log this in Bugzilla as soon as I figure out how.
>
> Thank you very much for your help
>
>
> Allan
>
>
> -----Original Message-----
> From: Jason Weathersby Sent:
> 19 September 2007 22:58
> To: Dewar, Allan
> Subject: Re: Help - Unable to update Base URL once set in application
> context
>
> Allan,
>
> Can you not reset it with the setBaseURL method?
> You can also access the appcontext using the task.
> It should be in the app context as baseUrl.
>
> You still may want to log a bugzilla entry on this as well.
>
> Jason
>
|
|
|
Powered by
FUDForum. Page generated in 0.03036 seconds