mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-17 14:21:39 +00:00
REPO-4388 cors transaction (#228)
* REPO-4388 implement regex pattern for skipping deletion of certain headers during resets like the CORS headers * REPO-4388 bump webscript
This commit is contained in:
committed by
Alex Mukha
parent
a8d404c3ba
commit
b593fe0459
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -181,6 +181,22 @@ public class BufferedResponse implements WrappingWebScriptResponse
|
|||||||
res.reset();
|
res.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org./alfresco.web.scripts.WebScriptResponse#resetjava.lang.String)
|
||||||
|
*/
|
||||||
|
public void reset(String preserveHeadersPattern)
|
||||||
|
{
|
||||||
|
if (outputStream != null)
|
||||||
|
{
|
||||||
|
outputStream = null;
|
||||||
|
}
|
||||||
|
else if (outputWriter != null)
|
||||||
|
{
|
||||||
|
outputWriter = null;
|
||||||
|
}
|
||||||
|
res.reset(preserveHeadersPattern);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.alfresco.web.scripts.WebScriptResponse#setCache(org.alfresco.web.scripts.Cache)
|
* @see org.alfresco.web.scripts.WebScriptResponse#setCache(org.alfresco.web.scripts.Cache)
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -97,6 +97,7 @@ public class RepositoryContainer extends AbstractRuntimeContainer
|
|||||||
private int memoryThreshold = 4 * 1024 * 1024; // 4mb
|
private int memoryThreshold = 4 * 1024 * 1024; // 4mb
|
||||||
private long maxContentSize = (long) 4 * 1024 * 1024 * 1024; // 4gb
|
private long maxContentSize = (long) 4 * 1024 * 1024 * 1024; // 4gb
|
||||||
private TempStoreOutputStreamFactory streamFactory = null;
|
private TempStoreOutputStreamFactory streamFactory = null;
|
||||||
|
private String preserveHeadersPattern = null;
|
||||||
|
|
||||||
private Class<?>[] notPublicExceptions = new Class<?>[] {};
|
private Class<?>[] notPublicExceptions = new Class<?>[] {};
|
||||||
private Class<?>[] publicExceptions = new Class<?>[] {};
|
private Class<?>[] publicExceptions = new Class<?>[] {};
|
||||||
@@ -139,6 +140,11 @@ public class RepositoryContainer extends AbstractRuntimeContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPreserveHeadersPattern(String preserveHeadersPattern)
|
||||||
|
{
|
||||||
|
this.preserveHeadersPattern = preserveHeadersPattern;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param repository Repository
|
* @param repository Repository
|
||||||
*/
|
*/
|
||||||
@@ -515,7 +521,8 @@ public class RepositoryContainer extends AbstractRuntimeContainer
|
|||||||
{
|
{
|
||||||
// Reset the request and response in case of a transaction retry
|
// Reset the request and response in case of a transaction retry
|
||||||
bufferedReq.reset();
|
bufferedReq.reset();
|
||||||
bufferedRes.reset();
|
// REPO-4388 don't reset specified headers
|
||||||
|
bufferedRes.reset(preserveHeadersPattern);
|
||||||
script.execute(bufferedReq, bufferedRes);
|
script.execute(bufferedReq, bufferedRes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,3 +22,5 @@
|
|||||||
#
|
#
|
||||||
# See issue REPO-2575 for details.
|
# See issue REPO-2575 for details.
|
||||||
alfresco.restApi.basicAuthScheme=false
|
alfresco.restApi.basicAuthScheme=false
|
||||||
|
# REPO-4388 allow CORS headers in transaction response
|
||||||
|
webscripts.transaction.preserveHeadersPattern=Access-Control-.*
|
@@ -66,6 +66,7 @@
|
|||||||
<property name="tempDirectoryName" value="${webscripts.tempDirectoryName}"/>
|
<property name="tempDirectoryName" value="${webscripts.tempDirectoryName}"/>
|
||||||
<property name="memoryThreshold" value="${webscripts.memoryThreshold}"/>
|
<property name="memoryThreshold" value="${webscripts.memoryThreshold}"/>
|
||||||
<property name="maxContentSize" value="${webscripts.setMaxContentSize}"/>
|
<property name="maxContentSize" value="${webscripts.setMaxContentSize}"/>
|
||||||
|
<property name="preserveHeadersPattern" value="${webscripts.transaction.preserveHeadersPattern}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Public Api Authenticator -->
|
<!-- Public Api Authenticator -->
|
||||||
|
@@ -175,6 +175,7 @@
|
|||||||
<property name="tempDirectoryName" value="${webscripts.tempDirectoryName}"/>
|
<property name="tempDirectoryName" value="${webscripts.tempDirectoryName}"/>
|
||||||
<property name="memoryThreshold" value="${webscripts.memoryThreshold}"/>
|
<property name="memoryThreshold" value="${webscripts.memoryThreshold}"/>
|
||||||
<property name="maxContentSize" value="${webscripts.setMaxContentSize}"/>
|
<property name="maxContentSize" value="${webscripts.setMaxContentSize}"/>
|
||||||
|
<property name="preserveHeadersPattern" value="${webscripts.transaction.preserveHeadersPattern}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="webscripts.index.prototype" class="org.springframework.extensions.webscripts.JaxRSUriIndex" scope="prototype"/>
|
<bean id="webscripts.index.prototype" class="org.springframework.extensions.webscripts.JaxRSUriIndex" scope="prototype"/>
|
||||||
|
Reference in New Issue
Block a user