Issue Description
rest_v2/Reports and rest_v2/ReportExecution will have session-bound image references in the html output by default. Whether or not you specify an attachmentsPrefix, the full path provided will require login, so it is ephemeral.
In some cases customers might want something more static. There are potential workarounds within the TIBCO JasperReports® API that can help.
Resolution
There are three options for changing the default behavior
1. isLazy=true is the nicest approach for referencing static url. Note, this results in CSS background-image output potentially in scheduler output, rest output, etc. So you might see:
<div style="width: 100%; height: 100%; background-image: url('http://images.greg.com/dm/Icon_sm.png'); background-repeat: no-repeat; background-position: right top;background-size: contain;"></div></div></td>
instead of:
<img src="http://images.greg......
CSS background-image will NOT be used if the image has hAlign="Left" vAlign="Top" (which are the default image alignment attributes) and scaleImage="Clip" or scaleImage="FillFrame" (alignment doesn't apply).
2. The following property will cause binary data representing the image to be nested directly within the html's image tags:
net.sf.jasperreports.export.html.embed.image=true
This would appear in html tags like:
<img src=3D"data:image/png;base64,iVBORw0KGgoAAAANS= UhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccll= PAAAAStJREFUeNqsVEEOATEUVXGAsbfgBtxgboCFPXuJcQJHQGKPtYWZE+AE5gZG4gCO4P3kVYp=...
3. Finally you can fetch image files individually via rest and then save the images permanently into directories or files while using attachmentPrefix (see REST documentation) to help specify the img urls in the rest output. For example, if using the output to create an email with html-embedded content, fetch and create MIME (multipart) parts to attach the images, and reference them in the HTML via "cid:.." URIs. Use attachmentPrefix of "cid:" to ensure cid syntax is generated in the response output:
<img src="cid:img_0_0_3.png" style...
Ref. Case 01559046
Recommended Comments
There are no comments to display.