RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
I guess it depends on the mount path of your page. Most probably it is /wicket/bookmarkable/... On Mar 14, 2015 7:37 PM, Bruce Lombardi brlom...@gmail.com wrote: Interesting, When I run your code I see that the url is as you say: ./wicket/resource/org.apache.wicket.Application/pdfProducer Whereas in my working code (wicket version 6.12) it is: ./resource/org.apache.wicket.Application/pdfProducer And in my non-working code (wicket versions 6.13 - 6.19) it is: ../resource/org.apache.wicket.Application/pdfProducer If I remove the first dot from the url with the debuggerthen run from there the pdf appears as it should. I wonder why they are different in the two projects and why I'm getting .. with later versions. I'm also wondering if there is another library that is somehow incompatible with later versions of Wicket. I think the only library we use that interacts with Wicket is wicket bootstrap - currently as below (but I've tried other version): dependency groupIdde.agilecoders.wicket/groupId artifactIdwicket-bootstrap-core/artifactId version0.9.8/version /dependency dependency groupIdde.agilecoders.wicket/groupId artifactIdwicket-bootstrap-extensions/artifactId version0.9.8/version /dependency I will add these dependencies to your quickstart and see if it makes a difference. Bruce -Original Message- From: Andrea Del Bene [mailto:an.delb...@gmail.com] Sent: Saturday, March 14, 2015 11:58 AM To: users@wicket.apache.org Subject: Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13 Hi, I've created a quickstart based on your code but I can't reproduce the issue. I've shared it on Dropbox: https://www.dropbox.com/s/qmolvzvp9a0xplf/ResourceIssue.tar.gz?dl=0 The only thing I've noted is that your resource url doesn't have starting segment 'wicket', i.e my resource url is: ./wicket/resource/org.apache.wicket.Application/pdfProducer Maybe you have some custom setting for wicket segments ('wicket', 'bookmark', etc...)? The problem (which I think is a bug) is in the way the url is produced. The line String url = (String)RequestCycle.get().urlFor(resourceReference, null); Produces the url to use for the resource ref. In the non-working version it returns: ../resource/org.apache.wicket.Application/pdfProducer If I set a breakpoint just after this line and I manually remove the first dot in the string using the debugger to get: ./resource/org.apache.wicket.Application/pdfProducer and then let the code continue to run, my pdf appears correctly. The debug trace also shows the correct uri. 2015-03-13 17:59:30,292 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,298 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,301 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,305 DEBUG - CompoundRequestMapper - One compatible mapper found for URL 'wicket/resource/org.apache.wicket.Application/pdfProducer' - 'Mapper: org.apache.wicket.core.request.mapper.ResourceReferenceMapper; Score: 1' Maybe someone knows how to fix this? I could strip the first dot as a workaround in the mean time. Bruce - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
Bruce, Apologies for my short answers of yesterday: texting from a mobile device is not very confortable. Would this class https://github.com/reiern70/antilia-bits/blob/master/content-iframe/src/main/java/com/antilia/iframe/DocumentInlineFrame.java be of some help for your use case? On Fri, Mar 13, 2015 at 11:03 PM, Bruce Lombardi brlom...@gmail.com wrote: The problem (which I think is a bug) is in the way the url is produced. The line String url = (String)RequestCycle.get().urlFor(resourceReference, null); Produces the url to use for the resource ref. In the non-working version it returns: ../resource/org.apache.wicket.Application/pdfProducer If I set a breakpoint just after this line and I manually remove the first dot in the string using the debugger to get: ./resource/org.apache.wicket.Application/pdfProducer and then let the code continue to run, my pdf appears correctly. The debug trace also shows the correct uri. 2015-03-13 17:59:30,292 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,298 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,301 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,305 DEBUG - CompoundRequestMapper - One compatible mapper found for URL 'wicket/resource/org.apache.wicket.Application/pdfProducer' - 'Mapper: org.apache.wicket.core.request.mapper.ResourceReferenceMapper; Score: 1' Maybe someone knows how to fix this? I could strip the first dot as a workaround in the mean time. Bruce -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Friday, March 13, 2015 4:17 PM To: users@wicket.apache.org Subject: Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13 Hi, This is your code: WebDocsSession session = (WebDocsSession)getSession(); final byte[] pdf = session.getPdf(); if(pdf == null) System.out.println(PdfPanel session.getPdf returned null); PdfResourceProducer pdfResourceProducer = new PdfResourceProducer(pdf); return pdfResourceProducer; There is nothing Component specific here. Except #getSession(), but you can use Session.get() and cast it. It is the same. If you need the component to be able to generate the PDF bytes then you need to implement IResourceListener interface. In #onResourceRequested() you can generate the bytes and write them to the Response: getResponse().write(byte[]). The change you need to do is in #urlFor(): urlFor(ResourceListener.INTERFACE, parameters)) Martin Grigorov Freelancer, available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Mar 13, 2015 at 8:15 PM, Bruce Lombardi brlom...@gmail.com wrote: Martin, I'm looking into mounting the resource but there is something that I don't understand. Currently I am creating the resource in my panel and passing the pdf I want to display into the constructor of the resource. If I mount the resource, how do I provide it with the dynamically generated pdf? I don't even see a way of getting a hold of the resourceReference object created and mounted in the WebApplication init() method. Perhaps I need to also register it as an application-shared resource, then access it in my panel constructor and add the pdf there? Bruce -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Friday, March 13, 2015 12:53 PM To: users@wicket.apache.org Subject: Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13 Hi, I think I see what happens. The ResRef is created as a local variable to create the url and then discarded. Wicket has something called ResourceReferenceRegistry. When a ResRef is used to create an url to it it is automatically registered in the registry. It seems after 6.13 there is no such auto-registration for your ResRef for some reason. You should have some WARNs in the logs. I see nothing component specific in your ResRef so I'd #mountResource() it. This way it will be always available. Martin Grigorov Freelancer, available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Mar 13, 2015 at 6:40 PM, Bruce Lombardi brlom...@gmail.com wrote: I have a PdfViewer page that contains a panel that displays a dynamically generated PDF using a resource reference. This works fine in Wicket 6.12.0, but when I upgrade to 6.13.0 it stops working (just changed Maven dependency - no code changes). No errors are displayed and
RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
Interesting, When I run your code I see that the url is as you say: ./wicket/resource/org.apache.wicket.Application/pdfProducer Whereas in my working code (wicket version 6.12) it is: ./resource/org.apache.wicket.Application/pdfProducer And in my non-working code (wicket versions 6.13 - 6.19) it is: ../resource/org.apache.wicket.Application/pdfProducer If I remove the first dot from the url with the debuggerthen run from there the pdf appears as it should. I wonder why they are different in the two projects and why I'm getting .. with later versions. I'm also wondering if there is another library that is somehow incompatible with later versions of Wicket. I think the only library we use that interacts with Wicket is wicket bootstrap - currently as below (but I've tried other version): dependency groupIdde.agilecoders.wicket/groupId artifactIdwicket-bootstrap-core/artifactId version0.9.8/version /dependency dependency groupIdde.agilecoders.wicket/groupId artifactIdwicket-bootstrap-extensions/artifactId version0.9.8/version /dependency I will add these dependencies to your quickstart and see if it makes a difference. Bruce -Original Message- From: Andrea Del Bene [mailto:an.delb...@gmail.com] Sent: Saturday, March 14, 2015 11:58 AM To: users@wicket.apache.org Subject: Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13 Hi, I've created a quickstart based on your code but I can't reproduce the issue. I've shared it on Dropbox: https://www.dropbox.com/s/qmolvzvp9a0xplf/ResourceIssue.tar.gz?dl=0 The only thing I've noted is that your resource url doesn't have starting segment 'wicket', i.e my resource url is: ./wicket/resource/org.apache.wicket.Application/pdfProducer Maybe you have some custom setting for wicket segments ('wicket', 'bookmark', etc...)? The problem (which I think is a bug) is in the way the url is produced. The line String url = (String)RequestCycle.get().urlFor(resourceReference, null); Produces the url to use for the resource ref. In the non-working version it returns: ../resource/org.apache.wicket.Application/pdfProducer If I set a breakpoint just after this line and I manually remove the first dot in the string using the debugger to get: ./resource/org.apache.wicket.Application/pdfProducer and then let the code continue to run, my pdf appears correctly. The debug trace also shows the correct uri. 2015-03-13 17:59:30,292 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,298 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,301 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,305 DEBUG - CompoundRequestMapper - One compatible mapper found for URL 'wicket/resource/org.apache.wicket.Application/pdfProducer' - 'Mapper: org.apache.wicket.core.request.mapper.ResourceReferenceMapper; Score: 1' Maybe someone knows how to fix this? I could strip the first dot as a workaround in the mean time. Bruce - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
Hi, I've created a quickstart based on your code but I can't reproduce the issue. I've shared it on Dropbox: https://www.dropbox.com/s/qmolvzvp9a0xplf/ResourceIssue.tar.gz?dl=0 The only thing I've noted is that your resource url doesn't have starting segment 'wicket', i.e my resource url is: ./wicket/resource/org.apache.wicket.Application/pdfProducer Maybe you have some custom setting for wicket segments ('wicket', 'bookmark', etc...)? The problem (which I think is a bug) is in the way the url is produced. The line String url = (String)RequestCycle.get().urlFor(resourceReference, null); Produces the url to use for the resource ref. In the non-working version it returns: ../resource/org.apache.wicket.Application/pdfProducer If I set a breakpoint just after this line and I manually remove the first dot in the string using the debugger to get: ./resource/org.apache.wicket.Application/pdfProducer and then let the code continue to run, my pdf appears correctly. The debug trace also shows the correct uri. 2015-03-13 17:59:30,292 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,298 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,301 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,305 DEBUG - CompoundRequestMapper - One compatible mapper found for URL 'wicket/resource/org.apache.wicket.Application/pdfProducer' - 'Mapper: org.apache.wicket.core.request.mapper.ResourceReferenceMapper; Score: 1' Maybe someone knows how to fix this? I could strip the first dot as a workaround in the mean time. Bruce - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
Thanks Andrea. I'll work with your quickstart and see what I can find. Bruce -Original Message- From: Andrea Del Bene [mailto:an.delb...@gmail.com] Sent: Saturday, March 14, 2015 11:58 AM To: users@wicket.apache.org Subject: Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13 Hi, I've created a quickstart based on your code but I can't reproduce the issue. I've shared it on Dropbox: https://www.dropbox.com/s/qmolvzvp9a0xplf/ResourceIssue.tar.gz?dl=0 The only thing I've noted is that your resource url doesn't have starting segment 'wicket', i.e my resource url is: ./wicket/resource/org.apache.wicket.Application/pdfProducer Maybe you have some custom setting for wicket segments ('wicket', 'bookmark', etc...)? The problem (which I think is a bug) is in the way the url is produced. The line String url = (String)RequestCycle.get().urlFor(resourceReference, null); Produces the url to use for the resource ref. In the non-working version it returns: ../resource/org.apache.wicket.Application/pdfProducer If I set a breakpoint just after this line and I manually remove the first dot in the string using the debugger to get: ./resource/org.apache.wicket.Application/pdfProducer and then let the code continue to run, my pdf appears correctly. The debug trace also shows the correct uri. 2015-03-13 17:59:30,292 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,298 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,301 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 17:59:30,305 DEBUG - CompoundRequestMapper - One compatible mapper found for URL 'wicket/resource/org.apache.wicket.Application/pdfProducer' - 'Mapper: org.apache.wicket.core.request.mapper.ResourceReferenceMapper; Score: 1' Maybe someone knows how to fix this? I could strip the first dot as a workaround in the mean time. Bruce - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org