You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bernhard Michal <mi...@tigra.cz> on 2009/09/24 11:13:11 UTC
image html element's (img) src attribute processing
Hello everyone.
I noticed that wicket automatically translate url in img's src attribute
in html to the right url regarding to changed url context.
I mean when I've got eg. link <img src="/img/someimage.png"> and that
page is rendered in some context for example "/appContext/" the src
attribute is automatically changed to something like this: <img
src="/../img/someimage.png"> (notice two dots) to reflect changed
context (and link
still the same resource)
1) Where exactly is the code which doing this?
2) How can I obtain this changed url for static resources?
I am asking this because I've got some static resources (javascripts)
and I need to know their relative url regarding to changed context.
Thank you for your response.
Best wishes
MB
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: image html element's (img) src attribute processing
Posted by Bernhard Michal <mi...@tigra.cz>.
Great! Thank you very much.
I get new url through
IRequestCodingStrategy#rewriteStaticRelativeUrl(String url):
String newUrl =
RequestCycle.get().getProcessor().getRequestCodingStrategy().rewriteStat
icRelativeUrl(urlToChange);
MB
-----Original Message-----
From: Pedro Santos [mailto:pedrosans@gmail.com]
Sent: Thursday, September 24, 2009 1:33 PM
To: users@wicket.apache.org
Subject: Re: image html element's (img) src attribute processing
1) Where exactly is the code which doing this?
http://wicket.apache.org/docs/1.4/org/apache/wicket/request/IRequestCodi
ngStrategy.html
2) How can I obtain this changed url for static resources?
You can create an resource reference to your image resource.
http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wic
ket/ResourceReference.html
On Thu, Sep 24, 2009 at 6:13 AM, Bernhard Michal
<mi...@tigra.cz>wrote:
>
> Hello everyone.
>
> I noticed that wicket automatically translate url in img's src
> attribute in html to the right url regarding to changed url context.
> I mean when I've got eg. link <img src="/img/someimage.png"> and that
> page is rendered in some context for example "/appContext/" the src
> attribute is automatically changed to something like this: <img
> src="/../img/someimage.png"> (notice two dots) to reflect changed
> context (and link still the same resource)
>
> 1) Where exactly is the code which doing this?
> 2) How can I obtain this changed url for static resources?
>
> I am asking this because I've got some static resources (javascripts)
> and I need to know their relative url regarding to changed context.
>
> Thank you for your response.
>
> Best wishes
>
> MB
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Pedro Henrique Oliveira dos Santos
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: image html element's (img) src attribute processing
Posted by Pedro Santos <pe...@gmail.com>.
1) Where exactly is the code which doing this?
http://wicket.apache.org/docs/1.4/org/apache/wicket/request/IRequestCodingStrategy.html
2) How can I obtain this changed url for static resources?
You can create an resource reference to your image resource.
http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/ResourceReference.html
On Thu, Sep 24, 2009 at 6:13 AM, Bernhard Michal
<mi...@tigra.cz>wrote:
>
> Hello everyone.
>
> I noticed that wicket automatically translate url in img's src attribute
> in html to the right url regarding to changed url context.
> I mean when I've got eg. link <img src="/img/someimage.png"> and that
> page is rendered in some context for example "/appContext/" the src
> attribute is automatically changed to something like this: <img
> src="/../img/someimage.png"> (notice two dots) to reflect changed
> context (and link
> still the same resource)
>
> 1) Where exactly is the code which doing this?
> 2) How can I obtain this changed url for static resources?
>
> I am asking this because I've got some static resources (javascripts)
> and I need to know their relative url regarding to changed context.
>
> Thank you for your response.
>
> Best wishes
>
> MB
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Pedro Henrique Oliveira dos Santos