You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2016/02/22 14:45:19 UTC

[jira] [Updated] (TAP5-2019) AssetPathConverter is not called for javascript stacks

     [ https://issues.apache.org/jira/browse/TAP5-2019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jochen Kemnade updated TAP5-2019:
---------------------------------
    Labels: bulk-close-candidate  (was: AssetPathConverter assets cdn)

This issue affects an old version of Tapestry that is not actively developed anymore, and is therefore prone to be bulk-closed in the near future.

If the issue still persists with the most recent version of Tapestry (currently 5.4.0, available from Maven Central), please update it as soon as possible and add '5.4.0') to the issue's affected versions.

> AssetPathConverter is not called for javascript stacks
> ------------------------------------------------------
>
>                 Key: TAP5-2019
>                 URL: https://issues.apache.org/jira/browse/TAP5-2019
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.4
>            Reporter: Magnus Kvalheim
>              Labels: bulk-close-candidate
>
> (related thread: http://tapestry.1045711.n5.nabble.com/Why-is-AssetPathConverter-not-called-for-javascript-stacks-td5716629.html)
> We use assetpathconverter in order to get assets from CDN(cloudfront).
> However it looks like it's not working for stack assets (but it is for other assets).
> Module:
> binder.bind(AssetPathConverter.class, CDNAssetPathConverter.class).withId("CDNAssetPathConverter");
> public static void contributeServiceOverride(MappedConfiguration<Class,Object> configuration,
> 	@Local AssetPathConverter assetPathConverter) {				
> 	configuration.add(AssetPathConverter.class, assetPathConverter);
> }
> CDNAssetPathConverter:
> 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 thought it might be an oversight



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)