kairat.biy Posted February 14, 2013 Share Posted February 14, 2013 Using Rest v2, setting the report locale can be done by attaching userLocale=tr to the request.But Rest v2 has an issue when it comes to get the JRPRINT file of the report. Although the documentation mentions thathttp://:/jasperserver[-pro]/rest_v2/reports/path/to/report.? where is one of the following: html, pdf, xls, rtf, csv, xml, jrprintit just not working. So I decied to get JRPRINT file with Rest V1. To achieve this followed the documentation as1) Login with userLocale=tr attached: POST httpp://domain/jasperserver/rest/login 2) Get the report unit: GET httpp://domain/jasperserver/rest/resource/reports/myReport 3) Add parameters to the reportUnit descriptor. /* try all combinations */ <parameter name="userLocale">tr</parameter> <parameter name="reportLocale">tr</parameter> <parameter name="REPORT_LOCALE>tr</parameter> ... other parameters ... then run the report: PUT httpp://domain/jasperserver/rest/report/reports/myReport?RUN_OUTPUT_FORMAT=JRPRINT&reportLocale=tr&userLocale=tr&REPORT_LOCALE=tr (Side note: The docs says the returned status code should be 200 but actually it is 201 if successful) 4) Get the report output using the UUID returned from previous PUT: GET httpp://domain/jasperserver/rest/report/UUID?file=jasperPrintThis works fine. I can get the JRPRINT file. However even though trying to set all possible parameters (userLocale, reportLocale, REPORT_LOCALE) through both by request body and query string, the report language (filled resource bundle) is still not in tr (turkish). I reasoned this by exporting the JRPRINT file with JRTextExporter as follows:JRExporter exporter = new JRTextExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRTextExporterParameter.CHARACTER_WIDTH, new Float("5")); exporter.setParameter(JRTextExporterParameter.CHARACTER_HEIGHT, new Float("13")); exporter.setParameter(JRTextExporterParameter.PAGE_WIDTH, new Float("200")); exporter.setParameter(JRExporterParameter.CHARACTER_ENCODING, "UTF-8"); exporter.setParameter(JRTextExporterParameter.PAGE_HEIGHT, new Float("200")); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream); exporter.exportReport();I want to able to set the locale of the report running on the server using REST v1 webservices. Any help is appreciated.Jasperserver CE 5.0.0 with default configurations. Link to comment Share on other sites More sharing options...
Solution kairat.biy Posted February 16, 2013 Author Solution Share Posted February 16, 2013 Ok after looking into the source code of Jasperserver, I was able to solve the problem. Thanks anyway. Link to comment Share on other sites More sharing options...
gideon.maree Posted November 8, 2013 Share Posted November 8, 2013 Hi, we have a similar issue, how exactly did you solve the problem? Link to comment Share on other sites More sharing options...
oguz.turkan Posted January 13, 2014 Share Posted January 13, 2014 i am new user can u explain solution ? Link to comment Share on other sites More sharing options...
spam_6 Posted October 30, 2014 Share Posted October 30, 2014 I'v got similar problem,If you use rast v1 and want to set locale just add parameter:<parameter name="REPORT_LOCALE">pl_PL</parameter>[/code] Link to comment Share on other sites More sharing options...
skooro Posted September 8, 2015 Share Posted September 8, 2015 Solution: http://localhost:8080/jasperserver/rest_v2/reports/path_to_report/myreport.html?id=84&EPORT_LOCALE=tr Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now