The error changed to: WARN org.apache.wicket.request.resource.ResourceReferenceRegistry - A ResourceReference wont be created for a resource with key [scope: info.afilias.WAT.UI.CSSLinksInjector; name: info/css/tooltip.css; locale: null; style: null; variation: null] because it cannot be located.
On Tue, Jan 14, 2014 at 9:06 AM, Anna Simbirtsev <asimbirt...@gmail.com>wrote: > I changed it but still get the error > > response.render(CssReferenceHeaderItem.forReference(new > CssResourceReference(CSSLinksInjector.class, > root + "/css/login.css"))); > > > On Tue, Jan 14, 2014 at 8:51 AM, Ernesto Reinaldo Barreiro < > reier...@gmail.com> wrote: > >> Why not just use CSSLinksInjector.class instead of getClass()? >> >> >> On Tue, Jan 14, 2014 at 2:46 PM, Anna Simbirtsev <asimbirt...@gmail.com >> >wrote: >> >> > Hi, >> > >> > I am upgrading wicket from 1.4 to 6.7. >> > >> > Before my css files were added this way: >> > >> > public class CSSLinksInjector implements >> IComponentInstantiationListener, >> > Serializable >> > { >> > private static final long serialVersionUID = 7463279042460663915L; >> > >> > //private final List<HeaderContributor> cssResources = new >> > ArrayList<HeaderContributor>(); >> > private String theme; >> > >> > public CSSLinksInjector(String theme) >> > { >> > this.theme = theme; >> > String root = (theme == null || theme.isEmpty()) ? "" : "/" + >> > theme; >> > >> > /* >> > >> > cssResources.add(CSSPackageResource.getHeaderContribution(getClass(), >> > root + "/css/login.css")); >> > >> > cssResources.add(CSSPackageResource.getHeaderContribution(getClass(), >> > root + "/css/tooltip.css"));*/ >> > } >> > >> > >> > Now, I am adding them like this: >> > >> > public void onInstantiation(Component component) >> > { >> > if (component instanceof WebPage) >> > { >> > component.add(new CssBehaviour(theme)); >> > } >> > } >> > >> > >> > private class CssBehaviour extends Behavior { >> > >> > private static final long serialVersionUID = >> -1540416397347502364L; >> > private String theme; >> > >> > public CssBehaviour(String theme) { >> > this.theme = theme; >> > } >> > >> > @Override >> > public void renderHead(Component component, IHeaderResponse >> > response) { >> > String root = (theme == null || theme.isEmpty()) ? "" : "/" >> + >> > theme; >> > >> > >> > response.render(CssReferenceHeaderItem.forReference(new >> > CssResourceReference(getClass(), >> > root + "/css/login.css"))); >> > response.render(CssReferenceHeaderItem.forReference(new >> > CssResourceReference(getClass(), >> > root + "/css/tooltip.css"))); >> > } >> > } >> > >> > >> > When I run, I get an error: >> > >> > 2014-01-14 13:36:53,950 [838889794@qtp-4816459-2] WARN >> > org.apache.wicket.request.resource.ResourceReferenceRegistry - A >> > ResourceReference wont be created for a resource with key [scope: >> > info.afilias.WAT.UI.CSSLinksInjector$CssBehaviour; name: >> > info/css/login.css; locale: null; style: null; variation: null] because >> it >> > cannot be located. >> > >> > Before it was fine. >> > >> >> >> >> -- >> Regards - Ernesto Reinaldo Barreiro >> > >