mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged CMIS063 to HEAD
17100: Chemistry: AtomPub TCK updates, Alfresco CMIS URL bindings, Delete Content Stream git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17258 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -26,26 +26,29 @@ package org.alfresco.repo.cmis.rest;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.CMISDictionaryService;
|
||||
import org.alfresco.cmis.CMISJoinEnum;
|
||||
import org.alfresco.cmis.CMISObjectReference;
|
||||
import org.alfresco.cmis.CMISPropertyDefinition;
|
||||
import org.alfresco.cmis.CMISQueryEnum;
|
||||
import org.alfresco.cmis.CMISQueryOptions;
|
||||
import org.alfresco.cmis.CMISQueryService;
|
||||
import org.alfresco.cmis.CMISRelationshipDirectionEnum;
|
||||
import org.alfresco.cmis.CMISRelationshipReference;
|
||||
import org.alfresco.cmis.CMISRepositoryReference;
|
||||
import org.alfresco.cmis.CMISResultSet;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.cmis.CMISTypeDefinition;
|
||||
import org.alfresco.cmis.CMISTypesFilterEnum;
|
||||
import org.alfresco.cmis.CMISQueryOptions.CMISQueryMode;
|
||||
import org.alfresco.cmis.reference.NodeRefReference;
|
||||
import org.alfresco.cmis.reference.ReferenceFactory;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.jscript.Association;
|
||||
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
|
||||
import org.alfresco.repo.jscript.ScriptNode;
|
||||
import org.alfresco.repo.model.Repository;
|
||||
import org.alfresco.repo.web.util.paging.Cursor;
|
||||
import org.alfresco.repo.web.util.paging.Page;
|
||||
import org.alfresco.repo.web.util.paging.PagedResults;
|
||||
@@ -101,15 +104,11 @@ public class CMISScript extends BaseScopableProcessorExtension
|
||||
|
||||
// service dependencies
|
||||
private ServiceRegistry services;
|
||||
private Repository repository;
|
||||
private CMISServices cmisService;
|
||||
private CMISDictionaryService cmisDictionaryService;
|
||||
private CMISQueryService cmisQueryService;
|
||||
private Paging paging;
|
||||
|
||||
// versioned objectId pattern
|
||||
// TODO: encapsulate elsewhere
|
||||
private static final Pattern versionedObjectIdPattern = Pattern.compile(".+://.+/.+/.+");
|
||||
private ReferenceFactory referenceFactory;
|
||||
|
||||
|
||||
/**
|
||||
@@ -122,16 +121,6 @@ public class CMISScript extends BaseScopableProcessorExtension
|
||||
this.services = services;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the repository
|
||||
*
|
||||
* @param repository
|
||||
*/
|
||||
public void setRepository(Repository repository)
|
||||
{
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the paging helper
|
||||
*
|
||||
@@ -172,6 +161,16 @@ public class CMISScript extends BaseScopableProcessorExtension
|
||||
this.cmisQueryService = cmisQueryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the CMIS Reference Factory
|
||||
*
|
||||
* @param referenceFactory
|
||||
*/
|
||||
public void setCMISReferenceFactory(ReferenceFactory referenceFactory)
|
||||
{
|
||||
this.referenceFactory = referenceFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the supported CMIS Version
|
||||
*
|
||||
@@ -238,63 +237,83 @@ public class CMISScript extends BaseScopableProcessorExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a Node given a repository reference
|
||||
* Create CMIS Repository Reference from URL segments
|
||||
*
|
||||
* @param referenceType node, path
|
||||
* @param reference node => id, path => path
|
||||
* @return node (or null, if not found)
|
||||
* @param args url arguments
|
||||
* @param templateArgs url template arguments
|
||||
* @return Repository Reference (or null, in case of bad url)
|
||||
*/
|
||||
public ScriptNode findNode(String referenceType, String[] reference)
|
||||
public CMISRepositoryReference createRepoReferenceFromUrl(Map<String, String> args, Map<String, String> templateArgs)
|
||||
{
|
||||
ScriptNode node = null;
|
||||
NodeRef nodeRef = repository.findNodeRef(referenceType, reference);
|
||||
if (nodeRef != null)
|
||||
{
|
||||
node = new ScriptNode(nodeRef, services, getScope());
|
||||
}
|
||||
return node;
|
||||
return referenceFactory.createRepoReferenceFromUrl(args, templateArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create CMIS Object Reference from URL segments
|
||||
*
|
||||
* @param args url arguments
|
||||
* @param templateArgs url template arguments
|
||||
* @return Repository Reference (or null, in case of bad url)
|
||||
*/
|
||||
public CMISObjectReference createObjectReferenceFromUrl(Map<String, String> args, Map<String, String> templateArgs)
|
||||
{
|
||||
return referenceFactory.createObjectReferenceFromUrl(args, templateArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a Node given CMIS ObjectId
|
||||
* Create CMIS Relationship Reference from URL segments
|
||||
*
|
||||
* @param objectId
|
||||
* @return node (or null, if not found)
|
||||
* @param args url arguments
|
||||
* @param templateArgs url template arguments
|
||||
* @return Repository Reference (or null, in case of bad url)
|
||||
*/
|
||||
public ScriptNode findNode(String objectId)
|
||||
public CMISRelationshipReference createRelationshipReferenceFromUrl(Map<String, String> args, Map<String, String> templateArgs)
|
||||
{
|
||||
NodeRef nodeRef;
|
||||
Matcher matcher = versionedObjectIdPattern.matcher(objectId);
|
||||
if (matcher.matches())
|
||||
{
|
||||
// TODO: handle version id
|
||||
nodeRef = new NodeRef(objectId.substring(0, objectId.lastIndexOf("/")));
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeRef = new NodeRef(objectId);
|
||||
}
|
||||
String[] reference = new String[] {nodeRef.getStoreRef().getProtocol(), nodeRef.getStoreRef().getIdentifier(), nodeRef.getId()};
|
||||
return findNode("node", reference);
|
||||
return referenceFactory.createRelationshipReferenceFromUrl(args, templateArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds an Association
|
||||
* Create Object Reference
|
||||
*
|
||||
* @param sourceType
|
||||
* @param source
|
||||
* @param relDef
|
||||
* @param targetType
|
||||
* @param target
|
||||
*
|
||||
* @return
|
||||
* @param repo repository reference
|
||||
* @param object id object id (NodeRef.toString() format)
|
||||
* @return object id reference
|
||||
*/
|
||||
public Association findRelationship(CMISTypeDefinition relDef, String[] sourceRef, String[] targetRef)
|
||||
public CMISObjectReference createObjectIdReference(String objectId)
|
||||
{
|
||||
NodeRef source = new NodeRef(sourceRef[0], sourceRef[1], sourceRef[2]);
|
||||
NodeRef target = new NodeRef(targetRef[0], targetRef[1], targetRef[2]);
|
||||
AssociationRef assocRef = cmisService.getRelationship(relDef, source, target);
|
||||
return (assocRef == null) ? null : new Association(services, assocRef);
|
||||
return new NodeRefReference(cmisService, objectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Node from Object Reference
|
||||
*
|
||||
* @param ref object reference
|
||||
* @return node
|
||||
*/
|
||||
public ScriptNode getNode(CMISObjectReference ref)
|
||||
{
|
||||
NodeRef nodeRef = ref.getNodeRef();
|
||||
if (nodeRef == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ScriptNode(nodeRef, services, getScope());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Association from Relationship Reference
|
||||
*
|
||||
* @param ref relationship reference
|
||||
* @return association
|
||||
*/
|
||||
public Association getAssociation(CMISRelationshipReference ref)
|
||||
{
|
||||
AssociationRef assocRef = ref.getAssocRef();
|
||||
if (assocRef == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Association(services, assocRef);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -424,35 +443,6 @@ public class CMISScript extends BaseScopableProcessorExtension
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query for all Type Definitions in a type hierarchy
|
||||
*
|
||||
* @param page
|
||||
* @return paged result set of types
|
||||
*/
|
||||
// public PagedResults queryTypeHierarchy(CMISTypeDefinition typeDef, boolean descendants, Page page)
|
||||
// {
|
||||
// Collection<CMISTypeDefinition> subTypes = typeDef.getSubTypes(descendants);
|
||||
// Cursor cursor = paging.createCursor(subTypes.size(), page);
|
||||
//
|
||||
// // skip
|
||||
// Iterator<CMISTypeDefinition> iterSubTypes = subTypes.iterator();
|
||||
// for (int i = 0; i < cursor.getStartRow(); i++)
|
||||
// {
|
||||
// iterSubTypes.next();
|
||||
// }
|
||||
//
|
||||
// // get types for page
|
||||
// CMISTypeDefinition[] types = new CMISTypeDefinition[cursor.getRowCount()];
|
||||
// for (int i = cursor.getStartRow(); i <= cursor.getEndRow(); i++)
|
||||
// {
|
||||
// types[i - cursor.getStartRow()] = iterSubTypes.next();
|
||||
// }
|
||||
//
|
||||
// PagedResults results = paging.createPagedResults(types, cursor);
|
||||
// return results;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Query for a Type Definition given a CMIS Type Id
|
||||
*
|
||||
|
@@ -782,8 +782,6 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten
|
||||
{
|
||||
try
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Writing Transactional response: size=" + outputStream.size());
|
||||
|
||||
if (outputWriter != null)
|
||||
{
|
||||
@@ -792,6 +790,9 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten
|
||||
}
|
||||
else if (outputStream != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Writing Transactional response: size=" + outputStream.size());
|
||||
|
||||
outputStream.flush();
|
||||
outputStream.writeTo(res.getOutputStream());
|
||||
}
|
||||
|
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.web.scripts.content;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.cmis.CMISObjectReference;
|
||||
import org.alfresco.cmis.reference.ReferenceFactory;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.scripts.AbstractWebScript;
|
||||
import org.alfresco.web.scripts.WebScriptException;
|
||||
import org.alfresco.web.scripts.WebScriptRequest;
|
||||
import org.alfresco.web.scripts.WebScriptResponse;
|
||||
|
||||
|
||||
/**
|
||||
* Content Delete Service
|
||||
*
|
||||
* Delete content stream from the Repository.
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class ContentDelete extends AbstractWebScript
|
||||
{
|
||||
// Component dependencies
|
||||
private ReferenceFactory referenceFactory;
|
||||
private NamespaceService namespaceService;
|
||||
private NodeService nodeService;
|
||||
|
||||
/**
|
||||
* @param reference factory
|
||||
*/
|
||||
public void setReferenceFactory(ReferenceFactory referenceFactory)
|
||||
{
|
||||
this.referenceFactory = referenceFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param namespaceService
|
||||
*/
|
||||
public void setNamespaceService(NamespaceService namespaceService)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeService
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
|
||||
*/
|
||||
public void execute(WebScriptRequest req, WebScriptResponse res)
|
||||
throws IOException
|
||||
{
|
||||
// create map of args
|
||||
String[] names = req.getParameterNames();
|
||||
Map<String, String> args = new HashMap<String, String>(names.length, 1.0f);
|
||||
for (String name : names)
|
||||
{
|
||||
args.put(name, req.getParameter(name));
|
||||
}
|
||||
|
||||
// create map of template vars
|
||||
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
|
||||
|
||||
// create object reference from url
|
||||
CMISObjectReference reference = referenceFactory.createObjectReferenceFromUrl(args, templateVars);
|
||||
NodeRef nodeRef = reference.getNodeRef();
|
||||
if (nodeRef == null)
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find " + reference.toString());
|
||||
}
|
||||
|
||||
// determine content property
|
||||
QName propertyQName = ContentModel.PROP_CONTENT;
|
||||
String contentPart = templateVars.get("property");
|
||||
if (contentPart.length() > 0 && contentPart.charAt(0) == ';')
|
||||
{
|
||||
if (contentPart.length() < 2)
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Content property malformed");
|
||||
}
|
||||
String propertyName = contentPart.substring(1);
|
||||
if (propertyName.length() > 0)
|
||||
{
|
||||
propertyQName = QName.createQName(propertyName, namespaceService);
|
||||
}
|
||||
}
|
||||
|
||||
// retrieve content property
|
||||
ContentData contentData = (ContentData)nodeService.getProperty(nodeRef, propertyQName);
|
||||
if (contentData != null)
|
||||
{
|
||||
contentData = new ContentData(null, null, 0, null);
|
||||
nodeService.setProperty(nodeRef, propertyQName, contentData);
|
||||
}
|
||||
|
||||
// no content returned
|
||||
res.setStatus(204);
|
||||
}
|
||||
}
|
@@ -25,13 +25,14 @@
|
||||
package org.alfresco.repo.web.scripts.content;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.cmis.CMISObjectReference;
|
||||
import org.alfresco.cmis.reference.ReferenceFactory;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.model.Repository;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -56,15 +57,15 @@ public class ContentGet extends StreamContent
|
||||
private static final Log logger = LogFactory.getLog(ContentGet.class);
|
||||
|
||||
// Component dependencies
|
||||
private Repository repository;
|
||||
private ReferenceFactory referenceFactory;
|
||||
private NamespaceService namespaceService;
|
||||
|
||||
/**
|
||||
* @param repository
|
||||
* @param reference factory
|
||||
*/
|
||||
public void setRepository(Repository repository)
|
||||
public void setReferenceFactory(ReferenceFactory referenceFactory)
|
||||
{
|
||||
this.repository = repository;
|
||||
this.referenceFactory = referenceFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,20 +81,24 @@ public class ContentGet extends StreamContent
|
||||
*/
|
||||
public void execute(WebScriptRequest req, WebScriptResponse res)
|
||||
throws IOException
|
||||
{
|
||||
// convert web script URL to node reference in Repository
|
||||
String match = req.getServiceMatch().getPath();
|
||||
String[] matchParts = match.split("/");
|
||||
{
|
||||
// create map of args
|
||||
String[] names = req.getParameterNames();
|
||||
Map<String, String> args = new HashMap<String, String>(names.length, 1.0f);
|
||||
for (String name : names)
|
||||
{
|
||||
args.put(name, req.getParameter(name));
|
||||
}
|
||||
|
||||
// create map of template vars
|
||||
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
|
||||
String[] id = templateVars.get("id").split("/");
|
||||
String[] path = new String[id.length + 2];
|
||||
path[0] = templateVars.get("store_type");
|
||||
path[1] = templateVars.get("store_id");
|
||||
System.arraycopy(id, 0, path, 2, id.length);
|
||||
NodeRef nodeRef = repository.findNodeRef(matchParts[2], path);
|
||||
|
||||
// create object reference from url
|
||||
CMISObjectReference reference = referenceFactory.createObjectReferenceFromUrl(args, templateVars);
|
||||
NodeRef nodeRef = reference.getNodeRef();
|
||||
if (nodeRef == null)
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find " + matchParts[2] + " reference " + Arrays.toString(path));
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find " + reference.toString());
|
||||
}
|
||||
|
||||
// determine content property
|
||||
|
@@ -28,14 +28,16 @@ import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.cmis.CMISObjectReference;
|
||||
import org.alfresco.cmis.reference.ObjectPathReference;
|
||||
import org.alfresco.cmis.reference.ReferenceFactory;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.encoding.ContentCharsetFinder;
|
||||
import org.alfresco.repo.model.Repository;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
@@ -68,18 +70,18 @@ public class ContentSet extends AbstractWebScript
|
||||
private static final Log logger = LogFactory.getLog(ContentSet.class);
|
||||
|
||||
// Component dependencies
|
||||
private Repository repository;
|
||||
private ReferenceFactory referenceFactory;
|
||||
private DictionaryService dictionaryService;
|
||||
private NamespaceService namespaceService;
|
||||
private ContentService contentService;
|
||||
private MimetypeService mimetypeService;
|
||||
|
||||
/**
|
||||
* @param repository
|
||||
* @param reference factory
|
||||
*/
|
||||
public void setRepository(Repository repository)
|
||||
public void setReferenceFactory(ReferenceFactory referenceFactory)
|
||||
{
|
||||
this.repository = repository;
|
||||
this.referenceFactory = referenceFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,20 +121,24 @@ public class ContentSet extends AbstractWebScript
|
||||
*/
|
||||
public void execute(WebScriptRequest req, WebScriptResponse res)
|
||||
throws IOException
|
||||
{
|
||||
// convert web script URL to node reference in Repository
|
||||
String match = req.getServiceMatch().getPath();
|
||||
String[] matchParts = match.split("/");
|
||||
{
|
||||
// create map of args
|
||||
String[] names = req.getParameterNames();
|
||||
Map<String, String> args = new HashMap<String, String>(names.length, 1.0f);
|
||||
for (String name : names)
|
||||
{
|
||||
args.put(name, req.getParameter(name));
|
||||
}
|
||||
|
||||
// create map of template vars
|
||||
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
|
||||
String[] id = templateVars.get("id").split("/");
|
||||
String[] path = new String[id.length + 2];
|
||||
path[0] = templateVars.get("store_type");
|
||||
path[1] = templateVars.get("store_id");
|
||||
System.arraycopy(id, 0, path, 2, id.length);
|
||||
NodeRef nodeRef = repository.findNodeRef(matchParts[2], path);
|
||||
|
||||
// create object reference from url
|
||||
CMISObjectReference reference = referenceFactory.createObjectReferenceFromUrl(args, templateVars);
|
||||
NodeRef nodeRef = reference.getNodeRef();
|
||||
if (nodeRef == null)
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find " + matchParts[2] + " reference " + Arrays.toString(path));
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find " + reference.toString());
|
||||
}
|
||||
|
||||
// determine content property
|
||||
@@ -153,7 +159,7 @@ public class ContentSet extends AbstractWebScript
|
||||
PropertyDefinition propertyDef = dictionaryService.getProperty(propertyQName);
|
||||
if (propertyDef == null)
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find " + matchParts[2] + " reference " + Arrays.toString(path) + " content property " + propertyQName);
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find content property " + propertyQName + " of " + reference.toString());
|
||||
}
|
||||
if (!propertyDef.getDataType().getName().equals(DataTypeDefinition.CONTENT))
|
||||
{
|
||||
@@ -180,9 +186,9 @@ public class ContentSet extends AbstractWebScript
|
||||
String mimetype = req.getContentType();
|
||||
if (mimetype == null)
|
||||
{
|
||||
if (matchParts[2].equals("path") || matchParts[2].equals("avmpath"))
|
||||
if (reference instanceof ObjectPathReference)
|
||||
{
|
||||
mimetype = mimetypeService.guessMimetype(templateVars.get("id"));
|
||||
mimetype = mimetypeService.guessMimetype(((ObjectPathReference)reference).getPath());
|
||||
}
|
||||
}
|
||||
if (mimetype != null)
|
||||
|
Reference in New Issue
Block a user