Jump to content
We've recently updated our Privacy Statement, available here ×

sprilukin

Members
  • Posts

    10
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by sprilukin

  1. Browsers gradually improve their security and CORS requests are not an exception. visualize.js by its nature most likely will make CORS requests. So there are certain rules which visualize.js app should follow to successfully make CORS requests. What is CORS request?It's better to read about the definition of the CORS on developer.mozilla.org: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS In short, if your visualize.js-based app is hosted on a https://some.host.com and your JRS instance is hosted on https://jrs.instance.com then any requests from visualize.js app using XMLHTTPRequest (XHR) or fetch will be considered to be Cross Origin and CORS rules will apply to such requests. The definition of the Origin or Same Origin could be found here: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#definition_of_an_origin Why understanding CORS is important for visualize.js?If visualize.js-based app and JasperReports Server instance are not configured properly to use CORS the customers might encounter different strange errors which are not obvious to match to wrong CORS config. How to configure CORS in visualize.js application?Configure JasperReports Server instanceRead this community article Tips: Read the most recent Configuring CSRF ProtectionUse the latest JRS version when possibleConfigure visualize.js appThe right way to configure the visualize.js app to make it work with CORS is to: if you use a domain name for your hosted visualize.js application then ensure that HTTPS is used for both visualize.js host (your application) and for JRS host, because otherwise, Browser will not send cookies back to the JRS instanceif you use an IP address for both visualize.js app and JRS instance it might be not necessary to use HTTPS (depends on browser brand and version). This option could be used for the development/testing environment only.Troubleshoot CORS issuesSymptom #1: all XHR requests from the visualize.js app do not work and the following error is observed: Access to XMLHttpRequest at ’https://somehost.com’ from origin ’https://someorigin.com’ has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ No 'Access-Control-Allow-Origin' header is present on the requested resource Solution: check domainWhitelist setup. It looks like the JRS server is not aware of your visualize.js app host. Symptom #2: some XHR requests from visualize.js app do not work, while others work well. Solution: First, check the network tab of your browser and inspect request and response headers. If in request header there is no Cookie: JSESSIONID=XXXXXXXXXX header present this means that there are some issues with CORS set up. Let's say if your visualize.js app is accessed through the domain name - most likely the solution is to enable HTTPS for both visualize.js app host and for JRS instance host. If you do not want to use HTTPS then it might help to access both the visualize.js app and JRS instance through an IP address instead of a domain name (it might or might not work for some browsers). Also, if you use any custom request headers like pp or Authorization, you need to allow them explicitly: see CORS error in JasperReports Server 7.8 (and later). Symptom #3: when visualize.js app is running the browser pops up a dialog with login/password form. After this visualize.js app works only partially or does not work at all. The solution is the same as for Symptom #2 Symptom #4: all XHR requests from visualize.js app do not work even if HTTPS protocol is used to communicate between the visualize.js app and JRS and your visualize.js app is executed in an iframe (an example is jsfiddle samples like here: https://tibcosoftware.github.io/). Solution: currently this is a Safari-specific thing called Intelligent Tracking Prevention, but eventually all browsers will implement this feature. Namely, the issue is that if your visualize.js application is executed inside an iframe - the browser simply will not set server cookies at all. In JRS versions <= 7.9.0 there is no workaround at the moment except moving visualize.js out of an iframe.
  2. What version of JasperReports Server do you use? This issue can appear in JRS v4.7 but it should not appear in latest versions. (If i remember correctly >= JRS v5.0) Also please check jasperserver_config_<YOUR_LOCALE>.properties it should contains consistent date format for both date.format, datetime.format, time.format and calendar.date.format, calendar.datetime.format, calendar.time.format properties Properties with calendar.* prefix are used to configure jQuery datepicker calendar plugin which is used in JRS while properties without such prefix are used in java backend to parse/format strings (see javadoc) so for example values date.format and calendar.date.format should provide SAME parse/format results for same dates. P.S. these properties are duplicated because jQuery calendar plugin is a little bit different from java DateFormat pattern Hope this helps.
  3. Hello, Daning. There is no fully dynamic way to change color, font or other properties of input controls. There are two supported ways for now: 1. Add css class for input controls definition in jasperserverWEB-INFjspmodulesinputControlsInputControlTemplates.jsp - this will change look&feel of controls in all reports which use default report parameters form. (works for JasperReports Server of version 4.7.1 or later) 2. Change report parameters form for specific report(s) - go to Edit report -> Customization -> JSP Location and set path to custom parameters form jsp (you can copy&paste DefaultParametersForm.jsp and customize it). This way allows you to customize input controls only for specific report(s) Thanks, Sergey.
  4. Other suggestion is to add permission for anonymous user to run this dashboard - in this case you do not need to put credentials in url or headers. More details about how to setup such access you can read here
  5. Please check that you log in to jasperserver using same timezone as you database, and jasperserver instance. If this not help check type of your datasource JDBC or JNDI?If JDBC then try to switch to JNDI. If nothing helps as a last resort you can edit datasource and select different timezone for it, so in runtime it will show correct value but it is not recommended way, better is just to upgrade to 5.0 there several timezone issues was fixed. thanks,Sergey.
  6. Hello. In 4.7.1 was a couple fixes related to calendar popup, i think your issue should be fixed there. Thanks, Sergey.
  7. You can use DateRange type to define ranges like day-1, week, year, quarter etc. and use this ranges as a query parameters. For example lets say you have following parameter: <parameter class="net.sf.jasperreports.types.date.DateRange" name="dateRange"><defaultvalueexpression><!--[CDATA[new net.sf.jasperreports.types.date.DateRangeBuilder("WEEK").toDateRange()]]--></defaultvalueexpression> </parameter> and following query: <querystring> <!--[CDATA[select * from test_table where $X{EQUAL, orderDate, dateRange}]]--> </querystring>when you will run such query you will get similar SQL: select * from test_table where orderDate >= "START DAY OF CURRENT WEEK" and orderDate <= "END DAY OF CURRENT WEEK"[/code] As an expression for DateRangeBuilder you can use following syntax: "DAY+/-n" - (for example "DAY+1", "DAY-23" - no spaces and all uppercase) means n-th day after (or before) current day, "WEEK+/-n", "QUARTER+/n", "SEMI+/-n", "YEAR+/-n" This type is compatible with Date type thus if you will create filed of such type then you will be asked to fill it you can enter either relative date expression as described above or regular date. Also you can read javadoc for DateRangeBuilder class in sources of JasperReports library to find all possible cases how to use it. Hope this helps. Thanks, Sergey.
  8. I can only suggest to update to JasperReports Server 5.0: in 5.0 this case works great with ecaxtly same steps.
×
×
  • Create New...