Merged V3.1 to HEAD

14077: Merged V2.2 to V3.1
        14074: Fix ETWOTWO-929 and ETWOTWO-1175 (WCM preview)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14568 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2009-06-05 17:12:00 +00:00
parent 9c1d8b616d
commit 50827e1bbb
11 changed files with 49 additions and 54 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -299,20 +299,9 @@ public final class AVMUtil extends WCMUtil
: buildStoreUrl(store) + '/' + webapp);
}
public static String buildAssetUrl(final String avmPath)
{
if (avmPath == null || avmPath.length() == 0)
{
throw new IllegalArgumentException("AVM path is mandatory.");
}
final String[] s = avmPath.split(":");
if (s.length != 2)
{
throw new IllegalArgumentException("expected exactly one ':' in " + avmPath);
}
return AVMUtil.buildAssetUrl(s[0], s[1]);
}
/**
* NOTE: do not call directly from client - use getPreviewURI instead
*/
public static String buildAssetUrl(String store, String assetPath)
{
if (store == null || store.length() == 0)
@@ -332,6 +321,24 @@ public final class AVMUtil extends WCMUtil
return WCMUtil.buildAssetUrl(assetPath, domain, port, dns);
}
public static String getPreviewURI(String storeNameOrAvmPath)
{
if (storeNameOrAvmPath == null || storeNameOrAvmPath.length() == 0)
{
throw new IllegalArgumentException("AVM store name or absolute path is mandatory.");
}
final String[] s = storeNameOrAvmPath.split(AVM_STORE_SEPARATOR);
if (s.length == 1)
{
return AVMUtil.getPreviewURI(s[0], null);
}
if (s.length != 2)
{
throw new IllegalArgumentException("expected exactly one ':' in " + storeNameOrAvmPath);
}
return AVMUtil.getPreviewURI(s[0], s[1]);
}
public static String getPreviewURI(final String storeId, final String assetPath)
{
if (previewURIGenerator == null)