DynamicWebResource in WWB

18 views
Skip to first unread message

zabian

unread,
Jun 17, 2009, 6:15:38 PM6/17/09
to Wicket Web Beans
Hi,
I would like to put something like ResourceLink in the WicketWebBeans
list to return DynamicWebResource to the client, actually generate
some PDF document.
Do you know any good idea how to do it using WWB (ajaxTarget, form,
bean) approach?

Regards,
Wojtek

Dan Syrstad

unread,
Jun 17, 2009, 8:57:32 PM6/17/09
to wicket-w...@googlegroups.com
You can combine WWB with regular Wicket on the same page. WWB's components are just regular Wicket components. This way you can take advantage of the best of both worlds.  Alternately, you could create an action in WWB. When the action is clicked, you generate the PDF and return it.

-Dan

zabian

unread,
Jun 18, 2009, 3:47:56 AM6/18/09
to Wicket Web Beans
Thanks for reply,
I know I can combine Wicket with WWB, but i would like to have this
link on WWB generated list, so I think I suppose to use WWB action.
The problem is how to return generated file to the client. Should I
write usual servlet and send request to it when the action is clicked?

On 18 Cze, 02:57, Dan Syrstad <dsyrs...@gmail.com> wrote:
> You can combine WWB with regular Wicket on the same page. WWB's components
> are just regular Wicket components. This way you can take advantage of the
> best of both worlds.  Alternately, you could create an action in WWB. When
> the action is clicked, you generate the PDF and return it.
>
> -Dan
>

zabian

unread,
Jun 19, 2009, 7:57:46 AM6/19/09
to Wicket Web Beans
any idea how to do it?

zabian

unread,
Jun 24, 2009, 1:21:11 PM6/24/09
to Wicket Web Beans
I can't see any help, so because I found the solution I would like to
share with you:

public class PDFResource extends DynamicWebResource{
........
}

And this snipet to put into an action:

IResourceStream resourceStream = new PDFResource
(bean).getResourceStream();
getRequestCycle().setRequestTarget( new ResourceStreamRequestTarget
(resourceStream) {
public String getFileName() {
return bean.getNumber() + ".pdf"; } });

Actually the solution I found originally was:
IResourceStream resourceStream = new ByteArrayResourceStream(pdf,
"application/pdf");

where pdf is an array of bytes
byte[] pdf = ...;

but I couldn't find ByteArrayResourceStream class.
Does anybody know where I can find it?

Daniel Toffetti

unread,
Jul 9, 2009, 1:59:32 PM7/9/09
to Wicket Web Beans
Hi zabian,

Check this post:

http://www.mail-archive.com/us...@wicket.apache.org/msg24529.html

Also I suggest you to check this site:

http://grepcode.com/

it's great for navigating java source code and searching for
classes.

Hth,

Daniel

zabian

unread,
Jul 10, 2009, 4:59:27 AM7/10/09
to Wicket Web Beans
Thank you, It was really helpful, because I use FOP in my application.
grepcode.com - really nice tool.
I was using similar - http://koders.com for browsing sources and
another useful http://findjar.com for looking for missing classes and
libraries.

Regards,
Wojtek

Chris

unread,
Apr 10, 2012, 8:34:48 AM4/10/12
to wicket-w...@googlegroups.com
Hi Zabian!

Some years old your solution.., but it solved my problem. :-)
Thanks a lot for posting!

       Cheers
          Christian
Reply all
Reply to author
Forward
0 new messages