You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by grazia <Gr...@gmail.com> on 2012/03/07 15:54:28 UTC
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: ResourceReferenceRegistry
Posted by grazia <Gr...@gmail.com>.
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
<link rel="stylesheet" type="text/css" href="/css/header.css" />
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:
<link rel="stylesheet" type="text/css"
href="wicket/resource/org.apache.wicket.Application/css/header-ver-F274BBEF68106E265B1DB7EE2B7DF144.css"
/>
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: ResourceReferenceRegistry
Posted by Martin Grigorov <mg...@apache.org>.
See org.apache.wicket.markup.html.IHeaderResponse#renderCSSReference(String)
On Thu, Mar 8, 2012 at 12:09 AM, grazia <Gr...@gmail.com> 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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: ResourceReferenceRegistry
Posted by grazia <Gr...@gmail.com>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: ResourceReferenceRegistry
Posted by Martin Grigorov <mg...@apache.org>.
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 <Gr...@gmail.com> 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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: ResourceReferenceRegistry
Posted by grazia <Gr...@gmail.com>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: ResourceReferenceRegistry
Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Mar 7, 2012 at 4:54 PM, grazia <Gr...@gmail.com> 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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org