mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -55,10 +55,11 @@ import org.springframework.util.StringUtils;
|
|||||||
*/
|
*/
|
||||||
public abstract class BaseContentNode implements TemplateContent
|
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_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 CONTENT_GET_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_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;
|
protected final static String NAMESPACE_BEGIN = "" + QName.NAMESPACE_BEGIN;
|
||||||
|
|
||||||
@@ -334,7 +335,7 @@ public abstract class BaseContentNode implements TemplateContent
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return MessageFormat.format(CONTENT_DEFAULT_URL, new Object[] {
|
return MessageFormat.format(CONTENT_GET_URL, new Object[] {
|
||||||
getNodeRef().getStoreRef().getProtocol(),
|
getNodeRef().getStoreRef().getProtocol(),
|
||||||
getNodeRef().getStoreRef().getIdentifier(),
|
getNodeRef().getStoreRef().getIdentifier(),
|
||||||
getNodeRef().getId(),
|
getNodeRef().getId(),
|
||||||
@@ -493,14 +494,11 @@ public abstract class BaseContentNode implements TemplateContent
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getUrl()
|
public String getUrl()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return MessageFormat.format(CONTENT_PROP_URL, new Object[] {
|
return MessageFormat.format(CONTENT_GET_PROP_URL, new Object[] {
|
||||||
getNodeRef().getStoreRef().getProtocol(),
|
getNodeRef().getStoreRef().getProtocol(),
|
||||||
getNodeRef().getStoreRef().getIdentifier(),
|
getNodeRef().getStoreRef().getIdentifier(),
|
||||||
getNodeRef().getId(),
|
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()
|
public long getSize()
|
||||||
{
|
{
|
||||||
return contentData.getSize();
|
return contentData.getSize();
|
||||||
|
@@ -277,7 +277,7 @@ public class VersionHistoryNode extends BaseContentNode
|
|||||||
NodeRef nodeRef = this.version.getFrozenStateNodeRef();
|
NodeRef nodeRef = this.version.getFrozenStateNodeRef();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return MessageFormat.format(parent.CONTENT_DEFAULT_URL, new Object[] {
|
return MessageFormat.format(parent.CONTENT_GET_URL, new Object[] {
|
||||||
nodeRef.getStoreRef().getProtocol(),
|
nodeRef.getStoreRef().getProtocol(),
|
||||||
nodeRef.getStoreRef().getIdentifier(),
|
nodeRef.getStoreRef().getIdentifier(),
|
||||||
nodeRef.getId(),
|
nodeRef.getId(),
|
||||||
|
Reference in New Issue
Block a user