Why don't you just use a component for this, e.g. DownloadLink?

<a wicket:id="${var.wellKnownWicketId}">Download</a>

No stable url involved.

Sven

On 09/13/2011 04:45 AM, Alec Swan wrote:
> Our templating engine is the one that needs to generate the link by
> evaluating a template similar to "<a
> href='${var.reportLink}'>Download</a>". The engine does not have
> access to any Wicket components but can access Thread local
> properties, such as RequestCycle.get(). I guess we could add a
> behavior to RequestCycle.get().getResponsePage().
> 
> Is this what you are suggesting or there is a more elegant way to
> implement this in Wicket?
> 
> Thanks,
> 
> Alec
> 
> On Mon, Sep 12, 2011 at 5:27 PM, Igor Vaynberg <[email protected]> 
> wrote:
>> the problem is when you say "build a url to an instance of this
>> request target" wicket doesnt hold on to the instance, nor does it
>> have any way to recreate it.
>>
>> what you can do is add a behavior to the page and construct a url to
>> that behavior.
>>
>> -igor
>>
>>
>> On Mon, Sep 12, 2011 at 4:16 PM, Alec Swan <[email protected]> wrote:
>>> I don't really need a stable URL. In fact, I would prefer if the link
>>> URL was session or page-specific so that it cannot be accessed by
>>> anybody unless they first accessed the page that contains the link.
>>>
>>> I would like to do something along the lines of the code in my
>>> original post. In other words, I would like to create a new
>>> RequestTarget and get its URL and display that URL to the user.
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>>
>>> On Mon, Sep 12, 2011 at 4:14 PM, Igor Vaynberg <[email protected]> 
>>> wrote:
>>>> create a resource and register it in shared resources, this will allow
>>>> you to create a stable url. the filename and reportdata you will have
>>>> to pass on the url.
>>>>
>>>> -igor
>>>>
>>>> On Mon, Sep 12, 2011 at 2:25 PM, Alec Swan <[email protected]> wrote:
>>>>> Hello,
>>>>>
>>>>> We use a templating engine which generates parts of our pages.
>>>>> Templates can be included on any page. We need the engine to be able
>>>>> to generate a link which will display a report when clicked. I tried
>>>>> using the following code, but it returns null from
>>>>> RequestTarget.urlFor(..):
>>>>>
>>>>> public String getReportLink() {
>>>>>        return "" + RequestCycle.get().urlFor(new
>>>>> DownloadCsvRequestTarget(fileName, reportData));
>>>>> }
>>>>>
>>>>> Where DownloadCsvRequestTarget implements respond() method to write
>>>>> reportData our in CSV format.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Alec
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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]
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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]
>>
>>
> 
> ---------------------------------------------------------------------
> 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