mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged V3.2 to HEAD
19614: ALF-1890: Merged V2.2 to V3.2 17709: Merged DEV_TEMPORARY to V2.2 17700: ETWOTWO-1393: concurrent writes to webdav lead to data loss (0kb resulting file) 19613: Merged DEV/BELARUS/V2.2-2010_02_03 to V2.2 19157: ALF-1890: concurrent writes to webdav lead to data loss (0kb resulting file) 19562: Merged DEV/BELARUS/V3.2-2010_02_24 to V3.2 19244: ALF-1816: Email templates can no longer be selected when creating a rule for the action 'Send email to specified users' following an upgrade - New patch has been created to create invite email templates and notify email templates folders if those are absent. Also it moves default notify and invite templates into appropriate folders. 19561: Merged DEV/BELARUS/V3.2-2010_02_24 to V3.2 (With improvements) 19294: ALF-929: email to invite external users does not allow external users to login (no credentails) - Always create a password for created users if the authentication chain allows account creation git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19615 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -19,7 +19,12 @@
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
@@ -35,6 +40,8 @@ import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.model.FileNotFoundException;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.TempFileProvider;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
/**
|
||||
* Implements the WebDAV PUT method
|
||||
@@ -48,6 +55,8 @@ public class PutMethod extends WebDAVMethod
|
||||
private String m_strContentType = null;
|
||||
private boolean m_expectHeaderPresent = false;
|
||||
|
||||
private File requestBody = null;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
@@ -82,8 +91,16 @@ public class PutMethod extends WebDAVMethod
|
||||
*/
|
||||
protected void parseRequestBody() throws WebDAVServerException
|
||||
{
|
||||
// Nothing to do in this method, the body contains
|
||||
// the content it will be dealt with later
|
||||
requestBody = TempFileProvider.createTempFile("webdav_PUT_", ".bin");
|
||||
try
|
||||
{
|
||||
OutputStream out = new FileOutputStream(requestBody);
|
||||
FileCopyUtils.copy(m_request.getInputStream(), out);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new WebDAVServerException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,13 +166,13 @@ public class PutMethod extends WebDAVMethod
|
||||
}
|
||||
else
|
||||
{
|
||||
String guessedMimetype = getMimetypeService().guessMimetype(contentNodeInfo.getName());
|
||||
String guessedMimetype = getMimetypeService().guessMimetype(getPath());
|
||||
mimetype = guessedMimetype;
|
||||
}
|
||||
writer.setMimetype(mimetype);
|
||||
|
||||
// Get the input stream from the request data
|
||||
InputStream is = m_request.getInputStream();
|
||||
InputStream is = new FileInputStream(requestBody);
|
||||
is = is.markSupported() ? is : new BufferedInputStream(is);
|
||||
|
||||
ContentCharsetFinder charsetFinder = getMimetypeService().getContentCharsetFinder();
|
||||
@@ -168,4 +185,17 @@ public class PutMethod extends WebDAVMethod
|
||||
// Set the response status, depending if the node existed or not
|
||||
m_response.setStatus(created ? HttpServletResponse.SC_CREATED : HttpServletResponse.SC_NO_CONTENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanup()
|
||||
{
|
||||
try
|
||||
{
|
||||
requestBody.delete();
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
logger.error("Failed to delete temp file", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user