RE: New committer - Sebastien Briquet
Thank you very much Colin! :) On Mar 13, 2015 3:34 AM, Colin Rogers colin.rog...@objectconsulting.com.au wrote: Only just saw this... well done Sebastien - you've always been amazing help with JQuery-UI :) -Original Message- From: Patrick Davids [mailto:patrick.dav...@nubologic.com] Sent: Monday, 16 February 2015 7:05 PM To: users@wicket.apache.org Subject: Re: New committer - Sebastien Briquet Yeah, congratulations Sebastien! :-) Am 13.02.2015 um 22:02 schrieb Martin Grigorov: The Project Management Committee (PMC) for Apache Wicket has asked Sebastien Briquet to become a committer and we are pleased to announce that he has accepted. Sebastien has been involved with Wicket for several years now by developing one of the most successful integrations with JavaScript libraries, namely Wicket jQuery UI https://github.com/sebfz1/wicket-jquery-ui, reporting bugs, contributing fixes and participating in discussions. Being a committer will enable him to help us even easier in the future. Please welcome Sebastien Briquet to our team! Bienvenue Sebastien! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org EMAIL DISCLAIMER This email message and its attachments are confidential and may also contain copyright or privileged material. If you are not the intended recipient, you may not forward the email or disclose or use the information contained in it. If you have received this email message in error, please advise the sender immediately by replying to this email and delete the message and any associated attachments. Any views, opinions, conclusions, advice or statements expressed in this email message are those of the individual sender and should not be relied upon as the considered view, opinion, conclusions, advice or statement of this company except where the sender expressly, and with authority, states them to be the considered view, opinion, conclusions, advice or statement of this company. Every care is taken but we recommend that you scan any attachments for viruses. - 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
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 the html is generated exactly as it is with 6.12, but the pdf does not show up in the page. By setting a breakpoint in Eclipse I have determined that code in the resource that produces the response (newResourceResponse) is never called in 6.13. After migrating to the latest version (6.19) I still get the problem. I've looked at the release notes for version 6.13 and see some changes related to IResource but nothing that looks related to this problem. I'm hoping someone has seen something similar. Here is some of the relevant code: PdfViewer .html - just has reference to panel div wicket:id=pdfPanel/div PdfPane.html - just has object reference Raw HTML object wicket:id=pdf data= border=1 width=80% height=80%/object Generated HTML - seen with view source in browser object data=./resource/org.apache.wicket.Application/pdfProducer border=1 width=80% height=80%/object PdfPanel.java - has setup for resource reference public class PdfPanel extends Panel { private static final long serialVersionUID = 1L; public PdfPanel(String id) { super(id); ResourceReference resourceReference = new ResourceReference( pdfProducer) { private static final long serialVersionUID = 1L; @Override public IResource getResource() { 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; } }; String url = (String)RequestCycle.get().urlFor(resourceReference, null); MarkupContainer wmc = new WebMarkupContainer(pdf); wmc.add(new AttributeModifier(data, url)); add(wmc); } PdfProducer.java - implements the Resource public class PdfResourceProducer extends AbstractResource { private static final long serialVersionUID = -2245331056747467763L; final byte[] pdfByteArray; public PdfResourceProducer(byte[] pdfByteArray) { super(); this.pdfByteArray = pdfByteArray; if(pdfByteArray == null) { System.out.println(PdfResourceProducer constructor called with null byte array.); } } @Override protected ResourceResponse newResourceResponse(Attributes attributes) { ResourceResponse resourceResponse = new ResourceResponse(); resourceResponse.setContentType(application/pdf); // resourceResponse.setTextEncoding(utf-8); resourceResponse.setContentLength((int)pdfByteArray.length); resourceResponse.disableCaching(); //do not allow resource to be cached.
Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
Pass the info as parameters on the request to the mounted resource? On Fri, Mar 13, 2015 at 7: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 the html is generated exactly as it is with 6.12, but the pdf does not show up in the page. By setting a breakpoint in Eclipse I have determined that code in the resource that produces the response (newResourceResponse) is never called in 6.13. After migrating to the latest version (6.19) I still get the problem. I've looked at the release notes for version 6.13 and see some changes related to IResource but nothing that looks related to this problem. I'm hoping someone has seen something similar. Here is some of the relevant code: PdfViewer .html - just has reference to panel div wicket:id=pdfPanel/div PdfPane.html - just has object reference Raw HTML object wicket:id=pdf data= border=1 width=80% height=80%/object Generated HTML - seen with view source in browser object data=./resource/org.apache.wicket.Application/pdfProducer border=1 width=80% height=80%/object PdfPanel.java - has setup for resource reference public class PdfPanel extends Panel { private static final long serialVersionUID = 1L; public PdfPanel(String id) { super(id); ResourceReference resourceReference = new ResourceReference( pdfProducer) { private static final long serialVersionUID = 1L; @Override public IResource getResource() { 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; } }; String url = (String)RequestCycle.get().urlFor(resourceReference, null); MarkupContainer wmc = new WebMarkupContainer(pdf); wmc.add(new AttributeModifier(data, url)); add(wmc); } PdfProducer.java - implements the Resource public class PdfResourceProducer extends AbstractResource { private static final long serialVersionUID = -2245331056747467763L; final byte[] pdfByteArray; public PdfResourceProducer(byte[] pdfByteArray) { super(); this.pdfByteArray = pdfByteArray; if(pdfByteArray == null) { System.out.println(PdfResourceProducer constructor called with null byte array.); } } @Override protected ResourceResponse newResourceResponse(Attributes attributes) { ResourceResponse resourceResponse = new ResourceResponse();
RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
Thanks Martin. I'm not getting any WARN messages in the logs. I'll take a look at mounting the resource. 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 the html is generated exactly as it is with 6.12, but the pdf does not show up in the page. By setting a breakpoint in Eclipse I have determined that code in the resource that produces the response (newResourceResponse) is never called in 6.13. After migrating to the latest version (6.19) I still get the problem. I've looked at the release notes for version 6.13 and see some changes related to IResource but nothing that looks related to this problem. I'm hoping someone has seen something similar. Here is some of the relevant code: PdfViewer .html - just has reference to panel div wicket:id=pdfPanel/div PdfPane.html - just has object reference Raw HTML object wicket:id=pdf data= border=1 width=80% height=80%/object Generated HTML - seen with view source in browser object data=./resource/org.apache.wicket.Application/pdfProducer border=1 width=80% height=80%/object PdfPanel.java - has setup for resource reference public class PdfPanel extends Panel { private static final long serialVersionUID = 1L; public PdfPanel(String id) { super(id); ResourceReference resourceReference = new ResourceReference( pdfProducer) { private static final long serialVersionUID = 1L; @Override public IResource getResource() { 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; } }; String url = (String)RequestCycle.get().urlFor(resourceReference, null); MarkupContainer wmc = new WebMarkupContainer(pdf); wmc.add(new AttributeModifier(data, url)); add(wmc); } PdfProducer.java - implements the Resource public class PdfResourceProducer extends AbstractResource { private static final long serialVersionUID = -2245331056747467763L; final byte[] pdfByteArray; public PdfResourceProducer(byte[] pdfByteArray) { super(); this.pdfByteArray = pdfByteArray; if(pdfByteArray == null) { System.out.println(PdfResourceProducer constructor called with null byte array.); } } @Override protected ResourceResponse newResourceResponse(Attributes attributes) { ResourceResponse resourceResponse = new ResourceResponse(); resourceResponse.setContentType(application/pdf); // resourceResponse.setTextEncoding(utf-8); resourceResponse.setContentLength((int)pdfByteArray.length); resourceResponse.disableCaching(); //do not allow resource to be cached. resourceResponse.setWriteCallback(new WriteCallback() { @Override public void writeData(Attributes attributes) throws IOException { try { OutputStream outputStream = attributes.getResponse() .getOutputStream(); outputStream.write(pdfByteArray);
RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
Thanks Ernesto, I don't know how to pass a byte[] as a parameter. Bruce -Original Message- From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] Sent: Friday, March 13, 2015 2:20 PM To: users@wicket.apache.org Subject: Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13 Pass the info as parameters on the request to the mounted resource? On Fri, Mar 13, 2015 at 7: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 the html is generated exactly as it is with 6.12, but the pdf does not show up in the page. By setting a breakpoint in Eclipse I have determined that code in the resource that produces the response (newResourceResponse) is never called in 6.13. After migrating to the latest version (6.19) I still get the problem. I've looked at the release notes for version 6.13 and see some changes related to IResource but nothing that looks related to this problem. I'm hoping someone has seen something similar. Here is some of the relevant code: PdfViewer .html - just has reference to panel div wicket:id=pdfPanel/div PdfPane.html - just has object reference Raw HTML object wicket:id=pdf data= border=1 width=80% height=80%/object Generated HTML - seen with view source in browser object data=./resource/org.apache.wicket.Application/pdfProducer border=1 width=80% height=80%/object PdfPanel.java - has setup for resource reference public class PdfPanel extends Panel { private static final long serialVersionUID = 1L; public PdfPanel(String id) { super(id); ResourceReference resourceReference = new ResourceReference( pdfProducer) { private static final long serialVersionUID = 1L; @Override public IResource getResource() { 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; } }; String url = (String)RequestCycle.get().urlFor(resourceReference, null); MarkupContainer wmc = new WebMarkupContainer(pdf); wmc.add(new AttributeModifier(data, url)); add(wmc); } PdfProducer.java - implements the Resource public class PdfResourceProducer extends AbstractResource { private static final long serialVersionUID = -2245331056747467763L; final byte[] pdfByteArray; public PdfResourceProducer(byte[] pdfByteArray) { super(); this.pdfByteArray = pdfByteArray; if(pdfByteArray == null) {
RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
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 the html is generated exactly as it is with 6.12, but the pdf does not show up in the page. By setting a breakpoint in Eclipse I have determined that code in the resource that produces the response (newResourceResponse) is never called in 6.13. After migrating to the latest version (6.19) I still get the problem. I've looked at the release notes for version 6.13 and see some changes related to IResource
RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
That's not really possible. The pdf is produced by itext from a template with lots of parameter. It would require too large a change in the code and would couple the pdfViewer panel too closely to the domain code. If, as Martin suggests, the automatic registering of the resource is not being done in the ResourceReferenceRegistry maybe there is something I could do to register and then unregister the resource similar to the way it must have been done in 6.12.. Bruce -Original Message- From: reiern70 [mailto:reier...@gmail.com] Sent: Friday, March 13, 2015 3:40 PM To: users@wicket.apache.org Subject: RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13 Passing something that allows you to produce the byte []? Sent from Samsung Mobile Original message From: Bruce Lombardi brlom...@gmail.com Date:13/03/2015 20:20 (GMT+01:00) To: users@wicket.apache.org Subject: RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13 Thanks Ernesto, I don't know how to pass a byte[] as a parameter. Bruce -Original Message- From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] Sent: Friday, March 13, 2015 2:20 PM To: users@wicket.apache.org Subject: Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13 Pass the info as parameters on the request to the mounted resource? On Fri, Mar 13, 2015 at 7: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 the html is generated exactly as it is with 6.12, but the pdf does not show up in the page. By setting a breakpoint in Eclipse I have determined that code in the resource that produces the response (newResourceResponse) is never called in 6.13. After migrating to the latest version (6.19) I still get the problem. I've looked at the release notes for version 6.13 and see some changes related to IResource but nothing that looks related to this problem. I'm hoping someone has seen something similar. Here is some of the relevant code: PdfViewer .html - just has reference to panel div wicket:id=pdfPanel/div PdfPane.html - just has object reference Raw HTML object wicket:id=pdf data= border=1 width=80% height=80%/object Generated HTML - seen with view source in browser object data=./resource/org.apache.wicket.Application/pdfProducer border=1 width=80% height=80%/object PdfPanel.java - has setup for resource reference public class PdfPanel extends Panel { private static final long serialVersionUID = 1L; public PdfPanel(String id) { super(id); ResourceReference resourceReference = new ResourceReference( pdfProducer) { private static final long serialVersionUID = 1L; @Override public IResource getResource() { WebDocsSession session = (WebDocsSession)getSession(); final byte[] pdf = session.getPdf();
Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
Please create a quickstart application and attach it to JIRA. Thanks! Martin Grigorov Freelancer, available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov On Sat, Mar 14, 2015 at 12:03 AM, 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 the html is generated exactly as it is with 6.12, but the pdf does not show up in the page. By
RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
Thanks Martin an others. I am always impressed with the helpfulness of the people on this list. I will look into what you suggest. In the meantime I'm trying to find out more information about the differences between versions and I set the logger level to DEBUG and obtained the traces below from working and non-working versions. Maybe this will help shed some light on what is happening. I see some differences like uri for working version starts with /wicket/resource but non-working version starts with /resource/ but I don't know what the differences mean. Maybe someone know about this change? If the difference in the way resource reference registration works between 6.12 and 6.13 is an unintended change in behavior between versions, it seems like it should be fixed. If it is an intended change, then it should be documented. Working Version 6.12 Debug trace 2015-03-13 16:12:35,585 DEBUG - CompoundRequestMapper - One compatible mapper found for URL 'wicket/resource/de.agilecoders.wicket.webjars.request.resource.WebjarsCssResourceReference/webjars/bootstrap/2.3.2/css/bootstrap-ver-1378733671227.css' - 'Mapper: org.apache.wicket.core.request.mapper.ResourceReferenceMapper; Score: 1' 2015-03-13 16:12:35,648 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 16:12:35,648 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 16:12:35,648 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/wicket/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 16:12:35,648 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' Non-Working Version 6.13 Debug trace 2015-03-13 16:01:47,826 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 16:01:47,826 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 16:01:47,826 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 16:01:47,826 DEBUG - CompoundRequestMapper - No compatible mapper found for URL 'resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 16:01:47,826 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 16:01:47,826 DEBUG - ServletWebRequest - Calculating context relative path from: context path '', filterPrefix '', uri '/resource/org.apache.wicket.Application/pdfProducer' 2015-03-13 16:01:47,826 DEBUG - RequestCycle - No suitable handler found for URL resource/org.apache.wicket.Application/pdfProducer, falling back to container to process this request -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
RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
Passing something that allows you to produce the byte []? Sent from Samsung Mobile Original message From: Bruce Lombardi brlom...@gmail.com Date:13/03/2015 20:20 (GMT+01:00) To: users@wicket.apache.org Subject: RE: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13 Thanks Ernesto, I don't know how to pass a byte[] as a parameter. Bruce -Original Message- From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] Sent: Friday, March 13, 2015 2:20 PM To: users@wicket.apache.org Subject: Re: PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13 Pass the info as parameters on the request to the mounted resource? On Fri, Mar 13, 2015 at 7: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 the html is generated exactly as it is with 6.12, but the pdf does not show up in the page. By setting a breakpoint in Eclipse I have determined that code in the resource that produces the response (newResourceResponse) is never called in 6.13. After migrating to the latest version (6.19) I still get the problem. I've looked at the release notes for version 6.13 and see some changes related to IResource but nothing that looks related to this problem. I'm hoping someone has seen something similar. Here is some of the relevant code: PdfViewer .html - just has reference to panel div wicket:id=pdfPanel/div PdfPane.html - just has object reference Raw HTML object wicket:id=pdf data= border=1 width=80% height=80%/object Generated HTML - seen with view source in browser object data=./resource/org.apache.wicket.Application/pdfProducer border=1 width=80% height=80%/object PdfPanel.java - has setup for resource reference public class PdfPanel extends Panel { private static final long serialVersionUID = 1L; public PdfPanel(String id) { super(id); ResourceReference resourceReference = new ResourceReference( pdfProducer) { private static final long serialVersionUID = 1L; @Override public IResource getResource() { 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; } }; String url = (String)RequestCycle.get().urlFor(resourceReference, null); MarkupContainer wmc = new WebMarkupContainer(pdf); wmc.add(new AttributeModifier(data, url)); add(wmc); } PdfProducer.java - implements the Resource public class PdfResourceProducer extends AbstractResource {
Adding new data to existing ListView
Is it possible to add data to an existing ListView for which data is already loaded? Basically what i want is if say i have 10 records already present then add 10 more records to the existing ListView, so we get 20 records. I tried but the ListView gets refreshed if i try to set the new list to it. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Adding-new-data-to-existing-ListView-tp4669967.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Adding new data to existing ListView
Hi, Yes, just put more items to its backing List. Or better use an IModel that fetches the List dynamically based on some conditions. You need to repaint/refresh it to be able to render the new items. If you use Ajax then you have to repaint its (grand)parent. Martin Grigorov Freelancer, available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Mar 13, 2015 at 9:20 AM, avchavan avinash.cha...@yahoo.co.in wrote: Is it possible to add data to an existing ListView for which data is already loaded? Basically what i want is if say i have 10 records already present then add 10 more records to the existing ListView, so we get 20 records. I tried but the ListView gets refreshed if i try to set the new list to it. Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Adding-new-data-to-existing-ListView-tp4669967.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Marker view model
Maybe wrong forum :-) On Fri, Mar 13, 2015 at 12:21 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, I tried to use a marker view model, i.e. a view model without any properties. I need it to trigger instantiation of a custom component(factory). I thought that I may put all the properties in the component, so the view model won't need to have them. It will be just a marker, like marker interfaces. This didn't work because of the code at https://github.com/apache/isis/blob/master/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java#L124 I will put the properties in the view model to overcome this check. Is this something that could be relaxed or this check has to stay there for some other functionality ? Martin Grigorov Freelancer, available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov -- Regards - Ernesto Reinaldo Barreiro
Marker view model
Hi, I tried to use a marker view model, i.e. a view model without any properties. I need it to trigger instantiation of a custom component(factory). I thought that I may put all the properties in the component, so the view model won't need to have them. It will be just a marker, like marker interfaces. This didn't work because of the code at https://github.com/apache/isis/blob/master/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java#L124 I will put the properties in the view model to overcome this check. Is this something that could be relaxed or this check has to stay there for some other functionality ? Martin Grigorov Freelancer, available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov
Re: Marker view model
Sorry :-) Martin Grigorov Freelancer, available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Mar 13, 2015 at 1:24 PM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Maybe wrong forum :-) On Fri, Mar 13, 2015 at 12:21 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, I tried to use a marker view model, i.e. a view model without any properties. I need it to trigger instantiation of a custom component(factory). I thought that I may put all the properties in the component, so the view model won't need to have them. It will be just a marker, like marker interfaces. This didn't work because of the code at https://github.com/apache/isis/blob/master/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java#L124 I will put the properties in the view model to overcome this check. Is this something that could be relaxed or this check has to stay there for some other functionality ? Martin Grigorov Freelancer, available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov -- Regards - Ernesto Reinaldo Barreiro
Re: Marker view model
It is perfectly understandable :-) Cheers! On Fri, Mar 13, 2015 at 12:27 PM, Martin Grigorov mgrigo...@apache.org wrote: Sorry :-) Martin Grigorov Freelancer, available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Mar 13, 2015 at 1:24 PM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Maybe wrong forum :-) On Fri, Mar 13, 2015 at 12:21 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, I tried to use a marker view model, i.e. a view model without any properties. I need it to trigger instantiation of a custom component(factory). I thought that I may put all the properties in the component, so the view model won't need to have them. It will be just a marker, like marker interfaces. This didn't work because of the code at https://github.com/apache/isis/blob/master/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java#L124 I will put the properties in the view model to overcome this check. Is this something that could be relaxed or this check has to stay there for some other functionality ? Martin Grigorov Freelancer, available for hire! Wicket Training and Consulting https://twitter.com/mtgrigorov -- Regards - Ernesto Reinaldo Barreiro -- Regards - Ernesto Reinaldo Barreiro
Enabling Java EE and Fortress Security inside an Apache Wicket Web App
Hello, another post on how a wicket application can be hooked in with java EE security and fortress rbac controls: https://iamfortress.wordpress.com/2015/03/13/enabling-java-ee-and-fortress-security-inside-an-apache-wicket-web-app/ Hope you find it helpful. Shawn - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
PDF viewed in panel via ResourceReference works in 6.12 but not in 6.13
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 the html is generated exactly as it is with 6.12, but the pdf does not show up in the page. By setting a breakpoint in Eclipse I have determined that code in the resource that produces the response (newResourceResponse) is never called in 6.13. After migrating to the latest version (6.19) I still get the problem. I've looked at the release notes for version 6.13 and see some changes related to IResource but nothing that looks related to this problem. I'm hoping someone has seen something similar. Here is some of the relevant code: PdfViewer .html - just has reference to panel div wicket:id=pdfPanel/div PdfPane.html - just has object reference Raw HTML object wicket:id=pdf data= border=1 width=80% height=80%/object Generated HTML - seen with view source in browser object data=./resource/org.apache.wicket.Application/pdfProducer border=1 width=80% height=80%/object PdfPanel.java - has setup for resource reference public class PdfPanel extends Panel { private static final long serialVersionUID = 1L; public PdfPanel(String id) { super(id); ResourceReference resourceReference = new ResourceReference( pdfProducer) { private static final long serialVersionUID = 1L; @Override public IResource getResource() { 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; } }; String url = (String)RequestCycle.get().urlFor(resourceReference, null); MarkupContainer wmc = new WebMarkupContainer(pdf); wmc.add(new AttributeModifier(data, url)); add(wmc); } PdfProducer.java - implements the Resource public class PdfResourceProducer extends AbstractResource { private static final long serialVersionUID = -2245331056747467763L; final byte[] pdfByteArray; public PdfResourceProducer(byte[] pdfByteArray) { super(); this.pdfByteArray = pdfByteArray; if(pdfByteArray == null) { System.out.println(PdfResourceProducer constructor called with null byte array.); } } @Override protected ResourceResponse newResourceResponse(Attributes attributes) { ResourceResponse resourceResponse = new ResourceResponse(); resourceResponse.setContentType(application/pdf); // resourceResponse.setTextEncoding(utf-8); resourceResponse.setContentLength((int)pdfByteArray.length); resourceResponse.disableCaching(); //do not allow resource to be cached. resourceResponse.setWriteCallback(new WriteCallback() { @Override public void writeData(Attributes attributes) throws IOException { try { OutputStream outputStream = attributes.getResponse() .getOutputStream(); outputStream.write(pdfByteArray); outputStream.flush(); } catch (IOException e) { throw new WicketRuntimeException( Problems writing pdf to response...); } } }); return resourceResponse; } Bruce
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 the html is generated exactly as it is with 6.12, but the pdf does not show up in the page. By setting a breakpoint in Eclipse I have determined that code in the resource that produces the response (newResourceResponse) is never called in 6.13. After migrating to the latest version (6.19) I still get the problem. I've looked at the release notes for version 6.13 and see some changes related to IResource but nothing that looks related to this problem. I'm hoping someone has seen something similar. Here is some of the relevant code: PdfViewer .html - just has reference to panel div wicket:id=pdfPanel/div PdfPane.html - just has object reference Raw HTML object wicket:id=pdf data= border=1 width=80% height=80%/object Generated HTML - seen with view source in browser object data=./resource/org.apache.wicket.Application/pdfProducer border=1 width=80% height=80%/object PdfPanel.java - has setup for resource reference public class PdfPanel extends Panel { private static final long serialVersionUID = 1L; public PdfPanel(String id) { super(id); ResourceReference resourceReference = new ResourceReference( pdfProducer) { private static final long serialVersionUID = 1L; @Override public IResource getResource() { 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; } }; String url = (String)RequestCycle.get().urlFor(resourceReference, null); MarkupContainer wmc = new WebMarkupContainer(pdf); wmc.add(new AttributeModifier(data, url)); add(wmc); } PdfProducer.java - implements the Resource public class PdfResourceProducer extends AbstractResource { private static final long serialVersionUID = -2245331056747467763L; final byte[] pdfByteArray; public PdfResourceProducer(byte[] pdfByteArray) { super(); this.pdfByteArray = pdfByteArray; if(pdfByteArray == null) { System.out.println(PdfResourceProducer constructor called with null byte array.); } } @Override protected ResourceResponse newResourceResponse(Attributes attributes) { ResourceResponse resourceResponse = new ResourceResponse(); resourceResponse.setContentType(application/pdf); // resourceResponse.setTextEncoding(utf-8); resourceResponse.setContentLength((int)pdfByteArray.length); resourceResponse.disableCaching(); //do not allow resource to be cached. resourceResponse.setWriteCallback(new WriteCallback() { @Override public void writeData(Attributes attributes) throws IOException { try { OutputStream outputStream = attributes.getResponse() .getOutputStream(); outputStream.write(pdfByteArray); outputStream.flush(); } catch (IOException e) { throw new WicketRuntimeException( Problems writing pdf to response...); } } }); return resourceResponse; }