RE: Relative resource paths for external graphics where uri resolution is affected by every render request context

2019-07-02 Thread Simon Steiner
Hi,

 

The custom resource resolver can be modified at runtime such as
myresourceresolver.useX() to affect its operation.

 

Thanks

 

From: Mark Gibson [mailto:mark.gib...@staff.bluematrix.com] 
Sent: 02 July 2019 19:31
To: fop-users@xmlgraphics.apache.org
Subject: Relative resource paths for external graphics where uri resolution
is affected by every render request context

 

Hi,

 

We have a Java application with embedded FOP using XSLT transformations to
drive the document rendering.  I'm trying to see if it's possible to specify
external graphics URIs in the XML with a relative path that is only
indirectly related to the baseURI.  I'm finding it hard to put in to words,
so some examples may help .

 

baseURI = /base/path/

 

Relative URI in XML = images/myImage.png

 

Say we have two requests to render a document, the first associated with
account X, and the second associated with account Y.  The full URIs for each
request should resolve to .

 

X: /base/path/X/images/myImage.png

Y: /base/path/Y/images/myImage.png

 

I've looked through the documentation and found that I can override resource
resolving by supplying a custom ResourceResolver when creating a new
FopFactoryBuilder.  However, based on best practices, the FopFactory
instance should be reused for successive renders.  So I cannot apply a
render specific context (in this case, X or Y). 

 

Does anyone know of a way or either supplying extra context to be used by a
custom resolver for each individual render, or apply a different resource
resolver per render?

 

Thanks

Mark



Relative resource paths for external graphics where uri resolution is affected by every render request context

2019-07-02 Thread Mark Gibson
Hi,

We have a Java application with embedded FOP using XSLT transformations to 
drive the document rendering.  I'm trying to see if it's possible to specify 
external graphics URIs in the XML with a relative path that is only indirectly 
related to the baseURI.  I'm finding it hard to put in to words, so some 
examples may help ...

baseURI = /base/path/

Relative URI in XML = images/myImage.png

Say we have two requests to render a document, the first associated with 
account X, and the second associated with account Y.  The full URIs for each 
request should resolve to ...

X: /base/path/X/images/myImage.png
Y: /base/path/Y/images/myImage.png

I've looked through the documentation and found that I can override resource 
resolving by supplying a custom ResourceResolver when creating a new 
FopFactoryBuilder.  However, based on best practices, the FopFactory instance 
should be reused for successive renders.  So I cannot apply a render specific 
context (in this case, X or Y).

Does anyone know of a way or either supplying extra context to be used by a 
custom resolver for each individual render, or apply a different resource 
resolver per render?

Thanks
Mark