How to change domain for my assets in tapestry

2019-09-16 16:47发布

问题:

By default; the domain of all assets( js, css) is fixed which is the current domain. In order to improve the speed of website; we want to retrieve all assets using subdomain assets.example.com instead of example.com.

I checked http://tapestry.apache.org/assets.html ; where for "New domains" it is specified as

If you wish to create new domains for assets, for example to allow assets to be stored on the file system or in a database, you may define a new AssetFactory and contribute it to the AssetSource service configuration.

This was not exactly helpful as to exactly what I should do !

Any help is appreciated.

回答1:

You can take a look at the AssetPathConverter. As the documentation states

The default implementation of this is identity, the URI is passed through unchanged. Using a contribution to the ServiceOverride service, you may override the default implementation.

Hope this helps.



标签: tapestry