Support for Liferay user login in WebScript JSR-168 portlet authenticators.

Fix to add missing downloadUrl property to TemplateContentData object for non-standard content property values.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6137 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-07-03 09:58:09 +00:00
parent e82a21f590
commit 62bfb6356a
2 changed files with 24 additions and 9 deletions

View File

@@ -55,10 +55,11 @@ import org.springframework.util.StringUtils;
*/
public abstract class BaseContentNode implements TemplateContent
{
protected final static String CONTENT_DEFAULT_URL = "/d/d/{0}/{1}/{2}/{3}";
protected final static String CONTENT_GET_URL = "/d/d/{0}/{1}/{2}/{3}";
protected final static String CONTENT_DOWNLOAD_URL = "/d/a/{0}/{1}/{2}/{3}";
protected final static String CONTENT_PROP_URL = "/d/d/{0}/{1}/{2}/{3}?property={4}";
protected final static String FOLDER_BROWSE_URL = "/n/browse/{0}/{1}/{2}";
protected final static String CONTENT_GET_PROP_URL = "/d/d/{0}/{1}/{2}/{3}?property={4}";
protected final static String CONTENT_DOWNLOAD_PROP_URL = "/d/a/{0}/{1}/{2}/{3}?property={4}";
protected final static String FOLDER_BROWSE_URL = "/n/browse/{0}/{1}/{2}";
protected final static String NAMESPACE_BEGIN = "" + QName.NAMESPACE_BEGIN;
@@ -334,7 +335,7 @@ public abstract class BaseContentNode implements TemplateContent
{
try
{
return MessageFormat.format(CONTENT_DEFAULT_URL, new Object[] {
return MessageFormat.format(CONTENT_GET_URL, new Object[] {
getNodeRef().getStoreRef().getProtocol(),
getNodeRef().getStoreRef().getIdentifier(),
getNodeRef().getId(),
@@ -493,14 +494,11 @@ public abstract class BaseContentNode implements TemplateContent
return result;
}
/**
* @return
*/
public String getUrl()
{
try
{
return MessageFormat.format(CONTENT_PROP_URL, new Object[] {
return MessageFormat.format(CONTENT_GET_PROP_URL, new Object[] {
getNodeRef().getStoreRef().getProtocol(),
getNodeRef().getStoreRef().getIdentifier(),
getNodeRef().getId(),
@@ -513,6 +511,23 @@ public abstract class BaseContentNode implements TemplateContent
}
}
public String getDownloadUrl()
{
try
{
return MessageFormat.format(CONTENT_DOWNLOAD_PROP_URL, new Object[] {
getNodeRef().getStoreRef().getProtocol(),
getNodeRef().getStoreRef().getIdentifier(),
getNodeRef().getId(),
StringUtils.replace(URLEncoder.encode(getName(), "UTF-8"), "+", "%20"),
StringUtils.replace(URLEncoder.encode(property.toString(), "UTF-8"), "+", "%20") });
}
catch (UnsupportedEncodingException err)
{
throw new TemplateException("Failed to encode content download URL for node: " + getNodeRef(), err);
}
}
public long getSize()
{
return contentData.getSize();

View File

@@ -277,7 +277,7 @@ public class VersionHistoryNode extends BaseContentNode
NodeRef nodeRef = this.version.getFrozenStateNodeRef();
try
{
return MessageFormat.format(parent.CONTENT_DEFAULT_URL, new Object[] {
return MessageFormat.format(parent.CONTENT_GET_URL, new Object[] {
nodeRef.getStoreRef().getProtocol(),
nodeRef.getStoreRef().getIdentifier(),
nodeRef.getId(),