tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lewis Ship <hls...@gmail.com>
Subject Re: META-INF/assets/ in 5.4
Date Tue, 24 Jul 2012 15:01:32 GMT
On Tue, Jul 24, 2012 at 3:38 AM, Denis Stepanov
<denis.stepanov@gmail.com> wrote:
> I don't think 'META-INF' is the right location for all assets, its supposed to store
internal Java meta information or configuration files, web resources do not belong there.
We can just use '/assets', I would also support {lib-path}/assets (org.apache.tapestry5.corelib.assets
for core lib).
>

The advantage of META-INF/ as a prefix is that it guarantees that
there won't be a conflict with any existing Java package. I'm open to
suggestions; maybe T5-RESOURCES/assets/ (and /modules/).

> Denis
>
> Jul 23, 2012 v 8:06 PM, Howard Lewis Ship:
>
>> On Mon, Jul 23, 2012 at 7:37 AM, Thiago H de Paula Figueiredo
>> <thiagohp@gmail.com> wrote:
>>> Just for backward compatibility, what about adding a symbol defaulting to
>>> false that allows assets to be loaded from outside /META-INF/assets?
>>
>> You mean, in 5.5 and beyond?
>>
>> In 5.4, you have compatibility with 5.3, you just get an error in the console.
>>
>>>
>>>
>>> On Sun, 22 Jul 2012 15:43:47 -0300, Howard Lewis Ship <hlship@gmail.com>
>>> wrote:
>>>
>>>> Just a note on where I'm heading with the 5.4 code.
>>>>
>>>> In Tapestry 5.3 and earlier, classpath assets were allowed to be
>>>> anywhere on the classpath, as long as the assets where somewhere under
>>>> a library root package. Tapestry would build an asset URL that
>>>> incorporated the library name and the relative path from that root to
>>>> the asset.  So, move_up.png in org.apache.tapestry5.corelib.components
>>>> would be combined with the library name "core" ->
>>>> "org.apache.tapestry5.corelib" to create as asset URL of
>>>> /assets/123bc/core/components/move_up.png
>>>>
>>>> Of course, this has its problems including how to handle libraries
>>>> that have multiple root packages (Tapestry builds a path relative to
>>>> the deepest common folder) and, more importantly, how to keep users
>>>> from downloading things that were not intended to be downloaded,
>>>> including Java .class files and Tapestry templates and properties
>>>> files.  You end up with some extra cruft, such as attaching an md5
>>>> checksum to certain assets to "prove" that the application intended to
>>>> expose it to the client. It still makes people unhappy, as parts of
>>>> the /assets/ namespace is browsable (via the web browser); further
>>>> protection on files requires opt in (you must declare which extensions
>>>> need extra protection).  All in all, less than satisfactory.
>>>>
>>>> I believe Thiago pointed out, maybe a year back, that it would have
>>>> been better to isolate assets from other things on the classpath. I
>>>> agree, and in 5.4 I'm starting a transition that way. The current
>>>> approach will continue to be supported until at least 5.5, with
>>>> runtime warnings.
>>>>
>>>> The new approach is that assets go in /META-INF/assets/<library name>
>>>> (or just /META-INF/assets/ for application classpath assets). Relative
>>>> URLs are now relative to that folder, not relative to the component
>>>> class. Again, outside of some warnings, all existing assets work
>>>> correctly using 5.3 rules.
>>>>
>>>> The warnings I mention above include where to move the file so that it
>>>> will be picked up correctly:
>>>>
>>>> [ERROR] AssetSource Packaging of classpath assets has changed in
>>>> release 5.4; Assets should no longer be on the main classpath, but
>>>> should be moved to 'META-INF/assets/' or a sub-folder. Future releases
>>>> of Tapestry may no longer support assets on the main classpath.
>>>> [ERROR] AssetSource Classpath asset
>>>> '/org/apache/tapestry5/corelib/components/sort-asc.png' should be
>>>> moved under folder '/META-INF/assets/core/', and the relative path
>>>> adjusted.
>>>> [ERROR] AssetSource Classpath asset
>>>> '/org/apache/tapestry5/corelib/components/sort-desc.png' should be
>>>> moved under folder '/META-INF/assets/core/', and the relative path
>>>> adjusted.
>>>> [ERROR] AssetSource Classpath asset
>>>> '/org/apache/tapestry5/corelib/components/sortable.png' should be
>>>> moved under folder '/META-INF/assets/core/', and the relative path
>>>> adjusted.
>>>>
>>>> The location of resources (component templates and message catalogs)
>>>> is not changed.
>>>>
>>>> One of my secondary goals will be to have a way of generating a kind
>>>> of manifest of all assets (classpath or context, static or virtual)
>>>> that can be used to pre-load assets into a CDN.
>>>>
>>>
>>>
>>> --
>>> Thiago H. de Paula Figueiredo
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: dev-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
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: dev-help@tapestry.apache.org
>>
>
> Denis
>
>
>



-- 
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


Mime
View raw message