Hi Martin,
That's a good solution, currently I keep the response.renderCSSReference(new
CustomCssResourceReference("front.css")) but implement a custom
DecoratingHeaderResponse to chose if I return instead of the string the
original packaged css resource in the war file.
DecoratingHeaderResponse
public void renderCSSReference(ResourceReference reference) {
if(reference.getScope()) and if the css file is available do a
super.renderCSS(reference.getName()) and if not return a new
CssResourceReference(reference.getScope(), reference.getName())
However I was not fully confident about this approach of rendering the css
string, because Wicket cannot apply the caching strategy addition of a
IStaticCacheableResource.
Right now I mounted a that takes the name of the resource from the url.
app.mountResource("/custom/css/${name}", new CustomDirResourceReference());
to solve any requests for /custom/css/front.css
but also have a custom ResourceReferenceRegistry that automatically creates
the ResourceReference for CustomCssResourceReferences:
protected ResourceReferenceRegistry newResourceReferenceRegistry() {
return new ResourceReferenceRegistry() {
@Override
protected ResourceReference
createDefaultResourceReference(ResourceReference.Key key) {
if(key.getScope().equals(CustomCssResource.class.getName()))
{
return new CustomCssResourceReference(key.getName());
}
return super.createDefaultResourceReference(key);
}
};
}
I only need to solve the fact that it mounts it to a package
wicket/resource/com.dada.web.frontend.resource.CustomCssResource/front-ver-1324746271000.css
and not to a "nice" url perhaps something like
getSharedResources().putClassAlias()
-----
http://balamaci.wordpress.com
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Overridable-css-resource-tp4229370p4235219.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]