CustomDataSource and JasperReports Server v5.0

0

Hi,

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.
 
Thanks,
 
atiquek_1's picture
Joined: Nov 7 2012 - 2:10am
Last seen: 6 years 6 months ago

Hi,

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 - 5 years 6 months 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="org.quwic.itms.bi.ds.CustomDataSourceService"/>
        <property name="validator">
            <bean class="org.quwic.itms.bi.ds.CustomDSValidator"/>
        </property>
        <property name="propertyDefinitions">
            <list>
                <map>
                    <entry key="name" value="action"/>
                    <entry key="default" value="This is a required value"/>
                </map>
            </list>
        </property>
        <property name="queryExecuterMap">
            <map/>
        </property>
    </bean>

This bean will be responsible for instantiating your CustomDataSource. More details here http://community.jaspersoft.com/wiki/custom-data-source-sample-readme

atiquek - 5 years 6 months ago

0 Answers:

No answers yet
Feedback
randomness