On 9/5/23 19:12, Ashish Singhal wrote:

I am in the Oracle CPQ Cloud team. We license XmlMind’s XML-FO Convertor to output Docx documents.

Yes. Purchased in 2015. Hence a very old version not supported by us anymore.



We have a requirement to support proxies for External images referenced in fo tags. The issue we are facing is that it doesn’t resolve the external image when there a proxy server on the envns where the FO conversion is happening.

Sample:

<fo:external-graphic src="url(http://nginx.org/nginx.png)" width="auto" height="auto" content-width="auto" content-height="auto"/>

Here is what we have tried

  * Download the latest XML-FO Convertor
  * Install the samples and binaries onto an envn that requires the use
    of proxy
  * Before setting proxy envn vars
      o Curl hangs/blocks
      o Converting sample’s userguide.fo with above fo tag also hangs/blocks
  * After setting proxy envn vars
      o Curl succeeds
      o Converting sample’s userguide.fo with above fo tag doesn’t
blocks but outputs the message * warning: failed to load image "http://nginx.org/nginx.png":
    http://www-proxy.us.oracle.com
    (file:/Users/ASSINGHA/Downloads/xfc_eval_java-6_4_1/samples/userguide2.fo, 
line #428, column #1993)
      o It output an empty image file

What is the solution? Is there a workaround?

Setting of proxy vars

  * We are tried various options but nothing works for XML-FO Convertor
  * Setting of envn vars
  * Setting java vars while running the convertor script
  * exec java -Dhttp.proxyHost=http://www-proxy.us.oracle.com
    -Dhttp.proxyPort=80 -Djava.awt.headless=true
    com.xmlmind.fo.converter.Driver



Sorry but we cannot help you. This is a Java question, not a question related to our product.

XMLmind XML-FO Converter downloads the image files using stock Java classes, that is, it simply does:
---
(new URL(location)).openStream();
---
You have the full source code of our product. You can check this by yourself (src/com/xmlmind/fo/util/URLUtil.java, src/com/xmlmind/fo/graphic/GraphicFactoryImpl.java).

In other words, any Java program which would attempt to download http://nginx.org/nginx.png in the same working environment would report exactly the same error as XMLmind XML-FO Converter.

exec java -Dhttp.proxyHost=http://www-proxy.us.oracle.com
-Dhttp.proxyPort=80 ... may be the good approach to solve your problem.

However, make sure to get ALL the system properties (-Dvar=value) RIGHT given the version of Java you use. See for example, for Java 8,: https://docs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties.html#Proxies

Not tested at all, but just to give you a general idea, may be (a) removing all -Dx=y, (b) setting the environment variables and (c) -Djava.net.useSystemProxies=true would work for you. Depends on the operating system and the version of Java you use.




---
PS: Well known Java caveat: Java does not follow HTTP to HTTPS redirection. Therefore if http://nginx.org/nginx.png redirects to https://nginx.org/nginx.png or http://www-proxy.us.oracle.com redirects to https://www-proxy.us.oracle.com, it's unlikely to work.



--
XMLmind FO Converter Support List
xfc-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xfc-support

Reply via email to