Merged V4.1-BUG-FIX to HEAD

39838: Minor fixes to yellowTheme rendering and title background
   39871: ALF-610: Merged V3.4-BUG-FIX (3.4.11) to V4.1-BUG-FIX (4.1.1)
      39842: ALF-15294 CLONE Jodconvertor - no office manager available 
         - Wire up 'startListener' logic better, so that it does not need to go in OpenOfficeContentTransformerWorker
           but in the SocketOpenOfficeConnection, which also avoids a test on start up.
      39841: ALF-15294 CLONE Jodconvertor - no office manager available 
         Changing the OOoDirect subsystem so that:
         - It will not start an OpenOffice process if the OOoJodconverter subsystem is also starting an process on the same port (8100 is
           still the default in both cases). An ERROR is logged on startup if there is a clash of ports.
         - It no longer tries to establishes a connection to an OpenOffice process if ooo.enabled is false, or there is a clash of port
           numbers with the OOoJodconverter subsystem. Both these checks are new.
         - ooo.enabled must now be true before it tries to connect to an OpenOffice process on a remote host (ooo.host must not be localhost).
         - It will no longer schedule a job to establish and test the connection if it is not being used.
   39923: ALF-610: Merged V3.4-BUG-FIX (3.4.11) to V4.1-BUG-FIX (4.1.1)
      39922: ALF-15294 CLONE Jodconvertor - no office manager available 
         - Start up problems with community version when the OOoJodconverter sub system is not there, because of the access to a Jod bean
         - Allow a default bean to be specified when the sub system bean could not be accessed.
   39962: ALF-15158: Downloading Office 97 files with .doc extension result in file with .dot extension when using Google Chrome
     - Added more complete and intelligent content disposition header with the aim of supporting  RFC 5987
   39975: Merged BRANCHES/DEV/V3.4-BUG-FIX to BRANCHES/DEV/V4.1-BUG-FIX (Record Only)
      39974: Merged BRANCHES/DEV/V4.1-BUG-FIX to BRANCHES/DEV/V3.4-BUG-FIX 
         39953: Refactored "Content I'm Editing" dashlet from synchronous (slowing down user dashboard initial display) to asynchronous client-side rendering. (ALF-13404)
   39978: Merged BRANCHES/DEV/BELARUS/V4.1-BUG-FIX-2012_07_09 to BRANCHES/DEV/V4.1-BUG-FIX
      39921: ALF-13473: IE9: can't login to awe. Upgrade YUI library to 2.9.0 for awe application.
   39991: ALF-15339: Added empty-value check, caused group/user-search in workflows to fail
   39999: Reversed revision 36174, thus removing Kofax
   40025: Merged BRANCHES/V4.1 to BRANCHES/DEV/V4.1-BUG-FIX (Record Only)
      40024: Merged BRANCHES/DEV/V4.1-BUG-FIX to BRANCHES/V4.1
         40022: Fix for ALF-15144 - Slow Share doclib high-level folder browsing due to version history retrieval
   40028: ALF-15346: Upgrade of Tika to 1.3-SNAPSHOT
      - Upgraded commons-codec from 1.4 to 1.5
      - Upgraded commons-compress from 1.1 to 1.4.1
      - Upgraded fontbox from 1.6.0 to 1.7.0
      - Upgraded jempbox from 1.6.0 to 1.7.0
      - Upgraded pdfbox from 1.6.0-patched to 1.7.0-patched
      - Upgraded metadata-extractor from 2.4.0-beta-1 to 2.6.2
      - Upgraded poi-* from 3.9-beta1-20120329 to 3.9-beta1-20120801
      - Upgraded tika-* from 1.2-20120518 to 1.3-20120801
      - Added juniversalchardet version 1.0.3
      - Added xmpcore version 5.1.2
      - Added xz version 1.0
      - Changed .classpaths, build.properties, and build.xml to correspond to above


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@40268 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-08-09 17:24:37 +00:00
parent 34232096c4
commit 45457901d4
3 changed files with 293 additions and 275 deletions

View File

@@ -31,7 +31,7 @@
<#list results as row> <#list results as row>
{ {
"type": "${row.item.typeShort}", "type": "${row.item.typeShort}",
"parentType": "${row.item.parentTypeShort}", "parentType": "${row.item.parentTypeShort!""}",
"isContainer": ${row.item.isContainer?string}, "isContainer": ${row.item.isContainer?string},
"name": "${row.item.properties.name!""}", "name": "${row.item.properties.name!""}",
"title": "${row.item.properties.title!""}", "title": "${row.item.properties.title!""}",

View File

@@ -1,273 +1,290 @@
/* /*
* Copyright (C) 2005-2010 Alfresco Software Limited. * Copyright (C) 2005-2012 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
* Alfresco is free software: you can redistribute it and/or modify * 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 * 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 * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.alfresco.repo.web.scripts.content; package org.alfresco.repo.web.scripts.content;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.alfresco.cmis.CMISFilterNotValidException; import org.alfresco.cmis.CMISFilterNotValidException;
import org.alfresco.cmis.CMISObjectReference; import org.alfresco.cmis.CMISObjectReference;
import org.alfresco.cmis.CMISRendition; import org.alfresco.cmis.CMISRendition;
import org.alfresco.cmis.CMISRenditionService; import org.alfresco.cmis.CMISRenditionService;
import org.alfresco.model.ApplicationModel; import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.cmis.reference.ReferenceFactory; import org.alfresco.repo.cmis.reference.ReferenceFactory;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.web.scripts.FileTypeImageUtils; import org.alfresco.repo.web.scripts.FileTypeImageUtils;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.FileTypeImageSize; import org.alfresco.service.cmr.repository.FileTypeImageSize;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest; import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse; import org.springframework.extensions.webscripts.WebScriptResponse;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.web.context.ServletContextAware; import org.springframework.web.context.ServletContextAware;
import org.springframework.web.context.support.ServletContextResource; import org.springframework.web.context.support.ServletContextResource;
/** /**
* Content Retrieval Service * Content Retrieval Service
* *
* Stream content from the Repository. * Stream content from the Repository.
* *
* @author davidc * @author davidc
*/ */
public class ContentGet extends StreamContent implements ServletContextAware public class ContentGet extends StreamContent implements ServletContextAware
{ {
// Logger // Logger
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static final Log logger = LogFactory.getLog(ContentGet.class); private static final Log logger = LogFactory.getLog(ContentGet.class);
// Component dependencies // Component dependencies
private ServletContext servletContext; private ServletContext servletContext;
private ReferenceFactory referenceFactory; private ReferenceFactory referenceFactory;
private DictionaryService dictionaryService; private DictionaryService dictionaryService;
private NamespaceService namespaceService; private NamespaceService namespaceService;
private CMISRenditionService renditionService; private CMISRenditionService renditionService;
/** /**
* @param * @param
*/ */
public void setServletContext(ServletContext servletContext) public void setServletContext(ServletContext servletContext)
{ {
this.servletContext = servletContext; this.servletContext = servletContext;
} }
/** /**
* @param reference factory * @param reference factory
*/ */
public void setReferenceFactory(ReferenceFactory referenceFactory) public void setReferenceFactory(ReferenceFactory referenceFactory)
{ {
this.referenceFactory = referenceFactory; this.referenceFactory = referenceFactory;
} }
/** /**
* @param dictionaryService * @param dictionaryService
*/ */
public void setDictionaryService(DictionaryService dictionaryService) public void setDictionaryService(DictionaryService dictionaryService)
{ {
this.dictionaryService = dictionaryService; this.dictionaryService = dictionaryService;
} }
/** /**
* @param namespaceService * @param namespaceService
*/ */
public void setNamespaceService(NamespaceService namespaceService) public void setNamespaceService(NamespaceService namespaceService)
{ {
this.namespaceService = namespaceService; this.namespaceService = namespaceService;
} }
/** /**
* @param renditionService * @param renditionService
*/ */
public void setCMISRenditionService(CMISRenditionService renditionService) public void setCMISRenditionService(CMISRenditionService renditionService)
{ {
this.renditionService = renditionService; this.renditionService = renditionService;
} }
/** /**
* @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse) * @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
*/ */
public void execute(WebScriptRequest req, WebScriptResponse res) public void execute(WebScriptRequest req, WebScriptResponse res)
throws IOException throws IOException
{ {
// create map of args // create map of args
String[] names = req.getParameterNames(); String[] names = req.getParameterNames();
Map<String, String> args = new HashMap<String, String>(names.length, 1.0f); Map<String, String> args = new HashMap<String, String>(names.length, 1.0f);
for (String name : names) for (String name : names)
{ {
args.put(name, req.getParameter(name)); args.put(name, req.getParameter(name));
} }
// create map of template vars // create map of template vars
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars(); Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
// create object reference from url // create object reference from url
CMISObjectReference reference = referenceFactory.createObjectReferenceFromUrl(args, templateVars); CMISObjectReference reference = referenceFactory.createObjectReferenceFromUrl(args, templateVars);
NodeRef nodeRef = reference.getNodeRef(); NodeRef nodeRef = reference.getNodeRef();
if (nodeRef == null) if (nodeRef == null)
{ {
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find " + reference.toString()); throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find " + reference.toString());
} }
// determine attachment // determine attachment
boolean attach = Boolean.valueOf(req.getParameter("a")); boolean attach = Boolean.valueOf(req.getParameter("a"));
// stream content on node, or rendition of node // stream content on node, or rendition of node
String streamId = req.getParameter("streamId"); String streamId = req.getParameter("streamId");
if (streamId != null && streamId.length() > 0) if (streamId != null && streamId.length() > 0)
{ {
// render content rendition // render content rendition
streamRendition(req, res, reference, streamId, attach); streamRendition(req, res, reference, streamId, attach);
} }
else else
{ {
// render content // render content
QName propertyQName = ContentModel.PROP_CONTENT; QName propertyQName = ContentModel.PROP_CONTENT;
String contentPart = templateVars.get("property"); String contentPart = templateVars.get("property");
if (contentPart.length() > 0 && contentPart.charAt(0) == ';') if (contentPart.length() > 0 && contentPart.charAt(0) == ';')
{ {
if (contentPart.length() < 2) if (contentPart.length() < 2)
{ {
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Content property malformed"); throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Content property malformed");
} }
String propertyName = contentPart.substring(1); String propertyName = contentPart.substring(1);
if (propertyName.length() > 0) if (propertyName.length() > 0)
{ {
propertyQName = QName.createQName(propertyName, namespaceService); propertyQName = QName.createQName(propertyName, namespaceService);
} }
} }
// Stream the content // Stream the content
streamContent(req, res, nodeRef, propertyQName, attach); streamContentLocal(req, res, nodeRef, attach, propertyQName);
} }
} }
/** private void streamContentLocal(WebScriptRequest req, WebScriptResponse res, NodeRef nodeRef, boolean attach, QName propertyQName) throws IOException
* Stream content rendition {
* String userAgent = req.getHeader("User-Agent");
* @param req
* @param res boolean rfc5987Supported = (null != userAgent) && (userAgent.contains("MSIE") || userAgent.contains(" Chrome/") || userAgent.contains(" FireFox/"));
* @param reference
* @param streamId if (attach && rfc5987Supported)
* @param attach {
* @throws IOException String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
*/ streamContent(req, res, nodeRef, propertyQName, attach, name);
private void streamRendition(WebScriptRequest req, WebScriptResponse res, CMISObjectReference reference, String streamId, boolean attach) }
throws IOException else
{ {
try streamContent(req, res, nodeRef, propertyQName, attach);
{ }
// find rendition }
CMISRendition rendition = null;
List<CMISRendition> renditions = renditionService.getRenditions(reference.getNodeRef(), "*"); /**
for (CMISRendition candidateRendition : renditions) * Stream content rendition
{ *
if (candidateRendition.getStreamId().equals(streamId)) * @param req
{ * @param res
rendition = candidateRendition; * @param reference
break; * @param streamId
} * @param attach
} * @throws IOException
if (rendition == null) */
{ private void streamRendition(WebScriptRequest req, WebScriptResponse res, CMISObjectReference reference, String streamId, boolean attach)
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find rendition " + streamId + " for " + reference.toString()); throws IOException
} {
try
// determine if special case for icons {
if (streamId.startsWith("alf:icon")) // find rendition
{ CMISRendition rendition = null;
streamIcon(res, reference, streamId, attach); List<CMISRendition> renditions = renditionService.getRenditions(reference.getNodeRef(), "*");
} for (CMISRendition candidateRendition : renditions)
else {
{ if (candidateRendition.getStreamId().equals(streamId))
streamContent(req, res, rendition.getNodeRef(), ContentModel.PROP_CONTENT, attach); {
} rendition = candidateRendition;
} break;
catch(CMISFilterNotValidException e) }
{ }
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Invalid Rendition Filter"); if (rendition == null)
} {
} throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find rendition " + streamId + " for " + reference.toString());
}
/**
* Stream Icon // determine if special case for icons
* if (streamId.startsWith("alf:icon"))
* @param res {
* @param reference streamIcon(res, reference, streamId, attach);
* @param streamId }
* @param attach else
* @throws IOException {
*/ streamContentLocal(req, res, reference.getNodeRef(), attach, ContentModel.PROP_CONTENT);
private void streamIcon(WebScriptResponse res, CMISObjectReference reference, String streamId, boolean attach) }
throws IOException }
{ catch(CMISFilterNotValidException e)
// convert stream id to icon size {
FileTypeImageSize imageSize = streamId.equals("alf:icon16") ? FileTypeImageSize.Small : FileTypeImageSize.Medium; throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Invalid Rendition Filter");
String iconSize = streamId.equals("alf:icon16") ? "-16" : ""; }
}
// calculate icon file name and path
String iconPath = null; /**
if (dictionaryService.isSubClass(nodeService.getType(reference.getNodeRef()), ContentModel.TYPE_CONTENT)) * Stream Icon
{ *
String name = (String)nodeService.getProperty(reference.getNodeRef(), ContentModel.PROP_NAME); * @param res
iconPath = FileTypeImageUtils.getFileTypeImage(servletContext, name, imageSize); * @param reference
} * @param streamId
else * @param attach
{ * @throws IOException
String icon = (String)nodeService.getProperty(reference.getNodeRef(), ApplicationModel.PROP_ICON); */
if (icon != null) private void streamIcon(WebScriptResponse res, CMISObjectReference reference, String streamId, boolean attach)
{ throws IOException
iconPath = "/images/icons/" + icon + iconSize + ".gif"; {
} // convert stream id to icon size
else FileTypeImageSize imageSize = streamId.equals("alf:icon16") ? FileTypeImageSize.Small : FileTypeImageSize.Medium;
{ String iconSize = streamId.equals("alf:icon16") ? "-16" : "";
iconPath = "/images/icons/space-icon-default" + iconSize + ".gif";
} // calculate icon file name and path
} String iconPath = null;
if (dictionaryService.isSubClass(nodeService.getType(reference.getNodeRef()), ContentModel.TYPE_CONTENT))
// set mimetype {
String mimetype = MimetypeMap.MIMETYPE_BINARY; String name = (String)nodeService.getProperty(reference.getNodeRef(), ContentModel.PROP_NAME);
int extIndex = iconPath.lastIndexOf('.'); iconPath = FileTypeImageUtils.getFileTypeImage(servletContext, name, imageSize);
if (extIndex != -1) }
{ else
String ext = iconPath.substring(extIndex + 1); {
mimetype = mimetypeService.getMimetype(ext); String icon = (String)nodeService.getProperty(reference.getNodeRef(), ApplicationModel.PROP_ICON);
} if (icon != null)
res.setContentType(mimetype); {
iconPath = "/images/icons/" + icon + iconSize + ".gif";
// stream icon }
ServletContextResource resource = new ServletContextResource(servletContext, iconPath); else
if (!resource.exists()) {
{ iconPath = "/images/icons/space-icon-default" + iconSize + ".gif";
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find rendition " + streamId + " for " + reference.toString()); }
} }
FileCopyUtils.copy(resource.getInputStream(), res.getOutputStream());
} // set mimetype
String mimetype = MimetypeMap.MIMETYPE_BINARY;
int extIndex = iconPath.lastIndexOf('.');
if (extIndex != -1)
{
String ext = iconPath.substring(extIndex + 1);
mimetype = mimetypeService.getMimetype(ext);
}
res.setContentType(mimetype);
// stream icon
ServletContextResource resource = new ServletContextResource(servletContext, iconPath);
if (!resource.exists())
{
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find rendition " + streamId + " for " + reference.toString());
}
FileCopyUtils.copy(resource.getInputStream(), res.getOutputStream());
}
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2011 Alfresco Software Limited. * Copyright (C) 2005-2012 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletResponse;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.content.filestore.FileContentReader; import org.alfresco.repo.content.filestore.FileContentReader;
import org.alfresco.repo.webdav.WebDAVHelper;
import org.alfresco.service.cmr.repository.ContentIOException; import org.alfresco.service.cmr.repository.ContentIOException;
import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentService;
@@ -804,7 +805,7 @@ public class StreamContent extends AbstractWebScript implements ResourceLoaderAw
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Attaching content using filename: " + attachFileName); logger.debug("Attaching content using filename: " + attachFileName);
headerValue += "; filename=" + attachFileName; headerValue += "; filename*=UTF-8''" + WebDAVHelper.encodeURL(attachFileName) + "; filename=\"" + attachFileName + "\"";
} }
// set header based on filename - will force a Save As from the browse if it doesn't recognize it // set header based on filename - will force a Save As from the browse if it doesn't recognize it