From b1c7ca6b071c59eab78a8846364986c108f61ac7 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Tue, 27 Mar 2012 15:55:56 +0000 Subject: [PATCH] Merged BRANCHES/DEV/THOR1_WEBDAV to HEAD: 34820: WebDAV: PUT method holds on to record of file-size and a FileInfo record after upload. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@34821 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/repo/webdav/PutMethod.java | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/source/java/org/alfresco/repo/webdav/PutMethod.java b/source/java/org/alfresco/repo/webdav/PutMethod.java index 7ec1dbef4b..28b5a70432 100644 --- a/source/java/org/alfresco/repo/webdav/PutMethod.java +++ b/source/java/org/alfresco/repo/webdav/PutMethod.java @@ -51,6 +51,8 @@ public class PutMethod extends WebDAVMethod implements ActivityPostProducer private boolean noContent = false; private boolean created = false; private ActivityPoster activityPoster; + private FileInfo contentNodeInfo; + private long fileSize; /** * Default constructor @@ -151,7 +153,6 @@ public class PutMethod extends WebDAVMethod implements ActivityPostProducer FileFolderService fileFolderService = getFileFolderService(); // Get the status for the request path - FileInfo contentNodeInfo = null; try { contentNodeInfo = getDAVHelper().getNodeForPath(getRootNodeRef(), getPath(), getServletPath()); @@ -250,6 +251,9 @@ public class PutMethod extends WebDAVMethod implements ActivityPostProducer } } + // Record the uploaded file's size + fileSize = writer.getSize(); + // Set the response status, depending if the node existed or not m_response.setStatus(created ? HttpServletResponse.SC_CREATED : HttpServletResponse.SC_NO_CONTENT); } @@ -302,7 +306,27 @@ public class PutMethod extends WebDAVMethod implements ActivityPostProducer */ public String getContentType() { - return this.m_strContentType; + return m_strContentType; + } + + /** + * The FileInfo for the uploaded file, or null if not yet uploaded. + * + * @return FileInfo + */ + public FileInfo getContentNodeInfo() + { + return contentNodeInfo; + } + + /** + * Returns the size of the uploaded file, zero if not yet uploaded. + * + * @return the fileSize + */ + public long getFileSize() + { + return fileSize; } /**