mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
132357 adavis: Merged 5.2.N-SERVLET-3.0 (5.2.1) to 5.2.N (5.2.1) 131490: REPO-1238 / REPO-1413: Use data-model with the OpenCMIS upgrade., 131493: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0. - Compilation errors fixed - Removed old JAX-WS listener from web.xml + sun-jaxws.xml - obsolete after the upgrade (OpenCMIS has replaced JAX-WS with Apache CXF) - Set chemistry-opencmis-test-browser version to 0.14.0, since it was removed in 1.0.0 (TODO: see if something from 1.0.0 can be used instead) - Changed dependency on XmlSchema 1.4.7 to xmlschema-core 2.2.1 (required by Apache CXF) - implications of this change still to be addressed., 131569: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0. - Possible fix for the browser binding - since OpenCMIS 0.13.0, repository URLs always require a cmisselector parameter (see CMIS-893)., 131671: REPO-843 Upgrade our Servlet API usage to 3.0.1 (from 2.4 / 2.5) - Modifications to weblogic-application.xml to allow Weblogic 12.2.1.1 to start with the changes made so far for the 1.0 Open CMIS upgrade (REPO-1238). This follows the Servlet 3.0 upgrade which resulted in WebLogic not starting. The Open CMIS upgrade has helped with fixing the WebLogic start up issue, however... - Some of the changes are TEMPORARY to pick up classes and resources from either the JRE or WebLogic rather than the alfresco.war. These should be coming from the alfresco.war, but we will still need to upgrade the jars that we package. See comments being added to REPO-1413 related to the CMIS upgrade. - It is likely that there are other entries in this file that are not needed., 131758: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0 - Fix for CMISTCKVersioning tests. - The VersioningSmokeTest from the OpenCMIS TCK has been enhanced with the case of checking-in documents with new properties (not just new content). This touches the part of code in CMISConnector that parses the secondary types (aspects), removes the old ones and adds the new. The problem was that even the working copy aspect was removed for checked out documents. This is illegal and an error was thrown. - Applies to CMIS 1.1., 131815: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0 - Fix for CMISTCKVersioning tests. - The VersioningSmokeTest from the OpenCMIS TCK has been enhanced with the case of checking-in documents with new properties (not just new content). So the tests check-in a document with the same name as the original name causing the rename of the working copy to fail. I added an extra check on the name format for working copies. - Applies to CMIS 1.0., 131843: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0 - Fix for CMISTCKCRUD tests. - The SetAndDeleteContentTest from the OpenCMIS TCK has been enhanced with tests that append content. The case where the content was 0 bytes failed, because of an "unnecessary" (hopefully) check on the content data length., 131859: REPO-1413 : Upgrade to OpenCMIS 1.0 - update dependencies and fix compilation and/or build test failures - fixed failing testVersioningPropertiesHaveDefaultValue , 131868: REPO-1413 : Upgrade to OpenCMIS 1.0 - update dependencies and fix compilation and/or build test failures - fixed new failing tests, 131876: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0 - Fix for versioning related tests., 131907: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0 - Removed unused dependency on chemistry-opencmis-test-browser, 132064: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0 - Removed unnecessary excludes, updated data-model, added junit dependency for legacy-lucene which was relying on a now unused dependency to get the junit., 132069: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0 - Upgrade jaxb libraries to 2.2.11, alfresco-core to 6.7., 132110: REPO-843 Upgrade our Servlet API usage to 3.0.1 (from 2.4 / 2.5) - Further modifications to weblogic-application.xml - Checked file only contains references to files that we actually package in alfresco.war. - Add additional entries identified by WebLogic's CAT - Exclude myfaces-api-1.1.10.jar classes (used by the Explorer UI, removed in 5.0 but still used by Cloud). - Exclude classes that cause start up exception. We must use the RT or Weblogic versions., 132161: REPO-1238 / REPO-1413: OpenCMIS upgrade to 1.0.0 - code review changes 132356: Change to using data-model 6.6 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@132365 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
391 lines
11 KiB
Java
391 lines
11 KiB
Java
/*
|
|
* #%L
|
|
* Alfresco Remote API
|
|
* %%
|
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
|
* %%
|
|
* This file is part of the Alfresco software.
|
|
* If the software was purchased under a paid Alfresco license, the terms of
|
|
* the paid license agreement will prevail. Otherwise, the software is
|
|
* provided under the following open source license terms:
|
|
*
|
|
* Alfresco is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Alfresco 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 Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
* #L%
|
|
*/
|
|
package org.alfresco.repo.web.scripts;
|
|
|
|
import java.io.BufferedReader;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStreamReader;
|
|
|
|
import org.apache.chemistry.opencmis.commons.server.TempStoreOutputStream;
|
|
import org.apache.chemistry.opencmis.server.shared.TempStoreOutputStreamFactory;
|
|
import org.springframework.extensions.surf.util.Content;
|
|
import org.springframework.extensions.webscripts.Description.FormatStyle;
|
|
import org.springframework.extensions.webscripts.Match;
|
|
import org.springframework.extensions.webscripts.Runtime;
|
|
import org.springframework.extensions.webscripts.WebScriptRequest;
|
|
import org.springframework.extensions.webscripts.WrappingWebScriptRequest;
|
|
import org.springframework.util.FileCopyUtils;
|
|
|
|
public class BufferedRequest implements WrappingWebScriptRequest
|
|
{
|
|
private TempStoreOutputStreamFactory streamFactory;
|
|
private WebScriptRequest req;
|
|
private File requestBody;
|
|
private InputStream contentStream;
|
|
private BufferedReader contentReader;
|
|
|
|
public BufferedRequest(WebScriptRequest req, TempStoreOutputStreamFactory streamFactory)
|
|
{
|
|
this.req = req;
|
|
this.streamFactory = streamFactory;
|
|
}
|
|
|
|
private InputStream bufferInputStream() throws IOException
|
|
{
|
|
TempStoreOutputStream bufferStream = streamFactory.newOutputStream();
|
|
|
|
try
|
|
{
|
|
FileCopyUtils.copy(req.getContent().getInputStream(), bufferStream);
|
|
}
|
|
catch (IOException e)
|
|
{
|
|
bufferStream.destroy(e); // remove temp file
|
|
throw e;
|
|
}
|
|
|
|
return bufferStream.getInputStream();
|
|
}
|
|
|
|
public void reset()
|
|
{
|
|
if (contentStream != null)
|
|
{
|
|
try
|
|
{
|
|
contentStream.close();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
}
|
|
contentStream = null;
|
|
}
|
|
if (contentReader != null)
|
|
{
|
|
try
|
|
{
|
|
contentReader.close();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
}
|
|
contentReader = null;
|
|
}
|
|
}
|
|
|
|
public void close()
|
|
{
|
|
reset();
|
|
if (requestBody != null)
|
|
{
|
|
try
|
|
{
|
|
requestBody.delete();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
}
|
|
requestBody = null;
|
|
}
|
|
}
|
|
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WrappingWebScriptRequest#getNext()
|
|
*/
|
|
@Override
|
|
public WebScriptRequest getNext()
|
|
{
|
|
return req;
|
|
}
|
|
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#forceSuccessStatus()
|
|
*/
|
|
@Override
|
|
public boolean forceSuccessStatus()
|
|
{
|
|
return req.forceSuccessStatus();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getAgent()
|
|
*/
|
|
@Override
|
|
public String getAgent()
|
|
{
|
|
return req.getAgent();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getContent()
|
|
*/
|
|
@Override
|
|
public Content getContent()
|
|
{
|
|
final Content wrapped = req.getContent();
|
|
return new Content(){
|
|
|
|
@Override
|
|
public String getContent() throws IOException
|
|
{
|
|
return wrapped.getContent();
|
|
}
|
|
|
|
@Override
|
|
public String getEncoding()
|
|
{
|
|
return wrapped.getEncoding();
|
|
}
|
|
|
|
@Override
|
|
public String getMimetype()
|
|
{
|
|
return wrapped.getMimetype();
|
|
}
|
|
|
|
|
|
@Override
|
|
public long getSize()
|
|
{
|
|
return wrapped.getSize();
|
|
}
|
|
|
|
@Override
|
|
public InputStream getInputStream()
|
|
{
|
|
if (BufferedRequest.this.contentReader != null)
|
|
{
|
|
throw new IllegalStateException("Reader in use");
|
|
}
|
|
if (BufferedRequest.this.contentStream == null)
|
|
{
|
|
try
|
|
{
|
|
BufferedRequest.this.contentStream = bufferInputStream();
|
|
}
|
|
catch (IOException e)
|
|
{
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
return BufferedRequest.this.contentStream;
|
|
}
|
|
|
|
@Override
|
|
public BufferedReader getReader() throws IOException
|
|
{
|
|
if (BufferedRequest.this.contentStream != null)
|
|
{
|
|
throw new IllegalStateException("Input Stream in use");
|
|
}
|
|
if (BufferedRequest.this.contentReader == null)
|
|
{
|
|
String encoding = wrapped.getEncoding();
|
|
InputStream in = bufferInputStream();
|
|
BufferedRequest.this.contentReader = new BufferedReader(new InputStreamReader(in, encoding == null ? "ISO-8859-1" : encoding));
|
|
}
|
|
return BufferedRequest.this.contentReader;
|
|
}
|
|
};
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getContentType()
|
|
*/
|
|
@Override
|
|
public String getContentType()
|
|
{
|
|
return req.getContentType();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getContextPath()
|
|
*/
|
|
@Override
|
|
public String getContextPath()
|
|
{
|
|
return req.getContextPath();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getExtensionPath()
|
|
*/
|
|
@Override
|
|
public String getExtensionPath()
|
|
{
|
|
return req.getExtensionPath();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getFormat()
|
|
*/
|
|
@Override
|
|
public String getFormat()
|
|
{
|
|
return req.getFormat();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getFormatStyle()
|
|
*/
|
|
@Override
|
|
public FormatStyle getFormatStyle()
|
|
{
|
|
return req.getFormatStyle();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getHeader(java.lang.String)
|
|
*/
|
|
@Override
|
|
public String getHeader(String name)
|
|
{
|
|
return req.getHeader(name);
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getHeaderNames()
|
|
*/
|
|
@Override
|
|
public String[] getHeaderNames()
|
|
{
|
|
return req.getHeaderNames();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getHeaderValues(java.lang.String)
|
|
*/
|
|
@Override
|
|
public String[] getHeaderValues(String name)
|
|
{
|
|
return req.getHeaderValues(name);
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getJSONCallback()
|
|
*/
|
|
@Override
|
|
public String getJSONCallback()
|
|
{
|
|
return req.getJSONCallback();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getParameter(java.lang.String)
|
|
*/
|
|
@Override
|
|
public String getParameter(String name)
|
|
{
|
|
return req.getParameter(name);
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getParameterNames()
|
|
*/
|
|
@Override
|
|
public String[] getParameterNames()
|
|
{
|
|
return req.getParameterNames();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getParameterValues(java.lang.String)
|
|
*/
|
|
@Override
|
|
public String[] getParameterValues(String name)
|
|
{
|
|
return req.getParameterValues(name);
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getPathInfo()
|
|
*/
|
|
@Override
|
|
public String getPathInfo()
|
|
{
|
|
return req.getPathInfo();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getQueryString()
|
|
*/
|
|
@Override
|
|
public String getQueryString()
|
|
{
|
|
return req.getQueryString();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getRuntime()
|
|
*/
|
|
@Override
|
|
public Runtime getRuntime()
|
|
{
|
|
return req.getRuntime();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getServerPath()
|
|
*/
|
|
@Override
|
|
public String getServerPath()
|
|
{
|
|
return req.getServerPath();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getServiceContextPath()
|
|
*/
|
|
@Override
|
|
public String getServiceContextPath()
|
|
{
|
|
return req.getServiceContextPath();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getServiceMatch()
|
|
*/
|
|
@Override
|
|
public Match getServiceMatch()
|
|
{
|
|
return req.getServiceMatch();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getServicePath()
|
|
*/
|
|
@Override
|
|
public String getServicePath()
|
|
{
|
|
return req.getServicePath();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#getURL()
|
|
*/
|
|
@Override
|
|
public String getURL()
|
|
{
|
|
return req.getURL();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#isGuest()
|
|
*/
|
|
@Override
|
|
public boolean isGuest()
|
|
{
|
|
return req.isGuest();
|
|
}
|
|
/* (non-Javadoc)
|
|
* @see org.springframework.extensions.webscripts.WebScriptRequest#parseContent()
|
|
*/
|
|
@Override
|
|
public Object parseContent()
|
|
{
|
|
return req.parseContent();
|
|
}
|
|
}
|