JasperServer Quick How-To

How to change the JasperServer login page?

Edit the $JASPER_ROOT/WEB-INF/bundles/jasperserver_messages.properties and change your desired text as below.

#Welcome Login Page
LOGIN_WELCOME_OS=Welcome to JasperServer Reporting System!

# the following 2 strings belong to the same sentence
LOGIN_ONLINE_DEMO_PRE=JasperServer is an open source business intelligence suite ....
LOGIN_ONLINE_DEMO=JasperReports is a powerful open source Java reporting tool ...

Now, replace the $JASPER_ROOT/WEB-INF/jsp/login_welcome.jsp with the one i attached here. You may see the differences before replace. Once the file replaced, the login page will look like below.

jasper-login

How to change report export parameters?

You need to edit $JASPER_ROOT/WEB-INF/applicationContext.xml and $JASPER_ROOT/WEB-INF/applicationContext-report-scheduling.xml. Look for “export parameters” section:

<!-- export parameters -->
 
<bean id="xlsExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.XlsExportParametersBean">
 <property name="detectCellType" value="true"/>
 <property name="onePagePerSheet" value="false"/>
 <property name="removeEmptySpaceBetweenRows" value="false"/>
 <property name="removeEmptySpaceBetweenColumns" value="true"/>
 <property name="whitePageBackground" value="false"/>
 <property name="ignoreGraphics" value="false"/>
 <property name="collapseRowSpan" value="true"/>
 <property name="ignoreCellBorder" value="true"/>
 <property name="fontSizeFixEnabled" value="true"/>
 <property name="maximumRowsPerSheet" value="0"/>
 <property name="xlsFormatPatternsMap" ref="formatPatternsMap"/>
</bean>
 
<bean id="csvExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.CsvExportParametersBean">
 <property name="fieldDelimiter" value="|"/>
</bean>
 
<bean id="pdfExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.PdfExportParametersBean">
 <property name="localizedFontMap" ref="localePdfFontMap"/>
</bean>
 
<util:map id="formatPatternsMap">
 <!-- entry key="$ #,##0.00" value="$ #,##0.00"/-->
</util:map> 
 
<!-- end export parameters -->

How to restrict report scheduling function?

You need to edit $JASPER_ROOT/WEB-INF/jsp/repository/repositoryExplorer.jsp and add the “authz:authorize ifAllGranted” to set the permission based on role. In example below, i have granted scheduling / run background to role “Administrator” only.

<authz:authorize ifAllGranted="ROLE_ADMINISTRATOR">
  <td style="cursor: pointer;" width='50' height='50' onClick='' id='schedule_td' align="center">
  <a href='#' class='normalpx' id='schedule_td_a'><img src="images/schedule_enabled.gif" border='0' title='<spring:message code="RM_BUTTON_SCHEDULE_REPORT" javaScriptEscape="true"/>' id='schedule' /></a>
  </td>
 
  <td style="cursor: pointer;" width='50' height='50' onClick='' id='send_output_td' align="center"> 
  <a href='#' class='normalpx' id='send_output_td_a'><img src="images/send_output_enabled.gif" border='0' title='<spring:message code="RM_BUTTON_RUN_IN_BACKGROUND" javaScriptEscape="true"/>' id='send_output' /></a>
  </td>
</authz:authorize>

How to enable “Password Change”?

JasperServer comes with an option to enable user to change their own password. This option is disabled by default, therefore if you need to enable it, open the$JASPER_ROOT/WEB-INF/jasperserver-servlet.xml, under the “jsCommContr” bean look for “allowUserPasswordChange” and set it “true”. Besides that, you also can enforce the “password expiration” policy by setting the value in “passwordExpirationInDays” properties.

<property name="allowUserPasswordChange" value="true" />
<property name="passwordExpirationInDays" value="90" />

How to change homepage based on role?

Upon successful login, JasperServer can redirect user to a page based on their role. This setting can be found in $JASPER_ROOT/WEB-INF/jasperserver-servlet.xml file – look for “loginController” bean. In the example below, i’ve redirect the user with “ROLE_USER” role to “listReportsFlow”

<property name="homePageByRole">
  <list>
    <value>ROLE_ADMINISTRATOR|redirect:/flow.html?_flowId=repositoryExplorerFlow</value>
    <value>ROLE_USER|redirect:/flow.html?_flowId=listReportsFlow</value>
  </list>
</property>

How to increase Report Virtualizer size?

JasperServer use Report Virtualizer to cache the report output pages before it render to display. In the other word, it will store the temporary data (cache) in a file instead of holding it in system memory.

This will definitely will improve the overall performance and avoid the Java “OutOfMemory” error. Eventually, if the “virtualizer” size is not enough to hold the cache, it will through the error, therefore we can increase the virtualizer size by editing the $JASPER_ROOT/WEB-INF/applicationContext.xml file

<!-- report virtualizers -->
<bean id="fileVirtualizerFactory" class="com.jaspersoft.jasperserver.api.engine.common.service.impl.FileVirtualizerFactory">
  <property name="maxSize" value="600"></property>
  <property name="directory" value="${java.io.tmpdir}"></property>
</bean>

How to change password encoding to MD5/SHA?

Starting from JasperServer 3.5, the password encryption is enabled by default. Since there are quit number of encoding mechanism available, some of us want to change the default encoding to MD5 or SHA.

This might be necessary to follow the organization’s standard / policy or to synchronize the user details from other system which store the password in MD5 / SHA. To change the encoding, edit the $JASPER_ROOT/WEB-INF/applicationContext-security.xml, look for “passwordEncoder” bean.

Original:

<bean id="passwordEncoder" class="com.jaspersoft.jasperserver.api.metadata.common.service.impl.PasswordCipherer" lazy-init="false">
  <property name="allowEncoding"><value>true</value></property>
  <property name="keyInPlainText"><value>false</value></property>
  <property name="secretKey"><value>0xC8 0x43 0x29 0x49 0xAE 0x25 0x2F 0xA1 0xC1 0xF2 0xC8 0xD9 0x31 0x01 0x2C 0x52 0x54 0x0B 0x5E 0xEA 0x9E 0x37 0xA8 0x61</value></property>
  <property name="secretKeyAlgorithm"><value>DESede</value></property>
  <property name="cipherTransformation"><value>DESede/CBC/PKCS5Padding</value></property>
</bean>

MD5:

<bean id="passwordEncoder" class="org.acegisecurity.providers.encoding.Md5PasswordEncoder">
  <property name="encodeHashAsBase64"><value>false</value></property>
</bean>

SHA:

<bean id="passwordEncoder" class="org.acegisecurity.providers.encoding.ShaPasswordEncoder">
  <property name="encodeHashAsBase64"><value>false</value></property>
</bean>

Then, you need to update the password is database according to the new encoding. Below is the sample encrypted password for “mypassword”

MD5: 34819d7beeabb9260a5c854bc85b3e44
SHA: 91dfd9ddb4198affc5c194cd8ce6d338fde470e2

What if SMTP server required authentication or TLS/SSL connection?

Nowadays, most of the SMTP server is configured to SMTP authentication, and some might required TLS (STARTTLS / SSL) connection like Gmail. Add the following entries to the “reportSchedulerMailSender” bean in JASPER_ROOT/WEB-INF/applicationContext-report-scheduling.xml file

<property name="javaMailProperties">
  <props>
    <prop key="mail.smtp.auth">true</prop> //required if smtp authentication needed
    <prop key="mail.smtp.starttls.enable">true</prop> //required if TLS conenction needed (eg: Gmail)
  </props>
</property>