- Fix to some issues created after recent changes to preview url generation code

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3959 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-09-28 09:49:59 +00:00
parent 0f2bf9a3e0
commit 842729f1bc
5 changed files with 32 additions and 23 deletions

View File

@@ -67,8 +67,10 @@ public final class AVMConstants
public static String buildAVMStoreUrl(String store)
{
if (store.indexOf(":") > 0)
store = store.substring(0, store.indexOf(':'));
if (store.indexOf(':') != -1)
{
store = store.substring(0, store.indexOf(':'));
}
ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
return MessageFormat.format(PREVIEW_SANDBOX_URL, lookupStoreDNS(store), config.getWCMDomain(), config.getWCMPort());
}
@@ -76,22 +78,28 @@ public final class AVMConstants
public static String buildAVMAssetUrl(String store, String assetPath)
{
if (assetPath.startsWith('/' + DIR_APPBASE + '/' + DIR_WEBAPPS))
assetPath = assetPath.substring(('/' + DIR_APPBASE + '/' + DIR_WEBAPPS).length());
{
assetPath = assetPath.substring(('/' + DIR_APPBASE + '/' + DIR_WEBAPPS).length());
}
if (assetPath.length() == 0 || assetPath.charAt(0) != '/')
assetPath = '/' + assetPath;
{
assetPath = '/' + assetPath;
}
ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
return MessageFormat.format(PREVIEW_ASSET_URL, lookupStoreDNS(store), config.getWCMDomain(), config.getWCMPort(), assetPath);
}
public static String buildAVMAssetUrl(final String avmPath)
{
final String[] s = avmPath.split(":");
if (s.length != 2)
throw new IllegalArgumentException("expected exactly one ':' in " + avmPath);
return AVMConstants.buildAVMAssetUrl(s[0], s[1]);
final String[] s = avmPath.split(":");
if (s.length != 2)
{
throw new IllegalArgumentException("expected exactly one ':' in " + avmPath);
}
return AVMConstants.buildAVMAssetUrl(s[0], s[1]);
}
public static String lookupStoreDNS(String store)
{
String dns = null;