You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Colman <ch...@stepaheadsoftware.com> on 2012/01/16 22:49:12 UTC

Controlling URL of static cacheable resources

I'm trying to make static resources have a distinguishable part of their
URL near the beginning of the URL to enable easy configuration of third
party filters that need to ignore requests for static resources and just
proceed along the filter chain.
 
I've looked up the operation of
org.apache.wicket.request.resource.caching.IResourceCachingStrategy#deco
rateUrl but it appears that it only has the ability to make changes near
the end of the resource URL after all the major segments of the URL have
already been set ie., after this part
 
/wicket/resource/org.apache.wicket.... rest of pathname.ClassName
 
What I am trying to do is get all static resources to end up with a
distinguishable URL that starts off something like:
 
/wicket/resource/static/pathname.ClassName
 
so I can configure a filter to ignore /wicket/resource/static/*
 
In BasicResourceReferenceHandler.mapHandler() perhaps after adding the
resource identifier segment:
 
segments.add(getContext().getResourceIdentifier());
 
it could append an extra segment for static resources:
 
final IResource resource = reference.getResource();
 
// if static resource
if (resource instanceof IStaticCacheableResource)
{
segments.add("static");
}
 
And so end up with /wicket/resource/static/org.apache.wicket ...
 
 
 
I also observed that Wicketstuff resources don't use the /wicket
namespace prefix. They just start out at 
 
/resources/org.name.project.MyClass.script.js
 
So they'd need a separate ignore entry in the filter.
 
 
Yours sincerely,
 
Chris Colman
 
Pagebloom Team Leader,
Step Ahead Software

 
pagebloom - your business & your website growing together
 
Sydney: (+61 2) 9656 1278     Canberra: (+61 2) 6100 2120     
Email: chrisc@stepahead.com.au <ma...@stepahead.com.au> 
Website:
http://www.pagebloom.com <blocked::http://www.pagebloom.com/> 
http://develop.stepaheadsoftware.com
<blocked::http://develop.stepaheadsoftware.com/> 
 
 

Re: Controlling URL of static cacheable resources

Posted by Martin Grigorov <mg...@apache.org>.
And I'm not sure why you think String#startsWith is faster than
String#endsWith. They do the same ...

With the IResourceCachingStrategy you can append ".static" to all
resources you want and later use that to check in your filter.

On Wed, Jan 18, 2012 at 11:34 PM, Peter Ertl <pe...@gmx.org> wrote:
> I you are really pedantic you put a a caching front-end proxy before your actual application server.
>
> By default wicket package resources (css/js/images) are delivered with a cache expiry of one year. By using fingerprinted filenames (through IResourceCachingStrategy) this will work flawlessly when resources are outdated. This is the default behavior and will also work in a cluster.
>
> Your front end proxy should be setup to cache these resources (I personally recommend nginx). Your java app server will not even be hit when requesting resources like .css and .js once they got loaded into the cache. Servers like nginx are by far more efficient in serving these kind of resources than any java app server.
>
> Unless you want to host facebook.com this setup should be more than sufficient.
>
> No need to twiddle around with filenames and 'static/'
>
> Cheers
> Peter
>
> Am 17.01.2012 um 14:52 schrieb Chris Colman:
>
>> Maybe I am getting pedantic as I was thinking in terms of speed of
>> operation for a server that's getting hammered with thousands of hits
>> per hour.
>>
>> It's quicker to test the first few chars of a URL string for a match
>> with 'startsWith' than it is to iterate through to almost the end of
>> each URL string to see if it 'contains' a substring. Any URL will fail
>> to match on comparison of the first character if they don't have a 'w'
>> at the beginning which makes startsWith a 'fast fail' test for most URLs
>> it processes.
>>
>> I think that's probably why the Servlet Spec chooses to do filter and
>> servlet path matching via a 'starts with' strategy without support for
>> wildcards except at the very end of a pattern.
>>
>> Many of the URLs requested are very long and I try to avoid string
>> parsing of lots of thousands of long strings wherever I can - there's
>> already enough of that going on without adding to the work load.
>>
>>> -----Original Message-----
>>> From: Martin Grigorov [mailto:mgrigorov@apache.org]
>>> Sent: Tuesday, 17 January 2012 7:08 PM
>>> To: users@wicket.apache.org
>>> Subject: Re: Controlling URL of static cacheable resources
>>>
>>> Hi Chris,
>>>
>>> With IResourceCachingStrategy you can pre/suf-fix the resource name
>> with
>>> "my.namespace.static", for example.
>>> This way your filter will be able to recognize it. It is the same as
>> adding
>>> the /static/ segment. Just at different place.
>>>
>>> On Mon, Jan 16, 2012 at 10:49 PM, Chris Colman
>>> <chrisc@stepaheadsoftware.com
>>>> wrote:
>>>
>>>> ** **
>>>>
>>>> I'm trying to make static resources have a distinguishable part of
>> their
>>>> URL near the beginning of the URL to enable easy configuration of
>> third
>>>> party filters that need to ignore requests for static resources and
>> just
>>>> proceed along the filter chain.****
>>>>
>>>> ** **
>>>>
>>>> I've looked up the operation of
>>>>
>>> org.apache.wicket.request.resource.caching.IResourceCachingStrategy#dec
>> orat
>>> eUrl
>>>> but it appears that it only has the ability to make changes near the
>> end
>>> of
>>>> the resource URL after all the major segments of the URL have already
>>> been
>>>> set ie., after this part****
>>>>
>>>> ** **
>>>>
>>>> /wicket/resource/org.apache.wicket.... rest of pathname.ClassName****
>>>>
>>>> ** **
>>>>
>>>> What I am trying to do is get all static resources to end up with a
>>>> distinguishable URL that starts off something like:****
>>>>
>>>> ** **
>>>>
>>>> /wicket/resource/static/pathname.ClassName****
>>>>
>>>> ** **
>>>>
>>>> so I can configure a filter to ignore /wicket/resource/static/*****
>>>>
>>>> ** **
>>>>
>>>> In BasicResourceReferenceHandler.mapHandler() perhaps after adding
>> the
>>>> resource identifier segment:****
>>>>
>>>> ** **
>>>>
>>>> segments.add(getContext().getResourceIdentifier());****
>>>>
>>>> ** **
>>>>
>>>> it could append an extra segment for static resources:****
>>>>
>>>> ** **
>>>>
>>>> final IResource resource = reference.getResource();****
>>>>
>>>> ** **
>>>>
>>>> // if static resource****
>>>>
>>>> if (resource instanceof IStaticCacheableResource)****
>>>>
>>>> {****
>>>>
>>>> segments.add("static");****
>>>>
>>>> }****
>>>>
>>>> ** **
>>>>
>>>> And so end up with /wicket/resource/static/org.apache.wicket ...****
>>>>
>>>> ** **
>>>>
>>>> ** **
>>>>
>>>> ** **
>>>>
>>>> I also observed that Wicketstuff resources don't use the /wicket
>>>> namespace prefix. They just start out at ****
>>>>
>>>> ** **
>>>>
>>>> /resources/org.name.project.MyClass.script.js****
>>>>
>>>> ** **
>>>>
>>>> So they'd need a separate ignore entry in the filter.****
>>>>
>>>> ** **
>>>>
>>>> ** **
>>>>
>>>> Yours sincerely,****
>>>>
>>>> ** **
>>>>
>>>> Chris Colman****
>>>>
>>>> ****
>>>>
>>>> Pagebloom Team Leader,****
>>>>
>>>> Step Ahead Software
>>>>
>>>> ****
>>>>
>>>> pagebloom - your business & your website growing together****
>>>>
>>>> ** **
>>>>
>>>> **Sydney**: (+61 2) 9656 1278     ****Canberra****: (+61 2) 6100 2120
>>>> ****
>>>>
>>>> Email: chrisc@stepahead.com.au <//...@stepahead.com.au>****
>>>>
>>>> Website:****
>>>>
>>>> http://www.pagebloom.com****
>>>>
>>>> http://develop.stepaheadsoftware.com****
>>>>
>>>> ****
>>>>
>>>> ** **
>>>>
>>>
>>>
>>>
>>> --
>>> Martin Grigorov
>>> jWeekend
>>> Training, Consulting, Development
>>> http://jWeekend.com <http://jweekend.com/>
>>
>> ---------------------------------------------------------------------
>> 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
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Controlling URL of static cacheable resources

Posted by Peter Ertl <pe...@gmx.org>.
I you are really pedantic you put a a caching front-end proxy before your actual application server.

By default wicket package resources (css/js/images) are delivered with a cache expiry of one year. By using fingerprinted filenames (through IResourceCachingStrategy) this will work flawlessly when resources are outdated. This is the default behavior and will also work in a cluster.

Your front end proxy should be setup to cache these resources (I personally recommend nginx). Your java app server will not even be hit when requesting resources like .css and .js once they got loaded into the cache. Servers like nginx are by far more efficient in serving these kind of resources than any java app server.

Unless you want to host facebook.com this setup should be more than sufficient.

No need to twiddle around with filenames and 'static/'

Cheers 
Peter

Am 17.01.2012 um 14:52 schrieb Chris Colman:

> Maybe I am getting pedantic as I was thinking in terms of speed of
> operation for a server that's getting hammered with thousands of hits
> per hour.
> 
> It's quicker to test the first few chars of a URL string for a match
> with 'startsWith' than it is to iterate through to almost the end of
> each URL string to see if it 'contains' a substring. Any URL will fail
> to match on comparison of the first character if they don't have a 'w'
> at the beginning which makes startsWith a 'fast fail' test for most URLs
> it processes.
> 
> I think that's probably why the Servlet Spec chooses to do filter and
> servlet path matching via a 'starts with' strategy without support for
> wildcards except at the very end of a pattern.
> 
> Many of the URLs requested are very long and I try to avoid string
> parsing of lots of thousands of long strings wherever I can - there's
> already enough of that going on without adding to the work load.
> 
>> -----Original Message-----
>> From: Martin Grigorov [mailto:mgrigorov@apache.org]
>> Sent: Tuesday, 17 January 2012 7:08 PM
>> To: users@wicket.apache.org
>> Subject: Re: Controlling URL of static cacheable resources
>> 
>> Hi Chris,
>> 
>> With IResourceCachingStrategy you can pre/suf-fix the resource name
> with
>> "my.namespace.static", for example.
>> This way your filter will be able to recognize it. It is the same as
> adding
>> the /static/ segment. Just at different place.
>> 
>> On Mon, Jan 16, 2012 at 10:49 PM, Chris Colman
>> <chrisc@stepaheadsoftware.com
>>> wrote:
>> 
>>> ** **
>>> 
>>> I'm trying to make static resources have a distinguishable part of
> their
>>> URL near the beginning of the URL to enable easy configuration of
> third
>>> party filters that need to ignore requests for static resources and
> just
>>> proceed along the filter chain.****
>>> 
>>> ** **
>>> 
>>> I've looked up the operation of
>>> 
>> org.apache.wicket.request.resource.caching.IResourceCachingStrategy#dec
> orat
>> eUrl
>>> but it appears that it only has the ability to make changes near the
> end
>> of
>>> the resource URL after all the major segments of the URL have already
>> been
>>> set ie., after this part****
>>> 
>>> ** **
>>> 
>>> /wicket/resource/org.apache.wicket.... rest of pathname.ClassName****
>>> 
>>> ** **
>>> 
>>> What I am trying to do is get all static resources to end up with a
>>> distinguishable URL that starts off something like:****
>>> 
>>> ** **
>>> 
>>> /wicket/resource/static/pathname.ClassName****
>>> 
>>> ** **
>>> 
>>> so I can configure a filter to ignore /wicket/resource/static/*****
>>> 
>>> ** **
>>> 
>>> In BasicResourceReferenceHandler.mapHandler() perhaps after adding
> the
>>> resource identifier segment:****
>>> 
>>> ** **
>>> 
>>> segments.add(getContext().getResourceIdentifier());****
>>> 
>>> ** **
>>> 
>>> it could append an extra segment for static resources:****
>>> 
>>> ** **
>>> 
>>> final IResource resource = reference.getResource();****
>>> 
>>> ** **
>>> 
>>> // if static resource****
>>> 
>>> if (resource instanceof IStaticCacheableResource)****
>>> 
>>> {****
>>> 
>>> segments.add("static");****
>>> 
>>> }****
>>> 
>>> ** **
>>> 
>>> And so end up with /wicket/resource/static/org.apache.wicket ...****
>>> 
>>> ** **
>>> 
>>> ** **
>>> 
>>> ** **
>>> 
>>> I also observed that Wicketstuff resources don't use the /wicket
>>> namespace prefix. They just start out at ****
>>> 
>>> ** **
>>> 
>>> /resources/org.name.project.MyClass.script.js****
>>> 
>>> ** **
>>> 
>>> So they'd need a separate ignore entry in the filter.****
>>> 
>>> ** **
>>> 
>>> ** **
>>> 
>>> Yours sincerely,****
>>> 
>>> ** **
>>> 
>>> Chris Colman****
>>> 
>>> ****
>>> 
>>> Pagebloom Team Leader,****
>>> 
>>> Step Ahead Software
>>> 
>>> ****
>>> 
>>> pagebloom - your business & your website growing together****
>>> 
>>> ** **
>>> 
>>> **Sydney**: (+61 2) 9656 1278     ****Canberra****: (+61 2) 6100 2120
>>> ****
>>> 
>>> Email: chrisc@stepahead.com.au <//...@stepahead.com.au>****
>>> 
>>> Website:****
>>> 
>>> http://www.pagebloom.com****
>>> 
>>> http://develop.stepaheadsoftware.com****
>>> 
>>> ****
>>> 
>>> ** **
>>> 
>> 
>> 
>> 
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com <http://jweekend.com/>
> 
> ---------------------------------------------------------------------
> 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: Controlling URL of static cacheable resources

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
Maybe I am getting pedantic as I was thinking in terms of speed of
operation for a server that's getting hammered with thousands of hits
per hour.

It's quicker to test the first few chars of a URL string for a match
with 'startsWith' than it is to iterate through to almost the end of
each URL string to see if it 'contains' a substring. Any URL will fail
to match on comparison of the first character if they don't have a 'w'
at the beginning which makes startsWith a 'fast fail' test for most URLs
it processes.

I think that's probably why the Servlet Spec chooses to do filter and
servlet path matching via a 'starts with' strategy without support for
wildcards except at the very end of a pattern.

Many of the URLs requested are very long and I try to avoid string
parsing of lots of thousands of long strings wherever I can - there's
already enough of that going on without adding to the work load.

>-----Original Message-----
>From: Martin Grigorov [mailto:mgrigorov@apache.org]
>Sent: Tuesday, 17 January 2012 7:08 PM
>To: users@wicket.apache.org
>Subject: Re: Controlling URL of static cacheable resources
>
>Hi Chris,
>
>With IResourceCachingStrategy you can pre/suf-fix the resource name
with
>"my.namespace.static", for example.
>This way your filter will be able to recognize it. It is the same as
adding
>the /static/ segment. Just at different place.
>
>On Mon, Jan 16, 2012 at 10:49 PM, Chris Colman
><chrisc@stepaheadsoftware.com
>> wrote:
>
>> ** **
>>
>> I'm trying to make static resources have a distinguishable part of
their
>> URL near the beginning of the URL to enable easy configuration of
third
>> party filters that need to ignore requests for static resources and
just
>> proceed along the filter chain.****
>>
>> ** **
>>
>> I've looked up the operation of
>>
>org.apache.wicket.request.resource.caching.IResourceCachingStrategy#dec
orat
>eUrl
>> but it appears that it only has the ability to make changes near the
end
>of
>> the resource URL after all the major segments of the URL have already
>been
>> set ie., after this part****
>>
>> ** **
>>
>> /wicket/resource/org.apache.wicket.... rest of pathname.ClassName****
>>
>> ** **
>>
>> What I am trying to do is get all static resources to end up with a
>> distinguishable URL that starts off something like:****
>>
>> ** **
>>
>> /wicket/resource/static/pathname.ClassName****
>>
>> ** **
>>
>> so I can configure a filter to ignore /wicket/resource/static/*****
>>
>> ** **
>>
>> In BasicResourceReferenceHandler.mapHandler() perhaps after adding
the
>> resource identifier segment:****
>>
>> ** **
>>
>> segments.add(getContext().getResourceIdentifier());****
>>
>> ** **
>>
>> it could append an extra segment for static resources:****
>>
>> ** **
>>
>> final IResource resource = reference.getResource();****
>>
>> ** **
>>
>> // if static resource****
>>
>> if (resource instanceof IStaticCacheableResource)****
>>
>> {****
>>
>> segments.add("static");****
>>
>> }****
>>
>> ** **
>>
>> And so end up with /wicket/resource/static/org.apache.wicket ...****
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>> I also observed that Wicketstuff resources don't use the /wicket
>> namespace prefix. They just start out at ****
>>
>> ** **
>>
>> /resources/org.name.project.MyClass.script.js****
>>
>> ** **
>>
>> So they'd need a separate ignore entry in the filter.****
>>
>> ** **
>>
>> ** **
>>
>> Yours sincerely,****
>>
>> ** **
>>
>> Chris Colman****
>>
>>  ****
>>
>> Pagebloom Team Leader,****
>>
>> Step Ahead Software
>>
>> ****
>>
>> pagebloom - your business & your website growing together****
>>
>> ** **
>>
>> **Sydney**: (+61 2) 9656 1278     ****Canberra****: (+61 2) 6100 2120
>> ****
>>
>> Email: chrisc@stepahead.com.au <//...@stepahead.com.au>****
>>
>> Website:****
>>
>> http://www.pagebloom.com****
>>
>> http://develop.stepaheadsoftware.com****
>>
>>  ****
>>
>> ** **
>>
>
>
>
>--
>Martin Grigorov
>jWeekend
>Training, Consulting, Development
>http://jWeekend.com <http://jweekend.com/>

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


Re: Controlling URL of static cacheable resources

Posted by Martin Grigorov <mg...@apache.org>.
Hi Chris,

With IResourceCachingStrategy you can pre/suf-fix the resource name with
"my.namespace.static", for example.
This way your filter will be able to recognize it. It is the same as adding
the /static/ segment. Just at different place.

On Mon, Jan 16, 2012 at 10:49 PM, Chris Colman <chrisc@stepaheadsoftware.com
> wrote:

> ** **
>
> I’m trying to make static resources have a distinguishable part of their
> URL near the beginning of the URL to enable easy configuration of third
> party filters that need to ignore requests for static resources and just
> proceed along the filter chain.****
>
> ** **
>
> I’ve looked up the operation of
> org.apache.wicket.request.resource.caching.IResourceCachingStrategy#decorateUrl
> but it appears that it only has the ability to make changes near the end of
> the resource URL after all the major segments of the URL have already been
> set ie., after this part****
>
> ** **
>
> /wicket/resource/org.apache.wicket…. rest of pathname.ClassName****
>
> ** **
>
> What I am trying to do is get all static resources to end up with a
> distinguishable URL that starts off something like:****
>
> ** **
>
> /wicket/resource/static/pathname.ClassName****
>
> ** **
>
> so I can configure a filter to ignore /wicket/resource/static/*****
>
> ** **
>
> In BasicResourceReferenceHandler.mapHandler() perhaps after adding the
> resource identifier segment:****
>
> ** **
>
> segments.add(getContext().getResourceIdentifier());****
>
> ** **
>
> it could append an extra segment for static resources:****
>
> ** **
>
> final IResource resource = reference.getResource();****
>
> ** **
>
> // if static resource****
>
> if (resource instanceof IStaticCacheableResource)****
>
> {****
>
> segments.add(“static”);****
>
> }****
>
> ** **
>
> And so end up with /wicket/resource/static/org.apache.wicket …****
>
> ** **
>
> ** **
>
> ** **
>
> I also observed that Wicketstuff resources don’t use the /wicket
> namespace prefix. They just start out at ****
>
> ** **
>
> /resources/org.name.project.MyClass.script.js****
>
> ** **
>
> So they’d need a separate ignore entry in the filter.****
>
> ** **
>
> ** **
>
> Yours sincerely,****
>
> ** **
>
> Chris Colman****
>
>  ****
>
> Pagebloom Team Leader,****
>
> Step Ahead Software
>
> ****
>
> pagebloom - your business & your website growing together****
>
> ** **
>
> **Sydney**: (+61 2) 9656 1278     ****Canberra****: (+61 2) 6100 2120
> ****
>
> Email: chrisc@stepahead.com.au <//...@stepahead.com.au>****
>
> Website:****
>
> http://www.pagebloom.com****
>
> http://develop.stepaheadsoftware.com****
>
>  ****
>
> ** **
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

RE: Controlling URL of static cacheable resources

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
><ch...@stepaheadsoftware.com> wrote:
>> Forget that last bit about wicketstuff not using the 'wicket' namespace
>> for its resources. I was confused by some old files in the browser cache
>> from Dec 2011.
>
>/resources/ in 1.4 is the same as /wicket/resource/ in 1.5
>Which project exactly in wicketstuff do you mean ?

We were still using 1.4 back in December so that makes sense. Sorry for the confusion.

>
>>
>> ________________________________
>>
>> From: Chris Colman [mailto:chrisc@stepaheadsoftware.com]
>> Sent: Tuesday, 17 January 2012 8:49 AM
>> To: users@wicket.apache.org
>> Subject: Controlling URL of static cacheable resources
>>
>> I'm trying to make static resources have a distinguishable part of their
>> URL near the beginning of the URL to enable easy configuration of third
>> party filters that need to ignore requests for static resources and just
>> proceed along the filter chain.
>>
>> I've looked up the operation of
>> org.apache.wicket.request.resource.caching.IResourceCachingStrategy#deco
>> rateUrl but it appears that it only has the ability to make changes near
>> the end of the resource URL after all the major segments of the URL have
>> already been set ie., after this part
>>
>> /wicket/resource/org.apache.wicket.... rest of pathname.ClassName
>>
>> What I am trying to do is get all static resources to end up with a
>> distinguishable URL that starts off something like:
>>
>> /wicket/resource/static/pathname.ClassName
>>
>> so I can configure a filter to ignore /wicket/resource/static/*
>>
>> In BasicResourceReferenceHandler.mapHandler() perhaps after adding the
>> resource identifier segment:
>>
>> segments.add(getContext().getResourceIdentifier());
>>
>> it could append an extra segment for static resources:
>>
>> final IResource resource = reference.getResource();
>>
>> // if static resource
>> if (resource instanceof IStaticCacheableResource)
>> {
>> segments.add("static");
>> }
>>
>> And so end up with /wicket/resource/static/org.apache.wicket ...
>>
>>
>>
>> I also observed that Wicketstuff resources don't use the /wicket
>> namespace prefix. They just start out at
>>
>> /resources/org.name.project.MyClass.script.js
>>
>> So they'd need a separate ignore entry in the filter.
>>
>>
>> Yours sincerely,
>>
>> Chris Colman
>>
>> Pagebloom Team Leader,
>> Step Ahead Software
>>
>>
>> pagebloom - your business & your website growing together
>>
>> Sydney:           (+61 2) 9656 1278     Canberra: (+61 2) 6100 2120
>> Email: chrisc@stepahead.com.au <ma...@stepahead.com.au>
>> Website:
>> http://www.pagebloom.com <blocked::http://www.pagebloom.com/>
>> http://develop.stepaheadsoftware.com
>> <blocked::http://develop.stepaheadsoftware.com/>
>>
>>
>
>
>
>--
>Martin Grigorov
>jWeekend
>Training, Consulting, Development
>http://jWeekend.com
>
>---------------------------------------------------------------------
>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: Controlling URL of static cacheable resources

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Jan 16, 2012 at 11:08 PM, Chris Colman
<ch...@stepaheadsoftware.com> wrote:
> Forget that last bit about wicketstuff not using the 'wicket' namespace
> for its resources. I was confused by some old files in the browser cache
> from Dec 2011.

/resources/ in 1.4 is the same as /wicket/resource/ in 1.5
Which project exactly in wicketstuff do you mean ?

>
> ________________________________
>
> From: Chris Colman [mailto:chrisc@stepaheadsoftware.com]
> Sent: Tuesday, 17 January 2012 8:49 AM
> To: users@wicket.apache.org
> Subject: Controlling URL of static cacheable resources
>
> I'm trying to make static resources have a distinguishable part of their
> URL near the beginning of the URL to enable easy configuration of third
> party filters that need to ignore requests for static resources and just
> proceed along the filter chain.
>
> I've looked up the operation of
> org.apache.wicket.request.resource.caching.IResourceCachingStrategy#deco
> rateUrl but it appears that it only has the ability to make changes near
> the end of the resource URL after all the major segments of the URL have
> already been set ie., after this part
>
> /wicket/resource/org.apache.wicket.... rest of pathname.ClassName
>
> What I am trying to do is get all static resources to end up with a
> distinguishable URL that starts off something like:
>
> /wicket/resource/static/pathname.ClassName
>
> so I can configure a filter to ignore /wicket/resource/static/*
>
> In BasicResourceReferenceHandler.mapHandler() perhaps after adding the
> resource identifier segment:
>
> segments.add(getContext().getResourceIdentifier());
>
> it could append an extra segment for static resources:
>
> final IResource resource = reference.getResource();
>
> // if static resource
> if (resource instanceof IStaticCacheableResource)
> {
> segments.add("static");
> }
>
> And so end up with /wicket/resource/static/org.apache.wicket ...
>
>
>
> I also observed that Wicketstuff resources don't use the /wicket
> namespace prefix. They just start out at
>
> /resources/org.name.project.MyClass.script.js
>
> So they'd need a separate ignore entry in the filter.
>
>
> Yours sincerely,
>
> Chris Colman
>
> Pagebloom Team Leader,
> Step Ahead Software
>
>
> pagebloom - your business & your website growing together
>
> Sydney:           (+61 2) 9656 1278     Canberra: (+61 2) 6100 2120
> Email: chrisc@stepahead.com.au <ma...@stepahead.com.au>
> Website:
> http://www.pagebloom.com <blocked::http://www.pagebloom.com/>
> http://develop.stepaheadsoftware.com
> <blocked::http://develop.stepaheadsoftware.com/>
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


RE: Controlling URL of static cacheable resources

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
Forget that last bit about wicketstuff not using the 'wicket' namespace
for its resources. I was confused by some old files in the browser cache
from Dec 2011.
 
________________________________

From: Chris Colman [mailto:chrisc@stepaheadsoftware.com] 
Sent: Tuesday, 17 January 2012 8:49 AM
To: users@wicket.apache.org
Subject: Controlling URL of static cacheable resources
 
I'm trying to make static resources have a distinguishable part of their
URL near the beginning of the URL to enable easy configuration of third
party filters that need to ignore requests for static resources and just
proceed along the filter chain.
 
I've looked up the operation of
org.apache.wicket.request.resource.caching.IResourceCachingStrategy#deco
rateUrl but it appears that it only has the ability to make changes near
the end of the resource URL after all the major segments of the URL have
already been set ie., after this part
 
/wicket/resource/org.apache.wicket.... rest of pathname.ClassName
 
What I am trying to do is get all static resources to end up with a
distinguishable URL that starts off something like:
 
/wicket/resource/static/pathname.ClassName
 
so I can configure a filter to ignore /wicket/resource/static/*
 
In BasicResourceReferenceHandler.mapHandler() perhaps after adding the
resource identifier segment:
 
segments.add(getContext().getResourceIdentifier());
 
it could append an extra segment for static resources:
 
final IResource resource = reference.getResource();
 
// if static resource
if (resource instanceof IStaticCacheableResource)
{
segments.add("static");
}
 
And so end up with /wicket/resource/static/org.apache.wicket ...
 
 
 
I also observed that Wicketstuff resources don't use the /wicket
namespace prefix. They just start out at 
 
/resources/org.name.project.MyClass.script.js
 
So they'd need a separate ignore entry in the filter.
 
 
Yours sincerely,
 
Chris Colman
 
Pagebloom Team Leader,
Step Ahead Software


pagebloom - your business & your website growing together
 
Sydney:           (+61 2) 9656 1278     Canberra: (+61 2) 6100 2120     
Email: chrisc@stepahead.com.au <ma...@stepahead.com.au> 
Website:
http://www.pagebloom.com <blocked::http://www.pagebloom.com/> 
http://develop.stepaheadsoftware.com
<blocked::http://develop.stepaheadsoftware.com/>