Unfortunately, the workaround you mention does not work. You still end
up with the locale as part of the client-side filename. The only way I
got it to work is by subclassing Link and overriding this method:
protected String getURL()
{
resourceReference.bind(getApplication());
return getPage().urlFor(resourceReference.getPath());
}
and this basically drops the locale and style. The bad part about all
of this is that it is far from obvious to end-users that they need to do
all of this. I only discovered it by trial and error and looking at the
source-code, something end-users should not have to do.
Coming back to the original question, why does have to be implemented
this way in order to support localized resources? Why can't it simply
use the search order I mentioned (in a separate email)?
That is, look for localized filenames first, if the server-side files
exist return them. If they do not exist, look for a non-localized
filename, if it exists return it. Finally, if all other conditions fail,
return a broken link.
Gili
Eelco Hillenius wrote:
Nope, not my bad, it must be done like this in order to support
localized resources. However, for non-localized resources, there is an
easy workaround:
StaticResourceReference resource = new
StaticResourceReference(DogFoodPage.class, "doggybag.exe")
{
protected wicket.Resource newResource()
{
return StaticResource.get(getScope().getPackage(),
getName());
};
};
add(new ResourceLink("downloadLink", resource));
And if your really want to do it localized, you have to pre-bind the
references for the available locales and provide a custom ResourceLink
where you override getURL.
Eelco
Eelco Hillenius wrote:
Ok, that's probably my bad. I didn't expect it to be a problem for
anyone, but I'll see if it is possible to fix it.
Eelco
Gili wrote:
I mean that if I have the file doggybag.exe on the server which I
link to using ResourceLink, when the client clicks on the link in his
browser, he gets a message about downloading doggybag_en_us.exe which
is incorrect.
I am sending an install program of my application to end-users
and I don't want the filename mangled in any way.
Gili
Juergen Donnerstag wrote:
Sorry, but I don't understand what you mean.
Juergen
On 5/30/05, Gili <[EMAIL PROTECTED]> wrote:
The problem isn't finding the file on the server end. The
problem is
that even if it files a locale-less filename on the server-end, it
still
sends appends to the locale on the client-end (HTML code).
Is this a bug then?
Gili
Juergen Donnerstag wrote:
Without having taken a look into the source: ResourceLink tries to
load a resource with locale + style, locale, style and without
anything, it should work as long as the resource file does not have
the locale or style attached. I know there is a log4j setting for the
class to enable logging on which filenames are checked for existence.
Again, I didn't look into the source, I might be wrong.
Juergen
On 5/30/05, Gili <[EMAIL PROTECTED]> wrote:
Hi,
Is it possible to create a ResourceLink that never appends
anything to
the filename like locale? I tried extending ResourceLink but it is
impossible to either override getLocale(), getStyle() to always
return
null because they are final methods nor is it possible to override
getURL() because "resourceReference" is a private field.
If I *am* supposed to be subclassing ResourceLink, please
consider
making resourceReference protected. Otherwise, I am open to your
suggestions.
Thank you,
Gili
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using
Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit
http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using
Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit
http://developer.yahoo.net/?fr=fad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit
http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit
http://developer.yahoo.net/?fr=fad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit
http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit
http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop