Re: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
Hi Ernesto, after a couple of weeks (months) I still haven't found a solution. Any idea? Thanks for your helping hand. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4667100.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: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
Hi, With the following modifications it works: in HomePage.html: spanstatic resource from Web Container/span img class=icon src=images/dotclear.png /br spanContextRelativeResource with SharedResourceReference/span img class=icon wicket:id=dotclear1 /br spanPlaceholderImageResourceReference/span img class=icon wicket:id=dotclear2 / in HomePage.java: add(new Image(dotclear1, new SharedResourceReference(dotclear))); add(new Image(dotclear2, new PlaceholderImageResourceReference())); the generated paths look like: http://localhost:8080/en_US/images/dotclear1-ver-138389572.png note the locale as first segment in the path! with your code this is missing and thus the 404s Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Wed, Aug 20, 2014 at 10:58 AM, Dirk Forchel dirk.forc...@exedio.com wrote: Hi Ernesto, after a couple of weeks (months) I still haven't found a solution. Any idea? Thanks for your helping hand. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4667100.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: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
Thank you Martin. Lovely. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4667115.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: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
Did anybody try to run my attached quickstart application and can explain why the additional LocaleMapper changes the path? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4662335.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: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
Did not have time to look at it. I will try today. On Tue, Nov 12, 2013 at 7:44 AM, Dirk Forchel dirk.forc...@exedio.comwrote: Did anybody try to run my attached quickstart application and can explain why the additional LocaleMapper changes the path? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4662335.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 -- Regards - Ernesto Reinaldo Barreiro
Re: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
may I ask what is the use case for this 1x1 PNG? Is it something that cannot be handled via CSS + static image on resources? On Fri, Nov 8, 2013 at 8:49 AM, Dirk Forchel dirk.forc...@exedio.comwrote: Okay. I know, but their is no need for an additional parameter. I want to generate always the same image (a 1x1px PNG with a transparent background). So I don't see the need for a parameter. But I try to prepare a quickstart. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4662225.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 -- Regards - Ernesto Reinaldo Barreiro
Re: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
No, actually not. We've got a complete layout for our web applications from an external design company and they use this CSS+static image resource thing quite often. And, as I have mentioned before, we have two Wicket web applications running in the same container. One of them on the root context and one of them on e.g. /foo. If I start the application server (Tomcat) and request the home page of the second application (e.g. /foo/uk/en/home.html) the first application is initialized too, just to render the static placeholder image from the web container. I was wondering why and started to do some investigation. If I would disable the first web application (remove the servlet from web.xml), all works fine and even the static image resource from the web container is delivered. By the way ... I've finished to prepare a quickstart (see uploaded quickstart.zip file). At the first glance all images were rendered. I've added an additional mapper (the LocalMapper from the Wicket examples) to simulate our Country/Language mapping solution and ... oh wonder ... the second and third images are not rendered! quickstart.zip http://apache-wicket.1842946.n4.nabble.com/file/n4662232/quickstart.zip -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4662232.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
Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
I mount two different resources almost the same way to figure out how it works. First of all a context relative resource (the dotclear_tmp.png image is relative to the context root in my WEB-INF container) and second a dynamically created image resource (see below). But in my panel the src attributes of the img-tags are not referenced correctly or at least it does not works the way I would expect. I've noticed that I do not have to register the dotclear_tmp.png image the way I did, because the image is delivered with my web container and can be resolved by Wicket automatically. Even if I would remove the SharedResourceReference, the image could be found. I have to explain, that my WebApplication is mapped to the /foo servlet path. And I can request the images with the following URLs: localhost:8080/images/dotclear_tmp.png (the image relative to the context root in my web container) localhost:8080/foo/images/dotclear_tmp.png (the mounted image as shared resource) localhost:8080/foo/images/dotclear.png (the mounted image as dynamic resource) Below my Panel for tests. The first image is shown (I guess this is the image from the web container). The second image is not shown (the relative URL does not point to the mounted one) where the third and fourth src attributes are working. But I guess this is not the way it should or at least it is not a good idea to include the servlet context path to the src attribute of the img-tags. I need an explanation how it could work as expected and how to solve my problem. The request to my home page with the following URL http://localhost:8080/foo/uk/en/home.html would render the page with the following relative URLs for the -tag: In my Application: ContextRelativeResource resource = new ContextRelativeResource(/images/dotclear_tmp.png); // NOTE: an AutoResourceReference is created getSharedResources().add( dotclear, resource ); // NOTE: SharedResourceReference is just a shortcut to the previous created AutoResourceReference mountResource(/images/dotclear_tmp.png, new SharedResourceReference(dotclear) ); // NOTE: create on the fly an image resource as placeholder mountResource(/images/dotclear.png, new PlaceholderImageResourceReference() ); public class PlaceholderImageResourceReference extends ResourceReference { private static final long serialVersionUID = 1L; public PlaceholderImageResourceReference() { super(placeholderImageResource); } @Override public IResource getResource() { return new PlaceholderImageResource(); } /** * A cached resource which returns back a placeholder image as bytes. */ private static class PlaceholderImageResource extends RenderedDynamicImageResource { private static final long serialVersionUID = 1L; public PlaceholderImageResource() { super( 1, 1, png ); setType( BufferedImage.TYPE_INT_ARGB ); } @Override protected boolean render( Graphics2D graphics, Attributes attributes ) { graphics.setComposite( AlphaComposite.getInstance(AlphaComposite.CLEAR, 0)); graphics.fillRect(0, 0, getWidth(), getHeight() ); return true; } @Override public boolean equals(Object that) { return that instanceof PlaceholderImageResource; } } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190.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: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
And finally I've added two Image components to the Panel (this works as expected). In my Panel.class: add( new Image(img1, new SharedResourceReference(dotclear) ) ); add( new Image(img2, new PlaceholderImageResourceReference() ) ); HTML: Rendered URLs: In addition we use the placeholder image quite often in different panels to replace it with different css rules like this (only an example): .bt_right { background: url(../images/sprite.png) -200px -30px; width: 10px; height:32px; margin:4px 0 0 0; } So even if I could add an appropriate Image component to each panel using the placeholder image this would blow up the code where it should not. I hope I could make it clear. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4662196.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: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
No comment? No idea? Probably another solution? Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4662219.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: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
Did you read this? http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ On Fri, Nov 8, 2013 at 6:56 AM, Dirk Forchel dirk.forc...@exedio.comwrote: No comment? No idea? Probably another solution? Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4662219.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 -- Regards - Ernesto Reinaldo Barreiro
Re: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
Yes, I know this article and based on this one I wrote the PlaceholderImageResourceReference class. And it works as expected. I mean I can add this resource reference to each component I want. Panel: add( new Image(placeholderImg, new PlaceholderImageResourceReference() ) ); Markup: But this is not the point. I thought I can add a kind of global resource with a mount path like: mountResource(/images/dotclear.png, new PlaceholderImageResourceReference() ); Where each src-attribute of an img-tag with the src path like images/dotclear.png is replaced with the image automatically. But it is not. We have about 10 to 20 Panels with almost the same placeholder image. But if I add the servlet context path (the application runs with this servlet context path) to the src-attribute, the image is added!? I don't understand why? This is a bit strange to me. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4662221.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: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
If you mount a global resource then you can pass a parameter to it and use that parameter to generate dynamic image. If you create a quickstart I could try to look at it and help (if I can). On Fri, Nov 8, 2013 at 8:18 AM, Dirk Forchel dirk.forc...@exedio.comwrote: Yes, I know this article and based on this one I wrote the PlaceholderImageResourceReference class. And it works as expected. I mean I can add this resource reference to each component I want. Panel: add( new Image(placeholderImg, new PlaceholderImageResourceReference() ) ); Markup: But this is not the point. I thought I can add a kind of global resource with a mount path like: mountResource(/images/dotclear.png, new PlaceholderImageResourceReference() ); Where each src-attribute of an img-tag with the src path like images/dotclear.png is replaced with the image automatically. But it is not. We have about 10 to 20 Panels with almost the same placeholder image. But if I add the servlet context path (the application runs with this servlet context path) to the src-attribute, the image is added!? I don't understand why? This is a bit strange to me. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4662221.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 -- Regards - Ernesto Reinaldo Barreiro
Re: Struggling with ContextRelativeResource, RenderedDynamicImageResource and SharedResources
Okay. I know, but their is no need for an additional parameter. I want to generate always the same image (a 1x1px PNG with a transparent background). So I don't see the need for a parameter. But I try to prepare a quickstart. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Struggling-with-ContextRelativeResource-RenderedDynamicImageResource-and-SharedResources-tp4662190p4662225.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