CustomDataSource and JasperReports Server v5.0


I am upgrading from JasperReports Server v4.5.0 to v5.0.1 running on jboss 5.1. We use HTTP API to run reports integrated with our portal using SSO. The reports use CustomDataSource which calls a web service to retrieve data. Before it could call the web service we need to fetch the HttpServletRequest object to fetch some session values to be passed along with the web service call. We use the following calls to retrieve request object.


private HttpServletRequest getHttpServletRequest()  {
HttpServletRequest request = null;
//Object object = RequestContextHolder.currentRequestAttributes();
ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if(attrs != null) {
request = attrs.getRequest();
return request;
This works fine in 4.5.0. However, it returns null in 5.0.1. Could you please advise what could have changed to cause this. Any pointers highly appreciated.
atiquek_1's picture
Joined: Nov 7 2012 - 2:10am
Last seen: 10 years 1 month ago


Do you got the solution of your problem?. Also i have to do the same thing, i have jasper soft 5.0 running on jboss. I want to use custom bean data source which internally calls webservice to get the reports contents. How to configure new bean data sources in jasper server. What all configurations require for this?

Any help is appecriated. Thanks in advance.

manojshishodia - 9 years 1 month ago

You can create your own applicationContext-ds.xml file and define your CustomDataSourceService

<bean id="itmsCustomDataSource" class="com.jaspersoft.jasperserver.api.engine.jasperreports.util.CustomDataSourceDefinition">
        <property name="factory" ref="customDataSourceServiceFactory"/>
        <property name="name" value="itmsCustomDataSource"/>
        <property name="serviceClassName" value=""/>
        <property name="validator">
            <bean class=""/>
        <property name="propertyDefinitions">
                    <entry key="name" value="action"/>
                    <entry key="default" value="This is a required value"/>
        <property name="queryExecuterMap">

This bean will be responsible for instantiating your CustomDataSource. More details here

atiquek - 9 years 1 month ago

0 Answers:

No answers yet