RE: Add noise to the URL of ResourceLink component

2014-03-11 Thread Stijn de Witt
That is great Martin!

But you know how it goes with corporate deadlines... No time to wait for Wicket 
release...
No way I get to upgrade Wicket on the whole application for my one feature...

So a thing like that can become a big hurdle. But you are right I should have 
reported it at least.

-Stijn


-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: maandag 10 maart 2014 17:28
To: users@wicket.apache.org
Subject: Re: Add noise to the URL of ResourceLink component

On Mon, Mar 10, 2014 at 6:20 PM, Stijn de Witt < 
stijn.dew...@planonsoftware.com> wrote:

> This!
>
> There are so many methods in Wicket final... I often ended up copying 
> a whole class just because the method I wanted to override was final...
>

Next time start a new thread asking to remove some 'final' from the signature 
of a method with your use case.
We listen!


>
>
> -Original Message-
> From: BenHoit [mailto:benoit.lanoise...@orange.com]
> Sent: maandag 10 maart 2014 16:38
> To: users@wicket.apache.org
> Subject: Re: Add noise to the URL of ResourceLink component
>
> unfortunately getUrl is :
> protected final CharSequence getURL()
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-Res
> ourceLink-component-tp4664870p4664879.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
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Add noise to the URL of ResourceLink component

2014-03-10 Thread BenHoit
finally, it works with Sven's solution but tag html has to be   as i can see
in the link class (initially it was  in my html).  
I create a ResourceLinkWithAnticache like this :
public class ResourceLinkWithAnticache extends ResourceLink
{
public ResourceLinkWithAnticache(String id, IResource resource) {
super(id, resource);
}

private static final long serialVersionUID = 1L;

@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
String url = tag.getAttributes().getString("href");
url = url + "&antiCache=" + System.currentTimeMillis();
tag.put("href", url);   
}
}

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664884.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: Add noise to the URL of ResourceLink component

2014-03-10 Thread Martin Grigorov
On Mon, Mar 10, 2014 at 6:20 PM, Stijn de Witt <
stijn.dew...@planonsoftware.com> wrote:

> This!
>
> There are so many methods in Wicket final... I often ended up copying a
> whole class just because the method I wanted to override was final...
>

Next time start a new thread asking to remove some 'final' from the
signature of a method with your use case.
We listen!


>
>
> -Original Message-
> From: BenHoit [mailto:benoit.lanoise...@orange.com]
> Sent: maandag 10 maart 2014 16:38
> To: users@wicket.apache.org
> Subject: Re: Add noise to the URL of ResourceLink component
>
> unfortunately getUrl is :
> protected final CharSequence getURL()
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664879.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
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


RE: Add noise to the URL of ResourceLink component

2014-03-10 Thread Stijn de Witt
This!

There are so many methods in Wicket final... I often ended up copying a whole 
class just because the method I wanted to override was final...


-Original Message-
From: BenHoit [mailto:benoit.lanoise...@orange.com] 
Sent: maandag 10 maart 2014 16:38
To: users@wicket.apache.org
Subject: Re: Add noise to the URL of ResourceLink component

unfortunately getUrl is : 
protected final CharSequence getURL()

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664879.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


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



Re: Add noise to the URL of ResourceLink component

2014-03-10 Thread BenHoit
unfortunately getUrl is : 
protected final CharSequence getURL()

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664879.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: Add noise to the URL of ResourceLink component

2014-03-10 Thread Sven Meier

Hi,

take a look at Link#onComponentTag() on why this does not work in your case.

You should override #getURL() instead.

Sven

On 03/10/2014 04:14 PM, BenHoit wrote:

yes i'm using popupSettings
final String mime="application/xml";
ByteArrayResource res = new ByteArrayResource(mime,dSOBean.getOrder());

ResourceLink resourceL= new
ResourceLink("myF", res) {
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
String url = tag.getAttributes().getString("href");
log.debug("URL = "+url);
url = url + "antiCache=" + System.currentTimeMillis();
tag.put("href", url); 
log.debug("URL = 
"+tag.getAttributes().getString("href"));
}
};

PopupSettings popupSettings = new PopupSettings(
 PopupSettings.RESIZABLE |
PopupSettings.SCROLLBARS).setHeight(600).setWidth(1000);
resourceLink.setPopupSettings(popupSettings);

listItem.add(resourceLink);


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664877.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




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



Re: Add noise to the URL of ResourceLink component

2014-03-10 Thread BenHoit
yes i'm using popupSettings
final String mime="application/xml";
ByteArrayResource res = new ByteArrayResource(mime,dSOBean.getOrder());

ResourceLink resourceL= new
ResourceLink("myF", res) {
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
String url = tag.getAttributes().getString("href");
log.debug("URL = "+url);
url = url + "antiCache=" + System.currentTimeMillis();
tag.put("href", url);   
log.debug("URL = 
"+tag.getAttributes().getString("href"));
}
};

PopupSettings popupSettings = new PopupSettings(
 PopupSettings.RESIZABLE |   
PopupSettings.SCROLLBARS).setHeight(600).setWidth(1000);
resourceLink.setPopupSettings(popupSettings);

listItem.add(resourceLink);


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664877.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: Add noise to the URL of ResourceLink component

2014-03-10 Thread Sven Meier

Are you using popupSettings?

Sven

On 03/10/2014 04:01 PM, BenHoit wrote:

thanks, i modify my onComponentTag
@Override
protected void onComponentTag(ComponentTag tag) {
 super.onComponentTag(tag);
 String url = tag.getAttributes().getString("href");
 log.debug("URL = "+url);
 url = url + "antiCache=" + System.currentTimeMillis();
 tag.put("href", url);
 log.debug("URL modify =
"+tag.getAttributes().getString("href"));
}

my output is :
URL = #
URL modify = #antiCache=1394463265258

but my url in my browser (opened by the resourceLink) is not modified
(anticache param isn't visible) ... and the content is not the good one ...
(if i clear my browser cache and click on the link, the content is OK).

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664874.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




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



Re: Add noise to the URL of ResourceLink component

2014-03-10 Thread BenHoit
thanks, i modify my onComponentTag
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
String url = tag.getAttributes().getString("href");
log.debug("URL = "+url);
url = url + "antiCache=" + System.currentTimeMillis();
tag.put("href", url);   
log.debug("URL modify =
"+tag.getAttributes().getString("href"));
}

my output is :
URL = #
URL modify = #antiCache=1394463265258

but my url in my browser (opened by the resourceLink) is not modified
(anticache param isn't visible) ... and the content is not the good one ...
(if i clear my browser cache and click on the link, the content is OK).

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870p4664874.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: Add noise to the URL of ResourceLink component

2014-03-10 Thread Sven Meier

Links use a "href" attribute instead of "src".

Sven

On 03/10/2014 03:19 PM, BenHoit wrote:

hi,
i want to add noise to the url of a ResourceLink component (to avoid browser
caching problem) ...
i looked at Image#addAntiCacheParameter and try to put it in onComponentTag
of my ResourceLink
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
String url = tag.getAttributes().getString("src");
log.debug("URL = "+url);
url = url + (url.contains("?") ? "&" : "?");
url = url + "antiCache=" + System.currentTimeMillis();
tag.put("src", url);
}

but it doesn't work and in my log, url is null ...
Does anybody know how to do this ?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Add-noise-to-the-URL-of-ResourceLink-component-tp4664870.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






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