Jump to content
JasperReports Library 7.0 is now available ×
  • Custom hyperlink behavior for embedded JasperReports drill through content in Jasper Server


    jwhang
    • Version: v6.3.1 Product: JasperReports® Server

    In cases where a standard Jasper Report created using JRXML is being viewed through an embedded view within the context of another web application, it may be necessary to alter the hyperlink targets for drill through report links.  In the case of JasperServer, drill through targets can take the form of <webapp name>/flow.html?... e.g. "/jasperserver-pro/flow.html?_flowId=viewReportFlow&reportUnit=%2Fpublic%2FSamples%2FReports%2FMyReport" when a preferred outcome may be to point to an entirely different application which passes this JasperServer specific information to a custom embedded view page (<some host>/<some custom webapp>...?jasperParams=<jasperserver specific parameters>)

    The core Jasper Reports library supports functionality to switch out logic for how hyperlinks should be interpreted when rendering the report (http://jasperreports.sourceforge.net/sample.reference/hyperlink/index.html).  In the case of JasperServer, the ReportExecutionHyperlinkProducerFactory class (com.jaspersoft.jasperserver.war.action.hyperlinks.ReportExecutionHyperlinkProducerFactory) is invoked when assembling the final report URL.  One way to modify the outcome is to alter the ReportExecutionHyperlinkProducerFactory's nested HyperlinkProducer.getHyperlink method definition.  e.g:

          public String getHyperlink(JRPrintHyperlink hyperlink) {
                String uri = super.getHyperlink(hyperlink);
                //apply additional modifications to the URI here.
                return response != null ? response.encodeURL(uri) : uri;
          }

    For example, if a prefix string is combined with the existing uri, this will change the resulting URL used for the drill through hyperlinks.

     


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...