Jump to content

Timeout when calling external image


manuel.dadda

Recommended Posts

Hi all,

I have an image field with this expression:

$F{IMAGE} == null ? null : "http://server:port/service?imageuri=" + $F{IMAGE}

I need that if the server does not return a response after 2 seconds, the expression return null.

I search in the forum and google, but I didn't find anything that can help me.

Do you have any ideas? Thanks

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I think the cleanest way to do this would be to write a helper class (in Java) that puts a timer around the URL call and returns null if it takes too long, otherwise returns your image. I'm not sure it's possible directly in the expression editor as it will not evaluate the URL in the image field until the report is filled. Do you know how to create a helper class?

Link to comment
Share on other sites

Scriptlets and Helper Classes are very similar in nature. Both are written in Java. Both are referenced directly in your jrxml report in Studio. Scriptlets contain predefined methods that execute at certain times during the report execution/fill process but can also include additional methods that can be referenced at any point in your report (like a helper class) and are attached to individual reports during the report design process. Helper classes are essentially user-built utility methods built in java, compiled to a JAR file and included on the server, making them available to all reports at all the times. This is a high level description.

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...