RE: https external-graphics
Aha! I found the problem. Turns out I was using -Djava.ext.dirs= to execute FOP so that the dynamic class loading worked. But there's a built in way by using -Dfop.home= instead. The java.ext.dirs causes the java SSL connection to fail with a "RSA premaster secret error" that seems to get swallowed by the FOP exception handling here (google that error for details). In general maybe FOP could better log errors. Probably a try/catch+log around the openStream call in the NormalResourceResolver class in the getResource method, but maybe also elsewhere to catch actual I/O errors. -Neil -Original Message- From: Neil Smeby Sent: Tuesday, January 8, 2019 12:34 PM To: 'fop-users@xmlgraphics.apache.org' Subject: RE: https external-graphics (sorry to break the thread chain, I just recently joined the list and missed the original responses) So the example image I was trying to use in FOP was a random google image search result (for foo) that was on a BBC media server that had https with a valid signed (not self-signed) certificate. And when I try to fetch the image using the simple java program below, it works fine. So it doesn't seem to be a JDK or certificate problem. Can someone else test the .fo file in my original email? Feel free to replace the image url with an https reference you trust. import java.net.*; import java.io.*; public class foo { public static void main(String[] args) throws Exception { URL url = new URL("https://ichef.bbci.co.uk/images/ic/960x540/p01br4cp.jpg;); URLConnection connection = url.openConnection(); InputStream is = connection.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(is)); StringBuilder response = new StringBuilder(); String inputLine; while ((inputLine = in.readLine()) != null) response.append(inputLine); in.close(); System.out.println(response.toString()); } } - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
RE: https external-graphics
(sorry to break the thread chain, I just recently joined the list and missed the original responses) So the example image I was trying to use in FOP was a random google image search result (for foo) that was on a BBC media server that had https with a valid signed (not self-signed) certificate. And when I try to fetch the image using the simple java program below, it works fine. So it doesn't seem to be a JDK or certificate problem. Can someone else test the .fo file in my original email? Feel free to replace the image url with an https reference you trust. import java.net.*; import java.io.*; public class foo { public static void main(String[] args) throws Exception { URL url = new URL("https://ichef.bbci.co.uk/images/ic/960x540/p01br4cp.jpg;); URLConnection connection = url.openConnection(); InputStream is = connection.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(is)); StringBuilder response = new StringBuilder(); String inputLine; while ((inputLine = in.readLine()) != null) response.append(inputLine); in.close(); System.out.println(response.toString()); } } Neil Smeby | Software Engineer Direct: 763-795-4160 Mobile: 763-218-6259 www.infinitecampus.com - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
Re: https external-graphics
Hi Neil, It could be that the certificate used in by the https service is self signed. This means Java won't trust it by default unless you import it into the Java Trust store. Open the URL in the browser and inspect the certificate to see what kind of certificate the service is using to encrypt the https data. Thanks, Chris On 20/12/2018 16:50, Neil Smeby wrote: > Hello, > I'm having some problems with getting images to resolve when using https > instead of http. An example .fo file follows: > > http://www.w3.org/1999/XSL/Format;> > >master-name="BodyPage"> >margin-bottom=".5in" margin-left=".5in"/> >display-align="after"/> >display-align="before"/> > > > > > >src="url(https://ichef.bbci.co.uk/images/ic/960x540/p01br4cp.jpg)" > overflow="hidden" content-width="scale-to-fit" content-height="scale-to-fit" > width="100%" scaling="uniform"/> > > > > > > When I run this: > java.exe -Djava.ext.dirs=C:\fop\fop-2.3 org.apache.fop.cli.Main -d -fo > C:\foo\testhttps.fo -pdf C:\foo\testhttps.pdf > > Despite curl being able to fetch this image (using https), I get this error: > SEVERE: Image not found. URI: > https://ichef.bbci.co.uk/images/ic/960x540/p01br4cp.jpg. (See position 13:202) > > But when I simply change https to http, things work. Is that expected? If so, > why isn't https supported? Are there any workarounds? > Thanks in advance for any help/advice! > > -Neil > > > - > To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org > For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org > > . >
RE: https external-graphics
Hi, What java version are you using, try using a recent version. Since the https cert may not be in your jdk. Thanks -Original Message- From: Neil Smeby Sent: 20 December 2018 16:50 To: fop-users@xmlgraphics.apache.org Subject: https external-graphics Hello, I'm having some problems with getting images to resolve when using https instead of http. An example .fo file follows: http://www.w3.org/1999/XSL/Format;> https://ichef.bbci.co.uk/images/ic/960x540/p01br4cp.jpg)" overflow="hidden" content-width="scale-to-fit" content-height="scale-to-fit" width="100%" scaling="uniform"/> When I run this: java.exe -Djava.ext.dirs=C:\fop\fop-2.3 org.apache.fop.cli.Main -d -fo C:\foo\testhttps.fo -pdf C:\foo\testhttps.pdf Despite curl being able to fetch this image (using https), I get this error: SEVERE: Image not found. URI: https://ichef.bbci.co.uk/images/ic/960x540/p01br4cp.jpg. (See position 13:202) But when I simply change https to http, things work. Is that expected? If so, why isn't https supported? Are there any workarounds? Thanks in advance for any help/advice! -Neil - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org