[
https://issues.apache.org/jira/browse/WICKET-2507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12762757#action_12762757
]
Juergen Donnerstag commented on WICKET-2507:
--------------------------------------------
The problem is here: ResourceReference.java
protected Resource newResource()
{
PackageResource packageResource =
PackageResource.get(getScope(), getName(), getLocale(),
getStyle());
if (packageResource != null)
{
locale = packageResource.getLocale();
}
else
{
throw new IllegalArgumentException("package resource
[scope=" + getScope() + ",name=" +
getName() + ",locale=" + getLocale() + "style="
+ getStyle() + "] not found");
}
return packageResource;
}
The problem is "locale = packageResource.getLocale();". Since newResource() is
only called on first invocation, on the 2nd it'll find it in the shared
resource cache. When taken from the cache, locale is not reset, which is why
the 2nd request returns a different URL.
I'm not yet sure how to fix it. Obviously removing "locale = ..." will result
in all href containing the locale. Exactly the opposite we want. Simply
Ignoring locale will not find the right files and thus is no solution either.
> Inconsistent resource path using <wicket:link> and HeaderContributor after
> second request
> -----------------------------------------------------------------------------------------
>
> Key: WICKET-2507
> URL: https://issues.apache.org/jira/browse/WICKET-2507
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4.1, 1.4.2
> Reporter: Daniel Stoch
> Attachments: wicket_link_testproject.zip
>
>
> In Wicket 1.4.1, 1.4.2 there is an inconsistency in rendering resource path
> (eg. for css) when we are using <wicket:link> tag in HTML and
> HeaderContributor in Java code.
> When we enter a page with a linked resource (using: <wicket:link>):
> ...
> <head>
> <title>Wicket Quickstart Archetype Homepage</title>
> <wicket:link>
> <link href="main.css" rel="stylesheet" type="text/css"
> media="screen, projection"/>
> </wicket:link>
> </head>
> ...
> for the very first time (after starting application), a link for main.css is
> rendered as:
> <link href="resources/com.mycompany.HomePage/main.css" rel="stylesheet"
> type="text/css" media="screen, projection"/>
> But after the second request this link is always rendered as:
> <link href="resources/com.mycompany.HomePage/main_locale.css"
> rel="stylesheet" type="text/css" media="screen, projection"/>
> where "_locale" is your current locale string (eg. "_pl", "_de", ...)
> So the locale string is appended to the resource path. In Wicket 1.3.6 the
> path is always without locale.
> You can try attached quickstart-app to see the difference.
> When we replace <wicket:link> in html, with
> CSSPackageResource.getHeaderContribution in code:
> add(CSSPackageResource.getHeaderContribution(HomePage.class, "main.css"));
> this link is always rendered as:
> <link rel="stylesheet" type="text/css"
> href="resources/com.mycompany.HomePage/main.css" />
> Well I think both ways: using <wicket:link> or header contribution in code,
> should produce always the same url path for resource and it should not
> contain "_locale" suffix (as in Wicket 1.3.6).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.