[wicket 1.5] Howto avoid 404 on shared image?

2011-10-07 Thread Mike Mander

Hi,

i use 1.5.1 (in 1.5 examples i couldn't find a matching one)

I've packaged my application images to a package (appname.res.img). 
WicketApplication is located in root package (appname).
In the images package there is a class ImageMounter which is loading all 
images in package and mount them this way


ImageMounter.java
code
String image = ...; // The image name - one of then IS transparency.png
WebApplication.get().mountResource(resources/shop/img/.concat(image), 
new PackageResourceReference(ImageMounter.class, image));

/code

But if i try to use one of the images with the Image class like that:
MyPanel.java
code
Image image = new Image(itemSpot, new 
PackageResourceReference(/resources/shop/img/transparency.png));

/code

MyPanel.html
code
ul
li wicket:id=leafleta wicket:id=overImageToDetailsimg 
wicket:id=itemSpot //a/li

/ul
/code

i get a 404. Here is the stacktrace
WARN  - ResourceReferenceRegistry  - Asked to auto-create a 
ResourceReference, but 
ResourceReferenceRegistry.createDefaultResourceReference() return null.  
[scope: org.apache.wicket.Application; name: 
resources/shop/img/transparency.png; locale: null; style: null; 
variation: null]
TRACE - error404   - 
16e4jys7nta9q1qq82q3q88dut;/wicket/resource/org.apache.wicket.Application/resources/shop/img/transparency.png


I would like to know what i'm doing wrong and why?
Thanks for helping me
Mike


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [wicket 1.5] Howto avoid 404 on shared image?

2011-10-07 Thread Martin Grigorov
See http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/
for inspiration

On Fri, Oct 7, 2011 at 10:25 AM, Mike Mander wicket-m...@gmx.de wrote:
 Hi,

 i use 1.5.1 (in 1.5 examples i couldn't find a matching one)

 I've packaged my application images to a package (appname.res.img).
 WicketApplication is located in root package (appname).
 In the images package there is a class ImageMounter which is loading all
 images in package and mount them this way

 ImageMounter.java
 code
 String image = ...; // The image name - one of then IS transparency.png
 WebApplication.get().mountResource(resources/shop/img/.concat(image), new
 PackageResourceReference(ImageMounter.class, image));
 /code

 But if i try to use one of the images with the Image class like that:
 MyPanel.java
 code
 Image image = new Image(itemSpot, new
 PackageResourceReference(/resources/shop/img/transparency.png));
 /code

 MyPanel.html
 code
 ul
 li wicket:id=leafleta wicket:id=overImageToDetailsimg
 wicket:id=itemSpot //a/li
 /ul
 /code

 i get a 404. Here is the stacktrace
 WARN  - ResourceReferenceRegistry  - Asked to auto-create a
 ResourceReference, but
 ResourceReferenceRegistry.createDefaultResourceReference() return null.
  [scope: org.apache.wicket.Application; name:
 resources/shop/img/transparency.png; locale: null; style: null; variation:
 null]
 TRACE - error404                   -
 16e4jys7nta9q1qq82q3q88dut;/wicket/resource/org.apache.wicket.Application/resources/shop/img/transparency.png

 I would like to know what i'm doing wrong and why?
 Thanks for helping me
 Mike


 -
 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: [wicket 1.5] Howto avoid 404 on shared image?

2011-10-07 Thread Mike Mander

Thanks Martin,

Uuuh. That is heavy-weight for my little uc :-)
Instead of using an image i use now
code
WebComponent image = new WebComponent(itemSpot);
image.add(new SrcModifier(Model.String 
of(/resources/shop/img/transparency.png)));

/code

My page is still stateless, and 404 is gone. So it seems to solve my 
problem.

But i really would like to understand the whole process :-)

Thanks
Mike


See http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/
for inspiration

On Fri, Oct 7, 2011 at 10:25 AM, Mike Manderwicket-m...@gmx.de  wrote:

Hi,

i use 1.5.1 (in 1.5 examples i couldn't find a matching one)

I've packaged my application images to a package (appname.res.img).
WicketApplication is located in root package (appname).
In the images package there is a class ImageMounter which is loading all
images in package and mount them this way

ImageMounter.java
code
String image = ...; // The image name - one of then IS transparency.png
WebApplication.get().mountResource(resources/shop/img/.concat(image), new
PackageResourceReference(ImageMounter.class, image));
/code

But if i try to use one of the images with the Image class like that:
MyPanel.java
code
Image image = new Image(itemSpot, new
PackageResourceReference(/resources/shop/img/transparency.png));
/code

MyPanel.html
code
ul
li wicket:id=leafleta wicket:id=overImageToDetailsimg
wicket:id=itemSpot //a/li
/ul
/code

i get a 404. Here is the stacktrace
WARN  - ResourceReferenceRegistry  - Asked to auto-create a
ResourceReference, but
ResourceReferenceRegistry.createDefaultResourceReference() return null.
  [scope: org.apache.wicket.Application; name:
resources/shop/img/transparency.png; locale: null; style: null; variation:
null]
TRACE - error404   -
16e4jys7nta9q1qq82q3q88dut;/wicket/resource/org.apache.wicket.Application/resources/shop/img/transparency.png

I would like to know what i'm doing wrong and why?
Thanks for helping me
Mike


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org








-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [wicket 1.5] Howto avoid 404 on shared image?

2011-10-07 Thread Martin Grigorov
On Fri, Oct 7, 2011 at 12:31 PM, Mike Mander wicket-m...@gmx.de wrote:
 Thanks Martin,

 Uuuh. That is heavy-weight for my little uc :-)
I'd say that your approach was heavy-weight. You were going to add a
mapper for each image, while my approach adds just one (stateless)
mapper that dynamically resolves the images per request.
 Instead of using an image i use now
 code
            WebComponent image = new WebComponent(itemSpot);
            image.add(new SrcModifier(Model.String
 of(/resources/shop/img/transparency.png)));
 /code

 My page is still stateless, and 404 is gone. So it seems to solve my
 problem.
I'm glad to hear that!
 But i really would like to understand the whole process :-)

 Thanks
 Mike

 See http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/
 for inspiration

 On Fri, Oct 7, 2011 at 10:25 AM, Mike Manderwicket-m...@gmx.de  wrote:

 Hi,

 i use 1.5.1 (in 1.5 examples i couldn't find a matching one)

 I've packaged my application images to a package (appname.res.img).
 WicketApplication is located in root package (appname).
 In the images package there is a class ImageMounter which is loading all
 images in package and mount them this way

 ImageMounter.java
 code
 String image = ...; // The image name - one of then IS transparency.png
 WebApplication.get().mountResource(resources/shop/img/.concat(image),
 new
 PackageResourceReference(ImageMounter.class, image));
 /code

 But if i try to use one of the images with the Image class like that:
 MyPanel.java
 code
 Image image = new Image(itemSpot, new
 PackageResourceReference(/resources/shop/img/transparency.png));
 /code

 MyPanel.html
 code
 ul
 li wicket:id=leafleta wicket:id=overImageToDetailsimg
 wicket:id=itemSpot //a/li
 /ul
 /code

 i get a 404. Here is the stacktrace
 WARN  - ResourceReferenceRegistry  - Asked to auto-create a
 ResourceReference, but
 ResourceReferenceRegistry.createDefaultResourceReference() return null.
  [scope: org.apache.wicket.Application; name:
 resources/shop/img/transparency.png; locale: null; style: null;
 variation:
 null]
 TRACE - error404                   -

 16e4jys7nta9q1qq82q3q88dut;/wicket/resource/org.apache.wicket.Application/resources/shop/img/transparency.png

 I would like to know what i'm doing wrong and why?
 Thanks for helping me
 Mike


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org






 -
 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