You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Howard Lewis Ship <hl...@gmail.com> on 2012/02/21 20:07:31 UTC

Re: Versioned assets

Also, reviewing the codes makes 301 (Moved Permanently) look like a
better response than 302 (Found); the later indicates that the
resource is available under a new URI but future requests should
continue to start using the original URI.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Thoughts?

On Tue, Feb 21, 2012 at 11:05 AM, Howard Lewis Ship <hl...@gmail.com> wrote:
> I suspect the 302 redirect may be the correct solution, and Tapestry
> could support this pretty reasonably.
>
> The perfect solution would involve the following:
> - The version number if replaced with the SHA1 hash of the resource's
> (uncompressed) content
> - All CSS is dynamically rewritten to convert relative references into
> full paths including the correct SHA1 hash
>
> I wonder if the 302 redirect could act as a way to avoid rewriting the CSS?
>
> On Sun, Feb 19, 2012 at 7:57 PM, Paul Stanton <pa...@mapshed.com.au> wrote:
>> Hi Cezary,
>>
>> I think I have the same need as you.
>>
>> We use load balanced servers, and when upgrading we upgrade one at a time so
>> that there is always a server running.
>>
>> But the side effect is that the upgraded server can receive requests for the
>> old assets, and we don't want to fail in this case.
>>
>> In the past (5.1) I monkey-patched AssetResourceLocatorImpl to allow <=
>> version number requests.
>>
>> However in migrating to 5.3 I would like a better solution, and the
>> implementation is different now anyway.
>>
>> I like the idea of the 302 redirect.
>>
>> How did you end up solving this? Is it possible to just contribute your own
>> AssetDispatcher instead of just replacing the class?
>>
>> Thanks, Paul.
>>
>>
>> On 24/03/2011 10:09 AM, Cezary Biernacki wrote:
>>>>
>>>>
>>>> Perhaps the AssetDispatcher could check the requested version number and
>>>> if
>>>> it doesn't match the app version, send a 302 redirect to the "correct"
>>>> URL?
>>>> /assets/1.3/ctx/script.js -->  /assets/1.2/ctx/script.js
>>>>
>>>> Or perhaps it should only deliver the asset if the requested version os
>>>> older than or equal to the app version?
>>>> Determining "older" and "newer" would however assume people name their
>>>> application versions in a certain way.
>>>
>>>
>>> It is exactly what I did in my application. I have overridden
>>> AssetsDispatcher service with my copy based on original one, that differs
>>> only in handling missing resources: if resource actually exists but just
>>> version numbers differ, my dispatcher just sends redirect response with a
>>> correct path.
>>>
>>> As a side note, I observed in that - at least in my case - typically a
>>> favicon was a typical asset requested with wrong  version number, probably
>>> from bookmarks.
>>>
>>> Regards,
>>> Cezary
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org