thanks maarten, but i still can't get the url for the resource in the
renderHead method.
in the open flash chart example, there are two types of urls built:
- resourcereferences (easy peasy to get the url)
- resource, via RequestCycle.get().urlFor(OpenFlashChart.this,
IResourceListener.INTERFACE);
remember, my component is:
public abstract class SWFComponent extends WebMarkupContainer
implements IResourceListener, IHeaderContributor
in my case i need the url to a *resource*, so i tried:
a) RequestCycle.get().urlFor(SWFComponent.this,
IResourceListener.INTERFACE); or urlFor(IResourceListener.INTERFACE);
in the onBeforeRender method
=> it outputs the url to a *bookmarkable page* / not my resource:
?wicket:bookmarkablePage=:app.wicket.project.DocumentPage&wicket:interface=:2:docsPanel:viewer:flash::IResourceListener::
b) RequestCycle.get().urlFor(SWFComponent.this,
IResourceListener.INTERFACE); in the renderHead method
=> it outputs the url to another different *bookmarkable page* /
not my resource:
?wicket:bookmarkablePage=:app.wicket.document.DocumentDetailPage&wicket:interface=:10:detailPanel:viewer:flash::IResourceListener::
c) urlFor(IResourceListener.INTERFACE); in the renderHead method
=> *sometimes* it works.
this means *sometimes* it outputs
"?wicket:interface=:3:docsPanel:viewer:flash::IResourceListener:: "
(this is correct - it works) , but some other times it outputs "
?wicket:bookmarkablePage=:app.wicket.document.DocumentDetailPage&wicket:interface=:10:detailPanel:viewer:flash::IResourceListener::
" (this is not correct - it doesn't work).
this mysterious behaviour hasn't occured just once, it randomly
happened after compilation several times.
is this a bug or why does it behave like that? am i misusing the api?
should the resource, markup container and/or header contributor live
in different classes? suggestions?
thanks again
francisco
2009/3/31 Maarten Bosteels <[email protected]>:
> Have you seen this page [1], it also features an SWFObject.
>
> http://cwiki.apache.org/WICKET/open-flash-chart-and-wicket.html
>
> regards,
> Maarten
>
> On Tue, Mar 31, 2009 at 3:36 PM, francisco treacy
> <[email protected]> wrote:
>> hi all,
>>
>> i can't seem to find the way to get an url for a given RequestTarget.
>> i'm using wicket 1.4-rc1.
>>
>> basically i have an SWFComponent : http://paste.pocoo.org/show/110435/
>>
>> my problem is in line 35, when i call urlFor(target) to the renderHead
>> method. the target is of type ResourceStreamRequestTarget and when i
>> dig into the sources for the urlFor call, i end up in
>> WebRequestCodingStrategy#encode:
>>
>> // fall through for non-default request targets
>> url = doEncode(requestCycle, requestTarget);
>>
>> doEncode javadoc reads:
>>
>> * In case you are using custom targets that are not part of the
>> default target hierarchy, you
>> * need to override this method, which will be called after the
>> defaults have been tried. When
>> * this doesn't provide a url either (returns null), an exception
>> will be thrown by the encode
>> * method saying that encoding could not be done.
>>
>> where am i supposed to override this method?
>>
>> additionally, wicket doesn't seem to throw an exception as stated - it
>> silently returns the null value.
>>
>> any ideas on how to get the url, or improvements to the code i pasted
>> to make it work?
>>
>> thank you,
>>
>> francisco
>>
>> ps: note that the ResourceStreamRequestTarget works fine. for instance
>> if i call getRequestCycle().setRequestTarget(target); on renderHead,
>> the http response streams the swf file.
>>
>> ---------------------------------------------------------------------
>> 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]