I was able to solve my issue with this:
http://markmail.org/message/66le4n6vmpcfv3tq#query:wicket%20dynamicwebresource%20example+page:1+mid:yv5hunvthfqrb5bv+state:results

But still, I would be happy if somebody answers my questions. ;)

Regards,
Peter

2009-08-07 21:06 keltezéssel, Major Péter írta:
Hi all,

I have a page, and I need to generate a PDF file: after the user presses
a button, then the downloading is being started.
For the PDF-generation I would like to use iText, but I have no idea,
how to create a link to the downloadable content.
I tried to follow UploadDownload wiki page, but got lost by spring
beans. So far I created a DynamicWebResource subclass:

public class PdfFileResource extends DynamicWebResource {

@Override
protected ResourceState getResourceState() {
return new PdfFileResourceState();
}

class PdfFileResourceState extends ResourceState {

@Override
public String getContentType() {
return "application/pdf";
}

@Override
public byte[] getData() {
throw new UnsupportedOperationException("Not supported yet.");
}
}
}

I guess in the PdfFileResource's constructor I need to set the data for
ResourceState, am I right?

The wiki sais also, that in Application#init I need to add the new
SharedResource, so I did that too.

but after that how to use it?

I guessing the follows:
In the Button#onSubmit I should create first the outputstream
(bytearrayoutputstream) for the pdf, after that I should create a new
pdfFileResource with the outputstream.

- But after that, how do I get URL for the newly created resource and
how do I redirect to it?
- While creating the URL for the resource, does it matters which
urlcodingstrategy am I using? (I'm currently using BPRTUCS).
- what does the mountSharedResource do at all? (Is it for only static
resources?)

Any help would be appreciated.

//I looked the archives first, but am still confused, please help

Best Regards,
Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to