We are migrating some of our reports from a custom servlet integration to the tag library style. The only problem we are having is with the drill throughs.<br />
<br />
The url that is being generated looks something like:<br />
/viewReport?__design=path/to/ReportDesign.rptdesign&somethings=Here&more=yes<br />
We need it to look like<br />
/path/to/ReportDesign.rptdesign.do?somethings=Here&more=yes<br />
In our old implementation, we extended HtmlActionHander and set it like:<br />
HTMLEmitterConfig htmlConfig = new HTMLEmitterConfig();<br />
htmlConfig.setActionHandler(new MyHTMLActionHandler());<br />
htmlConfig.setImageHandler(new HTMLServerImageHandler());<br />
engineConfig.getEmitterConfigs().put("html", htmlConfig);<br />
<br />
How can we override the HTMLActionHandler for the tag library in the same way? Preferably we would like to use the same class as we are not having any issues with it.<br />
<br />
<br />
source of birtReport.jsp<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
%><%@ taglib uri="/struts-tiles.tld" prefix="tiles"
%><%@ taglib uri="/birt.tld" prefix="birt"
%><%@ taglib uri="/struts-logic.tld" prefix="logic"
%><%@ taglib uri="/struts-html.tld" prefix="html"
%><%@ taglib uri="/struts-bean.tld" prefix="bean"
%><birt:parameterMap id="reportParams" reportDesign="<%=(String)request.getAttribute("report")%>" name="reportParams"
scope="pageContext"></birt:parameterMap
><html:form action="<%=((org.apache.struts.action.ActionMapping)request.getAttribute("strutsMapping")).getPath() %>"
styleId="birtResubmit" scope="session"
><logic:iterate name="reportParams" id="reportParam" type="java.util.Map.Entry<com.itgssi.apr.logic.report.birt.ParameterDefinitionAndValue,java.util.Collection<org.eclipse.birt.report.engine.api.impl.ParameterSelectionChoice>>"
><logic:empty name="reportParam" property="value"
><html:hidden property='<%= "birtParams(" + reportParam.getKey().getName() +")" %>'
/></logic:empty
><logic:notEmpty name="reportParam" property="value"
><logic:notEmpty name='<%=((org.apache.struts.action.ActionMapping)request.getAttribute("strutsMapping")).getName()%>' property='<%= "birtParams(" + reportParam.getKey().getName() +")" %>' >
<html:select property='<%= "birtParams(" + reportParam.getKey().getName() +")" %>' styleClass='hidden'
><html:optionsCollection name="reportParam" property="value" label="label" value="value"
/></html:select
></logic:notEmpty>
<logic:empty name='<%=((org.apache.struts.action.ActionMapping)request.getAttribute("strutsMapping")).getName()%>' property='<%= "birtParams(" + reportParam.getKey().getName() +")" %>' >
<html:select property='<%= "birtParams(" + reportParam.getKey().getName() +")" %>' value='<%= reportParam.getKey().getValue() %>' styleClass='hidden'
><html:optionsCollection name="reportParam" property="value" label="label" value="value"
/></html:select
></logic:empty>
</logic:notEmpty
></logic:iterate
>
<birt:report id="birtViewer" reportDesign="<%= (String)request.getAttribute("report") %>"
format="html"
isHostPage="false"
reportContainer="div"
><logic:iterate name="reportParams" id="reportParam" type="java.util.Map.Entry<com.itgssi.apr.logic.report.birt.ParameterDefinitionAndValue,java.util.Collection<org.eclipse.birt.report.engine.api.impl.ParameterSelectionChoice>>"
><logic:notEmpty name="<%=((org.apache.struts.action.ActionMapping)request.getAttribute("strutsMapping")).getName()%>"
property='<%= "birtParams(" + reportParam.getKey().getName() +")" %>'
><bean:define id='reportValue' name="<%=((org.apache.struts.action.ActionMapping)request.getAttribute("strutsMapping")).getName()%>"
property='<%= "birtParams(" + reportParam.getKey().getName() +")" %>'
/><birt:param name="<%=reportParam.getKey().getName()%>" value="<%=reportValue.toString() %>"
/></logic:notEmpty
></logic:iterate
></birt:report>
</html:form>
</pre>
source of MyHTMLActionHandler:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
public class MyHTMLActionHandler extends HTMLActionHandler {
@Override
protected String buildDrillAction( IAction action, Object context )
{
super.buildDrillAction(action,context);
String baseURL = null;
if ( context != null && context instanceof HTMLRenderContext )
{
baseURL = ( (HTMLRenderContext) context ).getBaseURL( );
}
// baseURL = baseURL == null ? "/birt/viewReport?ReportName=" : baseURL;
String postURL = "";
if (baseURL == null) {
baseURL = "";
postURL = ".do";
}
Map parameterBindings = action.getParameterBindings();
Iterator iterator = parameterBindings.keySet().iterator();
int i=0;
while (iterator.hasNext()) {
String key = (String) iterator.next();
if(parameterBindings.get(key) == null) continue;
postURL += i==0 ? "?" : "&";
postURL += key + "=" + parameterBindings.get(key).toString();
i++;
}
StringBuffer link = new StringBuffer();
link.append(baseURL)
.append(action.getReportName())
// .append("#")
// .append(action.getBookmark());
.append(postURL);
return link.toString();
}
}
</pre>