pepite / play--pdf

Render a PDF document from your HTML template
53 stars 30 forks source link

Initial request takes 2 minutes+ to load #10

Closed johnou closed 13 years ago

johnou commented 13 years ago

Seems the patch to prevent the library contacting w3 is not working or its done from another place?

00:12:11,855 INFO ~ Application 'Registro' is now started ! 00:12:12,604 INFO ~ Using CSS implementation from: org.xhtmlrenderer.context.StyleReference 00:12:12,838 WARN ~ Trying to connect to www.w3.org on port 80 00:12:12,838 WARN ~ Trying to connect to www.w3.org on port -1 00:12:12,838 WARN ~ Trying to connect to 128.30.52.37 on port 80 00:12:12,838 WARN ~ Trying to connect to 128.30.52.37 on port 80 00:12:43,735 WARN ~ Trying to connect to www.w3.org on port 80 00:12:43,735 WARN ~ Trying to connect to www.w3.org on port -1 00:12:43,735 WARN ~ Trying to connect to 128.30.52.37 on port 80 00:12:43,735 WARN ~ Trying to connect to 128.30.52.37 on port 80 00:13:14,358 WARN ~ Trying to connect to www.w3.org on port 80 00:13:14,358 WARN ~ Trying to connect to www.w3.org on port -1 00:13:14,358 WARN ~ Trying to connect to 128.30.52.37 on port 80 00:13:14,358 WARN ~ Trying to connect to 128.30.52.37 on port 80 00:13:45,106 WARN ~ Trying to connect to www.w3.org on port 80 00:13:45,106 WARN ~ Trying to connect to www.w3.org on port -1 00:13:45,106 WARN ~ Trying to connect to 128.30.52.37 on port 80 00:13:45,121 WARN ~ Trying to connect to 128.30.52.37 on port 80 00:14:15,728 INFO ~ TIME: parse stylesheets 62ms 00:14:15,728 INFO ~ media = print 00:14:15,728 INFO ~ Matcher created with 118 selectors

johnou commented 13 years ago

Created my own security manager to find out where its hiding..

00:24:44,234 WARN ~ Trying to connect to 128.30.52.37 on port 80 java.lang.RuntimeException: Blocked connect! at security.SecurityManager.checkConnect(SecurityManager.java:18) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:320) at java.net.Socket.connect(Socket.java:529) at sun.net.NetworkClient.doConnect(NetworkClient.java:161) at sun.net.www.http.HttpClient.openServer(HttpClient.java:394) at sun.net.www.http.HttpClient.openServer(HttpClient.java:529) at sun.net.www.http.HttpClient.(HttpClient.java:233) at sun.net.www.http.HttpClient.New(HttpClient.java:306) at sun.net.www.http.HttpClient.New(HttpClient.java:323) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:975) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:916) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:841) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1177) at org.allcolor.dtd.parser.CDTDParser.load(CDTDParser.java:131) at org.allcolor.dtd.parser.CDTDParser.parseDoctype(CDTDParser.java:672) at org.allcolor.dtd.parser.CDTDParser.parseDoctype(CDTDParser.java:564) at org.allcolor.xml.parser.CDomHandler.parseDoctype(CDomHandler.java:447) at org.allcolor.xml.parser.CXmlParser.parse(CXmlParser.java:1262) at org.allcolor.xml.parser.CDomHandler.getDocument(CDomHandler.java:206) at org.allcolor.xml.parser.CShaniDomParser.parse(CShaniDomParser.java:807) at org.allcolor.xml.parser.CShaniDomParser.parse(CShaniDomParser.java:789) at org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer.transform(CHtmlToPdfFlyingSaucerTransformer.java:512) at play.modules.pdf.RenderPDFTemplate.apply(RenderPDFTemplate.java:76) at play.mvc.ActionInvoker.invoke(ActionInvoker.java:302) at play.server.PlayHandler$NettyInvocation.execute(PlayHandler.java:169) at play.Invoker$Invocation.run(Invoker.java:187) at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:149) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)

johnou commented 13 years ago

Actually your three line patch to org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer does work, it just does not seem to be bundled with "pdf-head", after compiling the converter myself and replacing the two yahp jars it no longer tries to validate documents online.

johnou commented 13 years ago

Might be nice to provide the patched jars with the module?

johnou commented 13 years ago

I have contacted the author of the yahp library in the mean time.

johnou commented 13 years ago

Patch is now included in the latest version available @ http://www.allcolor.org/YaHPConverter/

Additionally the yahp library now uses itext5 and .. "I've also corrected a problem with entities who where sometimes duplicated and not decoded correctly and another problem where remote css were not loaded."

johnou commented 13 years ago

I will create a new ticket about updating to the latest yahp.