ResourceReferenceRegistry
Could someone help me understand what the error below means ? I have copied the relevant code below, what is wrong with it. I believe I have followed guidelines for wicket 1.5 Mar 07, 2012 8:48:43 AM org.apache.wicket.request.resource.ResourceReferenceRegi stry addDefaultResourceReference WARNING: Asked to auto-create a ResourceReference, but ResourceReferenceRegistry.createDefaultResourceReference() return null. [scope: web.components.PageHeaderComponent$2; name: css/mouseovermenu.css; locale: null; style: null; variation: null] public final class PageHeaderComponent extends WebComponent { public PageHeaderComponent(final String id, final String changeDestination) { super(id); add(new Behavior() { private final ResourceReference mouseOverMenuCss = new CssResourceReference(getClass(), "/css/mouseovermenu.css"); @Override public void renderHead(Component component, IHeaderResponse response) { response.renderCSSReference(mouseOverMenuCss); } }); (...) } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ResourceReferenceRegistry-tp4453457p4453457.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceReferenceRegistry
On Wed, Mar 7, 2012 at 4:54 PM, grazia wrote: > Could someone help me understand what the error below means ? I have copied > the relevant code below, what is wrong with it. I believe I have followed > guidelines for wicket 1.5 > > > Mar 07, 2012 8:48:43 AM > org.apache.wicket.request.resource.ResourceReferenceRegi > stry addDefaultResourceReference > WARNING: Asked to auto-create a ResourceReference, but > ResourceReferenceRegistry.createDefaultResourceReference() return null. > [scope: web.components.PageHeaderComponent$2; name: css/mouseovermenu.css; > locale: null; style: null; > variation: null] > > public final class PageHeaderComponent extends WebComponent { > > > > public PageHeaderComponent(final String id, final String > changeDestination) { > super(id); > add(new Behavior() { > private final ResourceReference mouseOverMenuCss = new > CssResourceReference(getClass(), Try with: new CssResourceReference(PageHeaderComponent.class) instead > > "/css/mouseovermenu.css"); > @Override > public void renderHead(Component component, IHeaderResponse > response) { > > response.renderCSSReference(mouseOverMenuCss); > } > }); > (...) > } > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/ResourceReferenceRegistry-tp4453457p4453457.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceReferenceRegistry
Thank you Martin. I think it is an issue of absolutePath. In private final ResourceReference mouseOverMenuCss = new CssResourceReference(getClass(), "/css/mouseovermenu.css"); the PackageResource.exists(scope, path, locale, style, variation) will try to find my css reousrce in the path of the PageHeaderComponentClass, which is not where my css is. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ResourceReferenceRegistry-tp4453457p4453566.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceReferenceRegistry
The problem is at $2 in web.components.PageHeaderComponent$2 This is an inner anonymous class which name may vary. Just use a stable class name and make sure the resource is next to the .class file. On Wed, Mar 7, 2012 at 5:34 PM, grazia wrote: > Thank you Martin. > I think it is an issue of absolutePath. > > In > private final ResourceReference mouseOverMenuCss = new > CssResourceReference(getClass(), > > "/css/mouseovermenu.css"); > > the PackageResource.exists(scope, path, locale, style, variation) > will try to find my css reousrce in the path of the > PageHeaderComponentClass, which is not where my css is. > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/ResourceReferenceRegistry-tp4453457p4453566.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceReferenceRegistry
what is the resource is not next to the .class file, but in a specific directory external to the app, say in tomcat/webapps/css ? Is there another wicket API I should use ? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ResourceReferenceRegistry-tp4453457p4454858.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceReferenceRegistry
See org.apache.wicket.markup.html.IHeaderResponse#renderCSSReference(String) On Thu, Mar 8, 2012 at 12:09 AM, grazia wrote: > what is the resource is not next to the .class file, but in a specific > directory external to the app, say in tomcat/webapps/css ? Is there another > wicket API I should use ? > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/ResourceReferenceRegistry-tp4453457p4454858.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceReferenceRegistry
Still not clear what I did wrong. With wicket 1.4 my code was: public final class PageHeaderComponent extends WebComponent { public PageHeaderComponent(final String id, final String changeDestination) { super(id); add(CSSPackageResource.getHeaderContribution("/css/header.css")); } (...) } and it created what I needed Now with wicket 1.5, my code is: public final class PageHeaderComponent extends WebComponent { public PageHeaderComponent(final String id, final String changeDestination) { super(id); add(new Behavior() { private final ResourceReference headerCss = new PackageResourceReference("/css/header.css"); @Override public void renderHead(Component component, IHeaderResponse response) { response.renderCSSReference(headerCss); } }); } (...) } and it creates: The warning being logged is: WARNING: Asked to auto-create a ResourceReference, but ResourceReferenceRegistry .createDefaultResourceReference() return null. [scope: org.apache.wicket.Application; name: css/header.css; locale: null; style: null; variation: null] -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/ResourceReferenceRegistry-tp4453457p4457469.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org