The idea is as follows, for as far as I know:
- you either mount your resource (dynamic, static) as a shared resource (1), or
- you set it as the request target when the user clicks a link (2)

Now let me explain both:

1) Basically, what you do is mount your DWR through
Application.get().getSharedResources().add() (als take a look at SharedResources.putClassAlias for prettier URLs)
Then you create a ResourceReference to it;
The link between the mounted DWR and the ResourceReference is the scope (either Application or one of your own classes) and a static name (String).

Linking to it is then merely a matter of calling component.urlFor( ResourceReference ) (or RequestCycle.get().urlFor in case you are outside of a component). The URL returned here can be used as the href for a link, for example.

2) As mentioned earlier, you use
getRequestCycle().setRequestTarget( new ResourceStreamRequestTarget(...) )
and supply it with an IResourceStream implementation which wraps your resource.

(2) is automatically secure (url depends on session), (1) is accessible by anyone unless you add checks yourself. You can also add pageparameters to (1) to make it not only depend on e.g the Session but also on external parameters.

Hope this helps.

Bas

----- Original Message ----- From: "Major Péter" <[email protected]>
To: <[email protected]>
Sent: Saturday, August 08, 2009 1:52 PM
Subject: Re: How to use DynamicWebResource?


I was only guessing, that the DWR would be the solution to my problem (the idea was from uploaddownload wiki page).

The link you provided is exactly the same solution which I linked before (It's just on a different archive-browser.) :)
//And that one is working perfectly for me.

So if I have a custom DWR, do I gonna need a ResourceStreamRequestTarget to making it downloadable (or bookmarkable)?
And if I have a RequestTarget how can I make it bookmarkable?

Thanks

Peter

2009-08-08 13:40 keltezéssel, Martin Makundi írta:
- After creating a DWR, how do I get an URL for the newly created resource
and how do I redirect to it?

I would assume DWR is just a resource. It does not have an URL on its
own. HEre is an example where it is attached to a link:
http://mail-archives.apache.org/mod_mbox/wicket-users/200708.mbox/%[email protected]%3e

Use for example ResourceStreamRequestTarget

- While creating the URL for the resource, does it matters which
urlcodingstrategy am I using? (I'm currently using BPRTUCS).

Don't know how/why it would matter.

- what does the mountSharedResource do at all? (Is it for only static
resources?)

Don't know that either. Hopefully someone else can help you with these.

**
Martin


2009-08-08 13:23 keltezéssel, Martin Makundi írta:
I'm using iText for generating Pdf, this is only a PoC code, Later I will add a business object to the class, so I can provide custom datas for the pdf generating part. You can also see, that this code will generate the
pdf
on-demand.
Can you elaborate the problem you still have?

**
Martin

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




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

Reply via email to