Jump to content

CustomDataSource and JasperReports Server v5.0


atiquek_1

Recommended Posts

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,
 
Link to comment
Share on other sites

  • 1 year later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

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.

Link to comment
Share on other sites

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>[/code]

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...