Sounds nice; that's how I've always assumed CDNs worked (lazily) though I'm told other require an explicit load of assets into the CDN, which is tricky in the Tapestry world where many of those assets are dynamically generated (or compiled, or aggregated).
On Thu, Oct 4, 2012 at 11:37 PM, Bård Magnus Kvalheim <mag...@kvalheim.eu> wrote: > Hi Howard - thanks for your reply. > > Looks like an oversight. I'm not familiar with CloudFront; can you >> give me a thumbnail overview of how your CDN hooks work? >> >> Sure. > > Well Cloudfront is at heart a CDN. > It has many features, but how it works is that it delivers content from > edges that are close to end users. > If it don't have the content (or it is expired) it will proxy back to an > 'origin' (there can be several) get the content, store it at the edge and > deliver to user. > > It is a lazy CDN approach that works well as there is no need to first > upload content to a CDN - like S3. > http://aws.amazon.com/cloudfront/ > > > How it works in the tapestry application is that we have configured a > cookieless domain against the CloudFront with the tapestry app as origin. > It all works great - apart from the stack assets where the > AssetPathConverter#convertAssetPath is never called. > > *public class CDNAssetPathConverter implements AssetPathConverter {* > * private IParameter ip;* > * private String applicationVersion;* > * > * > * public CDNAssetPathConverter(@Inject > @Symbol(SymbolConstants.APPLICATION_VERSION) String applicationVersion,* > * @Inject IParameter ip){* > * this.applicationVersion = applicationVersion;* > * this.ip = ip;* > * } * > * String getCDNDomain() {* > * return ip.getString(PKey.DOMAIN_CDN_VERSIONED, null);* > * } * > * @Override* > * public String convertAssetPath(String assetPath) {* > * String domain = getCDNDomain();* > * if(domain==null) return assetPath;* > * * > * String result = convertToCDN(assetPath, domain);* > * return result;* > * }* > * private String convertToCDN(String path, String domain) {* > * String _path = path.replaceFirst("^/+", "");* > * return String.format("http://%s/%s", domain, _path);* > * }* > * @Override* > * public boolean isInvariant() {* > * return false;* > * }* > *} * -- 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: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org