Home
Analytics
Birt 2.6.1: Hyperlink not working for iframe html report
vivash
Hi,<br />
<br />
We are testing with Birt 2.6.1 and seems like the hyperlink from label, dynamic data in the html report (inside iframe) are not working. The same hyperlinks work fine when the report is viewed in Birt viewer. Interestingly, the chart interactivity work fine, it's the text (label, dynamic text) hyperlink that's not working for html report in iframe. For ex, in birt viewer the hyperlink is shown as,<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
https://10.0.xx.xx/reports/frameset?__report=Dashboard/DashboardCGApp.rptdesign&__format=html&RP_tz=GMT-07:00&RP_st=2010-09-28+16:52:49.033&RP_sid=f5efbf35fd301947_62f9a-78b0&RP_et=2010-09-28+17:52:49.033&__overwrite=true&__locale=en_US&__svg=false&__designer=false&__pageoverflow=0&__masterpage=true
</pre>
<br />
<br />
whereas, in iframe it's shown as,<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
https://10.0.xx.xx/reports/frameset?__report=/opt/ps_manager/apps/reports/Dashboard/DashboardCGApp.rptdesign&__format=html&RP_tz=[America/Los_Angeles]&RP_st=[Tue+Sep+28+16:21:06+PDT+2010]&RP_sid=[f5efbf35fd301947_62f9a-78b0]&RP_et=[Tue+Sep+28+17:21:06+PDT+2010]&__overwrite=true
</pre>
<br />
The error I get in iframe is "RP_st" is not the right datetime. Note, the brackets "[xx]" in the url for each parameter value and the date time format is also different.<br />
<br />
This all used to work in Birt 2.6.0, but is broken in Birt 2.6.1. Anyone know of any change around this in 2.6.1?<br />
<br />
Thanks,<br />
-vivek
Find more posts tagged with
Comments
vivash
Little more information - we have the following settings for html,<br />
<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
HTMLRenderOption renderOption = new HTMLRenderOption();
if(outputType.equals(REPORT_OUTPUT_TYPE.HTML.typeName())){
renderOption.setEmbeddable(true);
renderOption.setBaseImageURL(baseImageUrl);
renderOption.setImageDirectory(imageDirectory);
renderOption.setBaseURL(baseUrl+"/frameset");
renderOption.setSupportedImageFormats( "PNG;GIF;JPG;BMP;SWF");
}
</pre>
<br />
any issue there or need to change anything?
JasonW
I just tried this with 2.6.1 and did not see the brackets.
Are you setting your own action handler?
Jason
vivash
No, we don't have any action handlers defined. Just putting mouse over the hyperlink shows the complete url with brackets in there (as I posted above). The exact same report in iframe works fine in 2.6.0. Anything else I can look for?
JasonW
Can you run the code in a standalone app and produce the html output and look at the links? Also are the parameters multi-select parameters? Also try adding this to your options:
options.setActionHandler(new HTMLActionHandler());
Jason
vivash
I ran stand-alone in html (without iframe) and it's the same issue (parameter values have brackets in there). I also tried with the action handler option you suggested, but it's still the same problem. <br />
<br />
Looks like this problem is happening only if we use "IRunAndRenderTask" to run the report. If we run directly using Birt viewer we don't see the problem. Here is our code,<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
IRunAndRenderTask runRenderTask = null;
try {
IReportRunnable rptDesign = null;
rptDesign = this.birtEngine.openReportDesign(designFile.getAbsolutePath());
runRenderTask = this.birtEngine.createRunAndRenderTask(rptDesign);
HTMLRenderOption renderOption = new HTMLRenderOption();
renderOption.setOutputFileName(outputFile.getAbsolutePath());
renderOption.setOutputFormat(outputType);
if(outputType.equals(REPORT_OUTPUT_TYPE.HTML.typeName())){
renderOption.setEmbeddable(true);
renderOption.setBaseImageURL(baseImageUrl);
renderOption.setImageDirectory(imageDirectory);
renderOption.setBaseURL(baseUrl+"/frameset");
renderOption.setSupportedImageFormats( "PNG;GIF;JPG;BMP;SWF");
renderOption.setActionHandler(new HTMLActionHandler());
}
runRenderTask.setRenderOption(renderOption);
if(paramValues != null && paramValues.size() > 0){
runRenderTask.setParameterValues(paramValues);
}
runRenderTask.run();
</pre>
<br />
Any problem in the code?
JasonW
Can you try this class with the attached report?
package REAPI;
import java.util.logging.Level;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLActionHandler;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
public class RunAndRenderTaskDrill {
public void runReport() throws EngineException
{
IRunAndRenderTask task=null;
IReportEngine engine=null;
EngineConfig config = null;
try{
config = new EngineConfig( );
config.setBIRTHome("C:\\birt\\birt-runtime-2_6_1\\birt-runtime-2_6_1\\ReportEngine");
config.setLogConfig(null, Level.FINEST);
Platform.startup( config );
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
IReportRunnable design = null;
//Open the report design
design = engine.openReportDesign("Reports/master.rptdesign");
ReportDesignHandle rdh = (ReportDesignHandle)design.getDesignHandle();
//Create task to run and render the report,
task = engine.createRunAndRenderTask(design);
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFileName("output/resample/master.html");
options.setOutputFormat("html");
options.setHtmlRtLFlag(false);
options.setEnableAgentStyleEngine(true);
options.setEmbeddable(true);
options.setBaseURL("
http://localhost:8080/birt2.6.1/frameset")
;
options.setActionHandler(new HTMLActionHandler());
task.setRenderOption(options);
task.run();
task.close();
engine.destroy();
}catch( Exception ex){
ex.printStackTrace();
}
finally
{
Platform.shutdown( );
System.out.println("Finished");
}
}
/**
*
@param
args
*/
public static void main(String[] args) {
try
{
RunAndRenderTaskDrill ex = new RunAndRenderTaskDrill( );
ex.runReport();
}
catch ( Exception e )
{
e.printStackTrace();
}
}
}
JasonW
Attached report
vivash
Jason, the attached code worked fine. Looks like the problem comes in when you got a "Data Time" parameter, which is set to "Required" and then you bind it to the hyperlink. After I removed the "Is Required" attribute the hyperlink started working fine. So, the combination that breaks - html, text hyperlink, Date Time parameter, Is Required checked for the date time parameter.
Any change that might have caused this?
Thanks.
JasonW
How are you setting the parameter?
Jason
vivash
The parameters are set inside initialize() method (javascript) of the parent report and passed on to the drill-down via parameter binding.
JasonW
Can you try setting them in the API before you call the master report?
Jason
vivash
We use API only to retrieve parameters and execute the report. The parameter values for this report is required to be set in the report script itself. Would it be a problem setting the parameter value in the javascript of the report? Looks like the script engine issue? Is it?
JasonW
If your parameter is required the engine is always going to complain if you do not set the parameter first (you should still be able to change it in the script).
Jason
vivash
We are passing the required parameter, but for some reason in Birt 2.6.1 the hyperlink has square brackets around the passed requirement parameter value (and the date format is different too). As soon as I remove isRequired, the hyperlink doesn't seem to have the square brackets - I posted the examples above in the thread.
This used to work fine in Birt 2.6.0 and prior. It's breaking in 2.6.1.
JasonW
I did not see the example report. Can you build one or modify the one I posted to see if I can reproduce the issue?
Jason
vivash
Hey Jason,<br />
<br />
Just getting back to this issue. I see this being a problem in Birt 2.6.1 - do you know if there has been any fix regarding this? Just to summarize,<br />
<br />
1) I ran your stand-alone application with master.rptdesign. The Master reports generates fine, but the drill-down hyperlink still have issues. The parameter value in the drill-down hyperlink have square brackets,<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
http://localhost:8080/birt2.6.1/frameset?__report=/C:/temp/birt/Reports/detail.rptdesign&__format=html&order=[10106]&__overwrite=true
</pre>
<br />
JasonW
Vivek,<br />
<br />
This does appear to be a bug. The default HTMLActionHandler should be checking if the parameter is a list object. The viewer action handler does this. Could you log a bug for this? Just enter something like:<br />
ViewerHTMLActionHandler in the viewer handles processing parameters as a list whereas the report engine<br />
HTMLActionHandler does not. The HTMLActionHandler class needs to be updated.<br />
<br />
<br />
As a work around add your own action handler like the one I present below.<br />
Set it in your code like:<br />
options.setActionHandler(new MyActionHandler());<br />
<br />
//Action Handler Class<br />
<br />
import java.io.File;<br />
import java.io.UnsupportedEncodingException;<br />
import java.net.MalformedURLException;<br />
import java.net.URL;<br />
import java.net.URLEncoder;<br />
import java.util.Iterator;<br />
import java.util.List;<br />
import java.util.Map;<br />
import java.util.logging.Logger;<br />
<br />
import org.eclipse.birt.report.engine.api.EngineConstants;<br />
import org.eclipse.birt.report.engine.api.HTMLActionHandler;<br />
import org.eclipse.birt.report.engine.api.HTMLRenderContext;<br />
import org.eclipse.birt.report.engine.api.IAction;<br />
import org.eclipse.birt.report.engine.api.IHTMLActionHandler;<br />
import org.eclipse.birt.report.engine.api.PDFRenderContext;<br />
import org.eclipse.birt.report.engine.api.script.IReportContext;<br />
import org.eclipse.birt.report.model.api.util.ParameterValidationUtil;<br />
<br />
import com.ibm.icu.math.BigDecimal;<br />
<br />
/**<br />
* Defines a default action handler for HTML output format<br />
*/<br />
public class MyActionHandler implements IHTMLActionHandler<br />
{<br />
<br />
/** logger */<br />
protected Logger log = Logger<br />
.getLogger( HTMLActionHandler.class.getName( ) );<br />
<br />
/**<br />
* Get URL of the action.<br />
* <br />
*
@param
actionDefn<br />
*
@param
context<br />
*
@return
URL<br />
*/<br />
public String getURL( IAction actionDefn, IReportContext context )<br />
{<br />
Object renderContext = getRenderContext( context );<br />
return getURL( actionDefn, renderContext );<br />
}<br />
<br />
/*<br />
* (non-Javadoc)<br />
* <br />
*
@see
org.eclipse.birt.report.engine.api2.IHTMLActionHandler#getURL(org.eclipse.birt.report.engine.api2.IAction,<br />
* java.lang.Object)<br />
*/<br />
public String getURL( IAction actionDefn, Object context )<br />
{<br />
if ( actionDefn == null )<br />
{<br />
return null;<br />
}<br />
String url = null;<br />
switch ( actionDefn.getType( ) )<br />
{<br />
case IAction.ACTION_BOOKMARK :<br />
if ( actionDefn.getActionString( ) != null )<br />
{<br />
url = "#" + actionDefn.getActionString( );<br />
}<br />
break;<br />
case IAction.ACTION_HYPERLINK :<br />
url = actionDefn.getActionString( );<br />
break;<br />
case IAction.ACTION_DRILLTHROUGH :<br />
url = buildDrillAction( actionDefn, context );<br />
break;<br />
default :<br />
return null;<br />
}<br />
return url;<br />
}<br />
<br />
/**<br />
* builds URL for drillthrough action<br />
* <br />
*
@param
action<br />
* instance of the IAction instance<br />
*
@param
context<br />
* the context for building the action string<br />
*
@return
a URL<br />
*/<br />
protected String buildDrillAction( IAction action, Object context )<br />
{<br />
String baseURL = null;<br />
if ( context != null )<br />
{<br />
if ( context instanceof HTMLRenderContext )<br />
{<br />
baseURL = ( (HTMLRenderContext) context ).getBaseURL( );<br />
}<br />
if ( context instanceof PDFRenderContext )<br />
{<br />
baseURL = ( (PDFRenderContext) context ).getBaseURL( );<br />
}<br />
}<br />
<br />
if ( baseURL == null )<br />
{<br />
baseURL = "run";<br />
}<br />
StringBuffer link = new StringBuffer( );<br />
String reportName = getReportName( action );<br />
<br />
if ( reportName != null && !reportName.equals( "" ) ) //$NON-NLS-1$<br />
{<br />
String format = action.getFormat( );<br />
if ( !"html".equalsIgnoreCase( format ) )<br />
{<br />
link.append( baseURL.replaceFirst( "frameset", "run" ) ); //$NON-NLS-1$ //$NON-NLS-2$<br />
}<br />
else<br />
{<br />
link.append( baseURL );<br />
}<br />
<br />
link<br />
.append( reportName.toLowerCase( )<br />
.endsWith( ".rptdocument" ) ? "?__document=" : "?__report=" ); //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$<br />
<br />
try<br />
{<br />
link.append( URLEncoder.encode( reportName, "UTF-8" ) ); //$NON-NLS-1$<br />
}<br />
catch ( UnsupportedEncodingException e1 )<br />
{<br />
// It should not happen. Does nothing<br />
}<br />
<br />
// add format support<br />
if ( format != null && format.length( ) > 0 )<br />
{<br />
link.append( "&__format=" + format ); //$NON-NLS-1$<br />
}<br />
<br />
// Adds the parameters<br />
if ( action.getParameterBindings( ) != null )<br />
{<br />
Iterator paramsIte = action.getParameterBindings( ).entrySet( )<br />
.iterator( );<br />
while ( paramsIte.hasNext( ) )<br />
{<br />
Map.Entry entry = (Map.Entry) paramsIte.next( );<br />
try<br />
{<br />
String key = (String) entry.getKey( );<br />
Object valueObj = entry.getValue( );<br />
<br />
<br />
if ( valueObj != null )<br />
{<br />
if ( valueObj instanceof List )<br />
{<br />
if ( ( (List) valueObj ).size( ) == 1 )<br />
{<br />
valueObj = ( (List) valueObj ).get( 0 );<br />
}<br />
else<br />
{<br />
valueObj = ( (List) valueObj ).toArray( );<br />
}<br />
}<br />
<br />
Object[] values;<br />
if ( valueObj instanceof Object[] )<br />
{<br />
values = (Object[]) valueObj;<br />
}<br />
else<br />
{<br />
values = new Object[1];<br />
values[0] = valueObj;<br />
}<br />
<br />
for ( int i = 0; i < values.length; i++ )<br />
{<br />
// TODO: here need the get the format from the<br />
// parameter.<br />
String value = getDisplayValue( values
);<br />
<br />
if ( value != null )<br />
{<br />
link<br />
.append( "&" + URLEncoder.encode( key, "UTF-8" ) <br />
+ "=" + URLEncoder.encode( value, "UTF-8" ) ); <br />
}<br />
<br />
}<br />
} <br />
<br />
}<br />
catch ( UnsupportedEncodingException e )<br />
{<br />
// Does nothing<br />
}<br />
}<br />
}<br />
<br />
// Adding overwrite.<br />
link.append( "&__overwrite=true" ); //$NON-NLS-1$<br />
<br />
// The search rules are not supported yet.<br />
if ( /*<br />
* !"pdf".equalsIgnoreCase( format ) &&<br />
*/action.getBookmark( ) != null )<br />
{<br />
<br />
try<br />
{<br />
// In RUN mode, don't support bookmark as parameter<br />
if ( baseURL.lastIndexOf( "run" ) > 0 )<br />
{<br />
link.append( "#" ); //$NON-NLS-1$<br />
}<br />
else<br />
{<br />
link.append( "&__bookmark=" ); //$NON-NLS-1$<br />
}<br />
<br />
link.append( URLEncoder.encode( action.getBookmark( ),<br />
"UTF-8" ) ); //$NON-NLS-1$<br />
}<br />
catch ( UnsupportedEncodingException e )<br />
{<br />
// Does nothing<br />
}<br />
}<br />
}<br />
<br />
return link.toString( );<br />
}<br />
<br />
/**<br />
* Append report design name into a StringBuffer.<br />
* <br />
*
@param
buffer <br />
*
@param
reportName<br />
*/<br />
protected void appendReportDesignName( StringBuffer buffer,<br />
String reportName )<br />
{<br />
buffer.append( "?__report=" ); //$NON-NLS-1$<br />
try<br />
{<br />
buffer.append( URLEncoder.encode( reportName, "UTF-8" ) ); //$NON-NLS-1$<br />
}<br />
catch ( UnsupportedEncodingException e1 )<br />
{<br />
// It should not happen. Does nothing<br />
}<br />
}<br />
<br />
/**<br />
* Append format.<br />
* <br />
*
@param
buffer<br />
*
@param
format<br />
*/<br />
protected void appendFormat( StringBuffer buffer, String format )<br />
{<br />
if ( format != null && format.length( ) > 0 )<br />
{<br />
buffer.append( "&__format=" + format );//$NON-NLS-1$<br />
}<br />
}<br />
<br />
/**<br />
* Append parameter.<br />
* <br />
*
@param
buffer<br />
*
@param
key<br />
*
@param
valueObj<br />
*/<br />
protected void appendParamter( StringBuffer buffer, String key,<br />
Object valueObj )<br />
{<br />
if ( valueObj != null )<br />
{<br />
try<br />
{<br />
key = URLEncoder.encode( key, "UTF-8" );<br />
String value = valueObj.toString( );<br />
value = URLEncoder.encode( value, "UTF-8" );<br />
buffer.append( "&" );<br />
buffer.append( key );<br />
buffer.append( "=" );<br />
buffer.append( value );<br />
}<br />
catch ( UnsupportedEncodingException e )<br />
{<br />
// Does nothing<br />
}<br />
}<br />
}<br />
<br />
/**<br />
* Append bookmark as parameter .<br />
* <br />
*
@param
buffer<br />
*
@param
bookmark<br />
*/<br />
protected void appendBookmarkAsParamter( StringBuffer buffer,<br />
String bookmark )<br />
{<br />
try<br />
{<br />
if ( bookmark != null && bookmark.length( ) != 0 )<br />
{<br />
bookmark = URLEncoder.encode( bookmark, "UTF-8" );<br />
buffer.append( "&__bookmark=" );//$NON-NLS-1$<br />
buffer.append( bookmark );<br />
}<br />
}<br />
catch ( UnsupportedEncodingException e )<br />
{<br />
<br />
}<br />
}<br />
<br />
/**<br />
* Append bookmark.<br />
* <br />
*
@param
buffer<br />
*
@param
bookmark<br />
*/<br />
protected void appendBookmark( StringBuffer buffer, String bookmark )<br />
{<br />
try<br />
{<br />
if ( bookmark != null && bookmark.length( ) != 0 )<br />
{<br />
bookmark = URLEncoder.encode( bookmark, "UTF-8" );<br />
buffer.append( "#" );//$NON-NLS-1$<br />
buffer.append( bookmark );<br />
}<br />
}<br />
catch ( UnsupportedEncodingException e )<br />
{<br />
}<br />
}<br />
<br />
/**<br />
* Get report name.<br />
* <br />
*
@param
action<br />
*
@return<
;br />
*/<br />
String getReportName( IAction action )<br />
{<br />
String systemId = action.getSystemId( );<br />
String reportName = action.getReportName( );<br />
if ( systemId == null )<br />
{<br />
return reportName;<br />
}<br />
// if the reportName is an URL, use it directly<br />
try<br />
{<br />
URL url = new URL( reportName );<br />
if ( "file".equals( url.getProtocol( ) ) )<br />
{<br />
return url.getFile( );<br />
}<br />
return url.toExternalForm( );<br />
}<br />
catch ( MalformedURLException ex )<br />
{<br />
}<br />
// if the system id is the URL, merget the report name with it<br />
try<br />
{<br />
URL root = new URL( systemId );<br />
URL url = new URL( root, reportName );<br />
if ( "file".equals( url.getProtocol( ) ) )<br />
{<br />
return url.getFile( );<br />
}<br />
return url.toExternalForm( );<br />
}<br />
catch ( MalformedURLException ex )<br />
{<br />
<br />
}<br />
// now the root should be a file and the report name is a file also<br />
File file = new File( reportName );<br />
if ( file.isAbsolute( ) )<br />
{<br />
return reportName;<br />
}<br />
<br />
try<br />
{<br />
URL root = new File( systemId ).toURL( );<br />
URL url = new URL( root, reportName );<br />
assert "file".equals( url.getProtocol( ) );<br />
return url.getFile( );<br />
}<br />
catch ( MalformedURLException ex )<br />
{<br />
}<br />
return reportName;<br />
}<br />
<br />
/**<br />
* Get render context.<br />
* <br />
*
@param
context<br />
*
@return<
;br />
*/<br />
protected Object getRenderContext( IReportContext context )<br />
{<br />
if ( context == null )<br />
{<br />
return null;<br />
}<br />
Map appContext = context.getAppContext( );<br />
if ( appContext != null )<br />
{<br />
String renderContextKey = EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT;<br />
String format = context.getOutputFormat( );<br />
if ( "pdf".equalsIgnoreCase( format ) )<br />
{<br />
renderContextKey = EngineConstants.APPCONTEXT_PDF_RENDER_CONTEXT;<br />
}<br />
return appContext.get( renderContextKey );<br />
}<br />
return null;<br />
}<br />
<br />
/**<br />
* Get display value.<br />
* <br />
*
@param
value<br />
*
@return<
;br />
*/<br />
String getDisplayValue( Object value )<br />
{<br />
if ( value == null )<br />
return null;<br />
<br />
if ( value instanceof Float || value instanceof Double<br />
|| value instanceof BigDecimal )<br />
{<br />
return value.toString( );<br />
}<br />
return ParameterValidationUtil.getDisplayValue( value );<br />
}<br />
<br />
}<br />
<br />
<br />
<br />
Jason
vivash
Thanks Jason! I've filed a bug,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=335732
I also tried your new HTMLActionHandler and it seems to work fine. I'll continue to use this until the Birt code is fixed in next release.
Thanks again for the help.
-vivek
vivash
Hello Jason,<br />
<br />
We found another problem related to this same issue. When rendering rpt document output type in Birt viewer we get the following exception when the report contains a drill-down,<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.
at org.eclipse.birt.report.service.ReportEngineService.throwDummyException(ReportEngineService.java:1096)
at org.eclipse.birt.report.service.ReportEngineService.renderReport(ReportEngineService.java:1543)
at org.eclipse.birt.report.service.BirtViewerReportService.getPage(BirtViewerReportService.java:204)
at org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.doExecution(AbstractGetPageActionHandler.java:238)
at org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.__execute(AbstractGetPageActionHandler.java:105)
at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143)
at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPage(BirtDocumentProcessor.java:87)
at sun.reflect.GeneratedMethodAccessor1059.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112)
at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66)
at sun.reflect.GeneratedMethodAccessor1058.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
at org.eclipse.birt.report.engine.api.impl.RenderTask.render(RenderTask.java:296)
at org.eclipse.birt.report.service.ReportEngineService.renderReport(ReportEngineService.java:1537)
... 46 more
Caused by: java.lang.NullPointerException
at org.eclipse.birt.report.service.ViewerHTMLActionHandler.getReportName(ViewerHTMLActionHandler.java:820)
at org.eclipse.birt.report.service.ViewerHTMLActionHandler.buildDrillAction(ViewerHTMLActionHandler.java:561)
at org.eclipse.birt.report.service.ViewerHTMLActionHandler.getURL(ViewerHTMLActionHandler.java:210)
at org.eclipse.birt.report.engine.emitter.html.HTMLReportEmitter.validate(HTMLReportEmitter.java:3368)
at org.eclipse.birt.report.engine.emitter.html.HTMLReportEmitter.startText(HTMLReportEmitter.java:2477)
at org.eclipse.birt.report.engine.emitter.html.HTMLReportEmitter.startData(HTMLReportEmitter.java:2812)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:71)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLayoutEmitter.startContent(HTMLTableLayoutEmitter.java:146)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startText(ContentEmitterAdapter.java:147)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startData(ContentEmitterAdapter.java:163)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:71)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLayoutEmitter.startContent(HTMLTableLayoutEmitter.java:146)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startText(ContentEmitterAdapter.java:147)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startData(ContentEmitterAdapter.java:163)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:71)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLayoutEmitter.startContent(HTMLTableLayoutEmitter.java:146)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startText(ContentEmitterAdapter.java:147)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startData(ContentEmitterAdapter.java:163)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:71)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLayoutEmitter.startContent(HTMLTableLayoutEmitter.java:146)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startText(ContentEmitterAdapter.java:147)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startData(ContentEmitterAdapter.java:163)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:71)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLayoutEmitter.startContent(HTMLTableLayoutEmitter.java:146)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startText(ContentEmitterAdapter.java:147)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startData(ContentEmitterAdapter.java:163)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:71)
at org.eclipse.birt.report.engine.layout.html.buffer.DummyPageBuffer.startContent(DummyPageBuffer.java:125)
at org.eclipse.birt.report.engine.layout.html.HTMLLeafItemLM.start(HTMLLeafItemLM.java:67)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:139)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLListLM.layoutChildren(HTMLListLM.java:72)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99)
at org.eclipse.birt.report.engine.api.impl.RenderTask$PageRangeRender.render(RenderTask.java:662)
at org.eclipse.birt.report.engine.api.impl.RenderTask.render(RenderTask.java:284)
... 47 more
</pre>
<br />
Since, we are using Birt Viewer to display this rptdocument type I can not apply the custom action handler you'd suggested earlier. <br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
IRunTask task = this.birtEngine.createRunTask(rptDesign);
task.run(documentFile.getAbsolutePath());
</pre>
<br />
Is there a work-around to fix this issue?<br />
<br />
Thanks,<br />
-vivek
vivash
Any suggestion on this anyone?
Thanks.
JasonW
Vivek,
You could still add your own action handler but it would be best to modify the viewer code for this. Any chance you could log another bug for this?
Jason
vivash
Thanks Jason. How would I add my own action handler for the viewer? I'm looking for a work around until this is fixed in the Birt itself. I've filed a new bug,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=341023
It would be great if I can get a workaround for now.
Thanks,
-vivek
JasonW
In the beforeFactory do something like:
importPackage(Packages.my.example.pojo);
var mah = new MyActionHandler();
reportContext.getRenderOption().setOption("actionHandler",mah);
Jason
vivash
Hello Jason,
The reportContext.getRenderOption() is always coming up as null - I tried to put that in both beforeFactory and initialize. Is there anything else I need to do to get the render option to set action handler?
Thanks.
vivash
Jason,
Any input on how to get the renderOption from reportContext? getRenderOption is always returning null in the beforeFactory. Also, is there a way to patch Birt 2.6.1? Apparently, this bug is fixed in Birt 2.6.2, but we can not update the whole Birt at this time so simply changing a file (or a jar) would be preferable.
Thanks,
-vivek
JasonW
Vivek,
How are you running the report? I run the report in the viewer with the code sample I posted earlier and it works fine.
Jason
vivash
Jason,<br />
<br />
The report gets run by the APIs,<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
task = this.birtEngine.createRunTask(rptDesign);
..
task.run(documentFile.getAbsolutePath());
</pre>
<br />
This generates a link, for ex.,<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
https://10.0.x.xx/reports/frameset?__document=scheduled/rptName_04062011055604980-3.rptdocument
</pre>
<br />
The problem comes when we click on the link to run the report in the Birt Viewer - the drill-down in the rendered report throw the NPE.<br />
<br />
Rendering directly on Birt Viewer (without API) or generating other format (pdf) from API work fine, it's the generating rptdocument from APIs is causing problem - and this is our most used as we use this to email the link to the user.<br />
<br />
Hope this helps understanding the issue. So, I'm trying to see what workaround can be used to solve this.<br />
<br />
Thanks,<br />
-vivek
JasonW
Vivek,
Maybe I am missing something but if you are running the apis why not just create your own action handler and set it in the api like:
IRenderOption options = new RenderOption();
options.setOutputFormat("html");
long pgcnt = document.getPageCount();
System.out.println(pgcnt);
//options.setOutputStream(arg0)
options.setOutputFileName("output/resample/mcb.html");
if( options.getOutputFormat().equalsIgnoreCase("html")){
HTMLRenderOption htmlOptions = new HTMLRenderOption( options);
htmlOptions.setImageDirectory("output/image");
htmlOptions.setHtmlPagination(false);
//set this if you want your image source url to be altered
htmlOptions.setBaseImageURL("
http://myhos/prependme?image=")
;
htmlOptions.setHtmlRtLFlag(false);
htmlOptions.setEmbeddable(false);
}else if( options.getOutputFormat().equalsIgnoreCase("pdf") ){
PDFRenderOption pdfOptions = new PDFRenderOption( options );
//options.setOutputStream(arg0)
pdfOptions.setOption( IPDFRenderOption.FIT_TO_PAGE, new Boolean(true) );
pdfOptions.setOption( IPDFRenderOption.PAGEBREAK_PAGINATION_ONLY, new Boolean(true) );
pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, IPDFRenderOption.FIT_TO_PAGE_SIZE);
}
options.setActionHandler(new MyActionHandler());
IRenderTask task = engine.createRenderTask(document)
Where MyActionHandler is your class.
Jason
JasonW
Ok I went back an re-read the thread and you are setting it in the api and then forwarding the rptdocument to the viewer. I am not certain if it will work but can you try to move the script to the beforeRender event?
Jason
vivash
Thanks Jason. Yes, I tried it in beforeRender, but the script doesn't gets executed there (I also tried it in initialize as it gets run before presentation phase also, but that didn't work either). This all used to work in Birt 2.3. I'm not sure if this is fixed in 2.6.2 or if we got any other workaround for this.
-vivek