Very interesting!  That was easy, all good again, thanks for the help !!




Eelco Hillenius wrote:
> 
> com/ezfizz/whisky/http:/images.overstock.com/f/102/3117/8h/www.overstock.com/images/products/T10577058.jpg
>>
>> If I use Context Image:
>> image = new ContextImage("prodImg",  new Model( "url" ) );
>>
>> Then it shows broken Image and the image property says:
>> >https://lilo:8443/whisky/http://images.overstock.com/f/102/3117/8h/www.overstock.com/images/products/T10577058.jpg
> 
> 
> That is because that is not a context image you're trying to display
> there! Context refers to context path == part of your war.
> 
> What you need to do is write your own class that handles both:
> 
> public class ContextImage extends WebComponent {
> 
>       public ContextImage(String id) {
>               super(id);
>       }
> 
>       public ContextImage(String id, IModel model) {
>               super(id, model);
>       }
> 
>       protected void onComponentTag(final ComponentTag tag) {
>               checkComponentTag(tag, "img");
>               super.onComponentTag(tag);
>               String url = getModelObjectAsString();
>               if (url.startsWith("http")) {
>                   tag.put("src", url);
>               } else {
>                   tag.put("src", 
> getRequest().getRelativePathPrefixToContextRoot()
> + getModelObjectAsString());
>               }
>       }
> }
> 
> Something like that. Try to look at the source code more. Writing your
> own components often isn't that difficult.
> 
> Eelco
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Images-Example-Question%21-tf4484804.html#a12803139
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to