Fixed AR-1321: Allow '&' in filename

The following filename is valid now: "x ¬ £ % & + ; x.txt"
This was a restriction imposed by WebDAV, but the encoding of the repsonses is working well and these restrictions be removed as a result.

Fixed AR-1281: WebDAV upload was assigning incorrect encoding

I added a bean 'charset.finder', which can be fetched from the MimetypeService.
Various pluggins now exist to decode a stream and figure out what the encoding is.
WebDAV and CIFS/FTP are now hooked into this so that they guess a little better.

Fixed others:
Added retrying transactions to WebDAV.
Read/write transactions for WebDAV.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6073 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-06-22 21:27:17 +00:00
parent 559d92956c
commit 079ee79f52
6 changed files with 75 additions and 83 deletions

View File

@@ -37,8 +37,7 @@ import javax.xml.parsers.ParserConfigurationException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.repo.transaction.TransactionUtil;
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.service.cmr.model.FileFolderService;
@@ -114,11 +113,23 @@ public abstract class WebDAVMethod
m_strPath = WebDAV.getRepositoryPath(req);
}
/**
* Override and return <tt>true</tt> if the method is a query method only. The default implementation
* returns <tt>false</tt>.
*
* @return Returns <tt>true</tt> if the method transaction may be read-only
*/
protected boolean isReadOnly()
{
return false;
}
/**
* Executes the method
* Executes the method, wrapping the call to {@link #executeImpl()} in an appropriate transaction
* and handling the error conditions.
*/
public void execute() throws WebDAVServerException
public final void execute() throws WebDAVServerException
{
// Parse the HTTP headers
parseRequestHeaders();
@@ -126,9 +137,9 @@ public abstract class WebDAVMethod
// Parse the HTTP body
parseRequestBody();
TransactionWork<WebDAVServerException> executeWork = new TransactionWork<WebDAVServerException>()
RetryingTransactionCallback<Object> executeImplCallback = new RetryingTransactionCallback<Object>()
{
public WebDAVServerException doWork() throws Exception
public Object execute() throws Exception
{
executeImpl();
return null;
@@ -136,9 +147,9 @@ public abstract class WebDAVMethod
};
try
{
boolean isReadOnly = isReadOnly();
// Execute the method
TransactionService transactionService = getTransactionService();
TransactionUtil.executeInUserTransaction(transactionService, executeWork);
getTransactionService().getRetryingTransactionHelper().doInTransaction(executeImplCallback, isReadOnly);
}
catch (AccessDeniedException e)
{