You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by FaRHaN <fa...@ymail.com> on 2009/08/13 09:44:07 UTC

How to add Random number to URL ?

Hi,
I want to add a random number to my requested URL, so that each request to my page go to server and not load from the cache. How can i add a random number to each requested URL ?
Some examples acheiving this behaviour will be appreciated...

Thanks...



      

Re: How to add Random number to URL ?

Posted by Witold Czaplewski <wi...@cts-media.eu>.
This class modifies the src attribute of the img tag:
...
	protected void onComponentTag(ComponentTag tag)
	{
		super.onComponentTag(tag);

		String url = tag.getAttributes().getString("src");
		url = url + ((url.indexOf("?") >= 0) ? "&" : "?");
		url = url + "wicket:antiCache=" +
		System.currentTimeMillis();

		tag.put("src", url);
	}
...

Maybe you can do something similar with your links.

Am Thu, 13 Aug 2009 01:15:48 -0700 (PDT)
schrieb FaRHaN <fa...@ymail.com>:

> How can i use this for every request ? As i want to generate a unique
> URL for every page (not for images), any examples ???
> 
> 
> 
> 
> ________________________________
> From: Witold Czaplewski <wi...@cts-media.eu>
> To: users@wicket.apache.org
> Sent: Thursday, August 13, 2009 2:58:18 PM
> Subject: Re: How to add Random number to URL ?
> 
> Take a look at NonCachingImage.
> 
> Witold
> 
> Am Thu, 13 Aug 2009 00:44:07 -0700 (PDT)
> schrieb FaRHaN <fa...@ymail.com>:
> 
> > Hi,
> > I want to add a random number to my requested URL, so that each
> > request to my page go to server and not load from the cache. How can
> > i add a random number to each requested URL ? Some examples
> > acheiving this behaviour will be appreciated...
> > 
> > Thanks...
> > 
> > 
> > 
> >      
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
>       

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


Re: How to add Random number to URL ?

Posted by Erik van Oosten <e....@grons.nl>.
You request puzzles me. By default Wicket adds headers to every page 
that will make any decent browser written since 1996 not cache the page.

What is your intention?

Regards,
     Erik.

FaRHaN wrote:
> How can i use this for every request ? As i want to generate a unique URL for every page (not for images), any examples ???
>
>   
-- 
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



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


Re: How to add Random number to URL ?

Posted by FaRHaN <fa...@ymail.com>.
How can i use this for every request ? As i want to generate a unique URL for every page (not for images), any examples ???




________________________________
From: Witold Czaplewski <wi...@cts-media.eu>
To: users@wicket.apache.org
Sent: Thursday, August 13, 2009 2:58:18 PM
Subject: Re: How to add Random number to URL ?

Take a look at NonCachingImage.

Witold

Am Thu, 13 Aug 2009 00:44:07 -0700 (PDT)
schrieb FaRHaN <fa...@ymail.com>:

> Hi,
> I want to add a random number to my requested URL, so that each
> request to my page go to server and not load from the cache. How can
> i add a random number to each requested URL ? Some examples acheiving
> this behaviour will be appreciated...
> 
> Thanks...
> 
> 
> 
>      

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


      

Re: How to add Random number to URL ?

Posted by Witold Czaplewski <wi...@cts-media.eu>.
Take a look at NonCachingImage.

Witold

Am Thu, 13 Aug 2009 00:44:07 -0700 (PDT)
schrieb FaRHaN <fa...@ymail.com>:

> Hi,
> I want to add a random number to my requested URL, so that each
> request to my page go to server and not load from the cache. How can
> i add a random number to each requested URL ? Some examples acheiving
> this behaviour will be appreciated...
> 
> Thanks...
> 
> 
> 
>       

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


Re: How to add Random number to URL ?

Posted by FaRHaN <fa...@ymail.com>.
I have used all of the Cache Headers but they didn't work for me. Only 'Refresh' Meta tag works, but all other Tags (Cache-Control, Expires, etc.) not working in IE or FF. I don't know why...
That's why i want to access page from Server rather than stored from the browser.

???




________________________________
From: burnstone <bu...@burnstone.ch>
To: users@wicket.apache.org
Sent: Thursday, August 13, 2009 12:46:50 PM
Subject: Re: How to add Random number to URL ?

FaRHaN wrote:
> Hi,
> I want to add a random number to my requested URL, so that each request to my page go to server and not load from the cache. How can i add a random number to each requested URL ?
> Some examples acheiving this behaviour will be appreciated...

Why don't you just adjust your cache headers?

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


      

Re: How to add Random number to URL ?

Posted by burnstone <bu...@burnstone.ch>.
FaRHaN wrote:
> Hi,
> I want to add a random number to my requested URL, so that each request to my page go to server and not load from the cache. How can i add a random number to each requested URL ?
> Some examples acheiving this behaviour will be appreciated...

Why don't you just adjust your cache headers?

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