mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
MOB-690 - WCM PreviewURIService - checkpoint
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14642 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1073,6 +1073,7 @@ website_details=Web Project Details
|
||||
create_website_step1_title=Step One - Web Project Details
|
||||
create_website_step1_desc=Enter the information about the web project.
|
||||
website_dnsname=DNS name
|
||||
website_preview_provider=Preview Provider
|
||||
validation_invalid_dns_name=Invalid website DNS name: only alpha-numeric and non-initial/final hyphen characters are allowed (max length < 64).
|
||||
website_webapp=Default Webapp
|
||||
website_createfrom=Create From Existing Web Project
|
||||
|
@@ -649,6 +649,8 @@
|
||||
<property-sheet>
|
||||
<show-property name="wca:avmstore" read-only="true" />
|
||||
<show-property name="wca:defaultwebapp" read-only="true" />
|
||||
<show-property name="wca:issource" component-generator="CheckboxGenerator" read-only="true"/>
|
||||
<show-property name="wca:previewprovidername" read-only="true" />
|
||||
<show-property name="app:icon" show-in-view-mode="false" show-in-edit-mode="false" />
|
||||
</property-sheet>
|
||||
</config>
|
||||
|
@@ -35,15 +35,14 @@ import org.alfresco.config.ConfigService;
|
||||
import org.alfresco.config.JNDIConstants;
|
||||
import org.alfresco.mbeans.VirtServerRegistry;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.wcm.util.WCMUtil;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.wcm.preview.PreviewURIService;
|
||||
import org.alfresco.web.bean.wcm.preview.VirtualisationServerPreviewURIService;
|
||||
import org.alfresco.web.config.ClientConfigElement;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.jsf.FacesContextUtils;
|
||||
|
||||
@@ -57,6 +56,8 @@ import org.springframework.web.jsf.FacesContextUtils;
|
||||
*/
|
||||
public final class AVMUtil extends WCMUtil
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(AVMUtil.class);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static enum PathRelation
|
||||
@@ -270,14 +271,6 @@ public final class AVMUtil extends WCMUtil
|
||||
return WCMUtil.buildStoreWebappPath(storeName, webapp);
|
||||
}
|
||||
|
||||
public static String buildStoreUrl(String store)
|
||||
{
|
||||
ServiceRegistry serviceRegistry = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
|
||||
AVMService avmService = serviceRegistry.getAVMService();
|
||||
ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
|
||||
return WCMUtil.buildStoreUrl(avmService, store, config.getWCMDomain(), config.getWCMPort());
|
||||
}
|
||||
|
||||
public static String buildWebappUrl(final String avmPath)
|
||||
{
|
||||
if (avmPath == null || avmPath.length() == 0)
|
||||
@@ -295,30 +288,8 @@ public final class AVMUtil extends WCMUtil
|
||||
throw new IllegalArgumentException("Webapp name is mandatory.");
|
||||
}
|
||||
return (webapp.equals(DIR_ROOT)
|
||||
? buildStoreUrl(store)
|
||||
: buildStoreUrl(store) + '/' + webapp);
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTE: do not call directly from client - use getPreviewURI instead
|
||||
*/
|
||||
public static String buildAssetUrl(String store, String assetPath)
|
||||
{
|
||||
if (store == null || store.length() == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("Store name is mandatory.");
|
||||
}
|
||||
if (assetPath == null || assetPath.length() == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("Asset path is mandatory.");
|
||||
}
|
||||
ClientConfigElement config = Application.getClientConfig(FacesContext.getCurrentInstance());
|
||||
return buildAssetUrl(assetPath, config.getWCMDomain(), config.getWCMPort(), lookupStoreDNS(store));
|
||||
}
|
||||
|
||||
public static String buildAssetUrl(String assetPath, String domain, String port, String dns)
|
||||
{
|
||||
return WCMUtil.buildAssetUrl(assetPath, domain, port, dns);
|
||||
? getPreviewURI(store)
|
||||
: getPreviewURI(store) + '/' + webapp);
|
||||
}
|
||||
|
||||
public static String getPreviewURI(String storeNameOrAvmPath)
|
||||
@@ -327,48 +298,47 @@ public final class AVMUtil extends WCMUtil
|
||||
{
|
||||
throw new IllegalArgumentException("AVM store name or absolute path is mandatory.");
|
||||
}
|
||||
final String[] s = storeNameOrAvmPath.split(AVM_STORE_SEPARATOR);
|
||||
final String[] s = storeNameOrAvmPath.split(WCMUtil.AVM_STORE_SEPARATOR);
|
||||
if (s.length == 1)
|
||||
{
|
||||
return AVMUtil.getPreviewURI(s[0], null);
|
||||
return getPreviewURI(s[0], null);
|
||||
}
|
||||
if (s.length != 2)
|
||||
{
|
||||
throw new IllegalArgumentException("expected exactly one ':' in " + storeNameOrAvmPath);
|
||||
}
|
||||
return AVMUtil.getPreviewURI(s[0], s[1]);
|
||||
return getPreviewURI(s[0], s[1]);
|
||||
}
|
||||
|
||||
public static String getPreviewURI(final String storeId, final String assetPath)
|
||||
public static String getPreviewURI(String storeId, String assetPath)
|
||||
{
|
||||
if (previewURIGenerator == null)
|
||||
if (! deprecatedPreviewURIGeneratorChecked)
|
||||
{
|
||||
if (deprecatedPreviewURIGenerator == null)
|
||||
{
|
||||
// backwards compatibility - will hide new implementation, until custom providers/context are migrated
|
||||
WebApplicationContext wac = FacesContextUtils.getRequiredWebApplicationContext(
|
||||
FacesContext.getCurrentInstance());
|
||||
|
||||
if (wac.containsBean(SPRING_BEAN_NAME_PREVIEW_URI_SERVICE))
|
||||
{
|
||||
// if the bean is present retrieve it
|
||||
previewURIGenerator = (PreviewURIService)wac.getBean(SPRING_BEAN_NAME_PREVIEW_URI_SERVICE,
|
||||
deprecatedPreviewURIGenerator = (PreviewURIService)wac.getBean(SPRING_BEAN_NAME_PREVIEW_URI_SERVICE,
|
||||
PreviewURIService.class);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Backwards compatibility - if the new Spring bean doesn't exist, default to the
|
||||
// existing behaviour (create a URL to the virtualisation server).
|
||||
previewURIGenerator = new VirtualisationServerPreviewURIService();
|
||||
|
||||
logger.warn("Found deprecated '"+SPRING_BEAN_NAME_PREVIEW_URI_SERVICE+"' config - which will be used instead of new 'WCMPreviewURIService' until migrated (changing web project preview provider will have no effect)");
|
||||
}
|
||||
}
|
||||
|
||||
return previewURIGenerator.getPreviewURI(storeId, assetPath);
|
||||
deprecatedPreviewURIGeneratorChecked = true;
|
||||
}
|
||||
|
||||
public static String lookupStoreDNS(String store)
|
||||
if (deprecatedPreviewURIGenerator != null)
|
||||
{
|
||||
final ServiceRegistry serviceRegistry =
|
||||
Repository.getServiceRegistry(FacesContext.getCurrentInstance());
|
||||
final AVMService avmService = serviceRegistry.getAVMService();
|
||||
return WCMUtil.lookupStoreDNS(avmService, store);
|
||||
return deprecatedPreviewURIGenerator.getPreviewURI(storeId, assetPath);
|
||||
}
|
||||
|
||||
return getPreviewURIService().getPreviewURI(storeId, assetPath);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,9 +413,7 @@ public final class AVMUtil extends WCMUtil
|
||||
*/
|
||||
public static void makeAllDirectories(final String avmDirectoryPath)
|
||||
{
|
||||
final ServiceRegistry serviceRegistry =
|
||||
Repository.getServiceRegistry(FacesContext.getCurrentInstance());
|
||||
final AVMService avmService = serviceRegistry.getAVMService();
|
||||
final AVMService avmService = getAVMService();
|
||||
// LOGGER.debug("mkdir -p " + avmDirectoryPath);
|
||||
String s = avmDirectoryPath;
|
||||
final Stack<String[]> dirNames = new Stack<String[]>();
|
||||
@@ -496,6 +464,16 @@ public final class AVMUtil extends WCMUtil
|
||||
return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVirtServerRegistry();
|
||||
}
|
||||
|
||||
private static AVMService getAVMService()
|
||||
{
|
||||
return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMService();
|
||||
}
|
||||
|
||||
private static org.alfresco.wcm.preview.PreviewURIService getPreviewURIService()
|
||||
{
|
||||
return Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPreviewURIService();
|
||||
}
|
||||
|
||||
private static ConfigElement getDeploymentConfig()
|
||||
{
|
||||
if ((deploymentConfig == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
|
||||
@@ -541,6 +519,8 @@ public final class AVMUtil extends WCMUtil
|
||||
private static ConfigElement deploymentConfig = null;
|
||||
private static ConfigElement linksManagementConfig = null;
|
||||
|
||||
// deprecated
|
||||
private final static String SPRING_BEAN_NAME_PREVIEW_URI_SERVICE = "PreviewURIService";
|
||||
private static PreviewURIService previewURIGenerator = null;
|
||||
private static PreviewURIService deprecatedPreviewURIGenerator = null;
|
||||
private static boolean deprecatedPreviewURIGeneratorChecked = false;
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -31,6 +31,7 @@ import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.event.ActionEvent;
|
||||
@@ -50,8 +51,10 @@ import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.util.ExpiringValueCache;
|
||||
import org.alfresco.wcm.preview.PreviewURIService;
|
||||
import org.alfresco.wcm.util.WCMUtil;
|
||||
import org.alfresco.wcm.webproject.WebProjectInfo;
|
||||
import org.alfresco.wcm.webproject.WebProjectInfoImpl;
|
||||
import org.alfresco.wcm.webproject.WebProjectService;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
@@ -112,19 +115,21 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
protected String webapp = WEBAPP_DEFAULT;
|
||||
protected String createFrom = null;
|
||||
protected boolean isSource;
|
||||
protected String previewProvider;
|
||||
protected NodeRef wpNodeRef;
|
||||
|
||||
protected String[] sourceWebProject = null;
|
||||
protected ExpiringValueCache<List<UIListItem>> webProjectsList;
|
||||
protected List<SelectItem> webappsList;
|
||||
protected List<SelectItem> previewProvidersList;
|
||||
protected boolean showAllSourceProjects;
|
||||
protected String websiteDescriptionAttribute;
|
||||
|
||||
transient private WorkflowService workflowService;
|
||||
transient private PersonService personService;
|
||||
transient private FormsService formsService;
|
||||
|
||||
transient private WebProjectService wpService;
|
||||
transient private PreviewURIService previewURIService;
|
||||
|
||||
/** set true when an option in the Create From screen is changed - this is used as an
|
||||
indicator to reload the wizard data model from the selected source web project */
|
||||
@@ -183,6 +188,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.sourceWebProject = null;
|
||||
this.createFromValueChanged = false;
|
||||
this.showAllSourceProjects = false;
|
||||
this.websiteDescriptionAttribute = null;
|
||||
}
|
||||
|
||||
private void clearFormsWorkflowsDeploymentAndUsers()
|
||||
@@ -222,7 +228,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
sourceNodeRef = new NodeRef(this.sourceWebProject[0]);
|
||||
}
|
||||
|
||||
WebProjectInfo wpInfo = getWebProjectService().createWebProject(this.dnsName, this.name, this.title, this.description, this.webapp, this.isSource, sourceNodeRef);
|
||||
WebProjectInfo wpInfo = getWebProjectService().createWebProject(new WebProjectInfoImpl(this.dnsName, this.name, this.title, this.description, this.webapp, this.isSource, sourceNodeRef, this.previewProvider));
|
||||
|
||||
String avmStore = wpInfo.getStoreId();
|
||||
NodeRef wpNodeRef = wpInfo.getNodeRef();
|
||||
@@ -406,6 +412,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.webapp = wpInfo.getDefaultWebApp();
|
||||
this.isSource = wpInfo.isTemplate();
|
||||
this.wpNodeRef = wpInfo.getNodeRef();
|
||||
this.previewProvider = wpInfo.getPreviewProviderName();
|
||||
}
|
||||
|
||||
if (loadUsers)
|
||||
@@ -593,11 +600,28 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
if (wpService == null)
|
||||
{
|
||||
wpService = (WebProjectService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "WebProjectService");
|
||||
wpService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getWebProjectService();
|
||||
}
|
||||
return wpService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param previewURIService The PreviewURIService to set.
|
||||
*/
|
||||
public void setPreviewURIService(final PreviewURIService previewURIService)
|
||||
{
|
||||
this.previewURIService = previewURIService;
|
||||
}
|
||||
|
||||
protected PreviewURIService getPreviewURIService()
|
||||
{
|
||||
if (previewURIService == null)
|
||||
{
|
||||
previewURIService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPreviewURIService();
|
||||
}
|
||||
return previewURIService;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean getters and setters
|
||||
|
||||
@@ -705,6 +729,16 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.webapp = webapp;
|
||||
}
|
||||
|
||||
public String getPreviewProvider()
|
||||
{
|
||||
return this.previewProvider;
|
||||
}
|
||||
|
||||
public void setPreviewProvider(String previewProvider)
|
||||
{
|
||||
this.previewProvider = previewProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the create from selection value
|
||||
*/
|
||||
@@ -852,6 +886,31 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
return this.webappsList;
|
||||
}
|
||||
|
||||
public List<SelectItem> getPreviewProvidersList()
|
||||
{
|
||||
if (this.previewProvidersList == null)
|
||||
{
|
||||
// create list of preview providers
|
||||
|
||||
String defaultPreviewProvider = getPreviewURIService().getDefaultProviderName();
|
||||
Set<String> previewProviders = getPreviewURIService().getProviderNames();
|
||||
|
||||
this.previewProvidersList = new ArrayList<SelectItem>(previewProviders.size());
|
||||
|
||||
this.previewProvidersList.add(new SelectItem(defaultPreviewProvider, defaultPreviewProvider));
|
||||
|
||||
for (String previewProvider : previewProviders)
|
||||
{
|
||||
if (! previewProvider.equals(defaultPreviewProvider))
|
||||
{
|
||||
this.previewProvidersList.add(new SelectItem(previewProvider, previewProvider));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.previewProvidersList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wizard.BaseWizardBean#next()
|
||||
*/
|
||||
@@ -1387,6 +1446,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "title", getTitle()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description",
|
||||
DescriptionAttributeHelper.getDescriptionNotEmpty(fc, getDescription()), false));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "website_preview_provider", getPreviewProvider()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableEnd());
|
||||
return attribute.toString();
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -31,7 +31,6 @@ import java.util.Map;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.model.SelectItem;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -117,6 +116,7 @@ public class EditWebsiteWizard extends CreateWebsiteWizard
|
||||
wpInfo.setTitle(this.title);
|
||||
wpInfo.setDescription(this.description);
|
||||
wpInfo.setIsTemplate(this.isSource);
|
||||
wpInfo.setPreviewProviderName(this.previewProvider);
|
||||
|
||||
getWebProjectService().updateWebProject(wpInfo);
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -25,22 +25,19 @@
|
||||
|
||||
package org.alfresco.web.bean.wcm.preview;
|
||||
|
||||
|
||||
/**
|
||||
* A PreviewURIService that always returns null (no preview URI).
|
||||
*
|
||||
* @author Peter Monks (peter.monks@alfresco.com)
|
||||
* @version $Id$
|
||||
*
|
||||
* @since 2.2.1
|
||||
*
|
||||
* @deprecated see org.alfresco.web.bean.wcm.preview.NullPreviewURIService
|
||||
*/
|
||||
public class NullPreviewURIService
|
||||
implements PreviewURIService
|
||||
public class NullPreviewURIService extends org.alfresco.wcm.preview.NullPreviewURIService implements PreviewURIService
|
||||
{
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public String getPreviewURI(final String storeId, final String webapp)
|
||||
{
|
||||
return(null);
|
||||
return super.getPreviewURI(storeId, webapp, null);
|
||||
}
|
||||
|
||||
}
|
@@ -30,7 +30,10 @@ package org.alfresco.web.bean.wcm.preview;
|
||||
* Abstraction for generating preview URLs.
|
||||
*
|
||||
* @author Peter Monks (peter.monks@alfresco.com)
|
||||
* @version $Id$
|
||||
*
|
||||
* @since 2.2.1
|
||||
*
|
||||
* @deprecated see org.alfresco.wcm.preview.PreviewURIServiceProvider
|
||||
*/
|
||||
public interface PreviewURIService
|
||||
{
|
||||
|
@@ -40,10 +40,12 @@ import org.alfresco.util.Pair;
|
||||
* is being generated for.
|
||||
*
|
||||
* @author Peter Monks (peter.monks@alfresco.com)
|
||||
* @version $Id$
|
||||
*
|
||||
* @since 2.2.1
|
||||
*
|
||||
* @deprecated see org.alfresco.wcm.preview.*
|
||||
*/
|
||||
public class StoreSpecificPreviewURIService
|
||||
implements PreviewURIService
|
||||
public class StoreSpecificPreviewURIService implements PreviewURIService
|
||||
{
|
||||
private final List<Pair<Pattern, PreviewURIService>> storeURIGenerators;
|
||||
private final PreviewURIService fallback;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -34,18 +34,13 @@ package org.alfresco.web.bean.wcm.preview;
|
||||
* </ul>
|
||||
*
|
||||
* @author Peter Monks (peter.monks@alfresco.com)
|
||||
* @version $Id$
|
||||
*
|
||||
* @since 2.2.1
|
||||
*
|
||||
* @deprecated see org.alfresco.wcm.preview.URITemplatePreviewURIService
|
||||
*/
|
||||
public class URITemplatePreviewURIService
|
||||
implements PreviewURIService
|
||||
public class URITemplatePreviewURIService extends org.alfresco.wcm.preview.URITemplatePreviewURIService implements PreviewURIService
|
||||
{
|
||||
private final static String URI_TEMPLATE_PARAMETER_STORE_ID = "{storeId}";
|
||||
private final static String URI_TEMPLATE_PARAMETER_PATH_TO_ASSET = "{pathToAsset}";
|
||||
|
||||
|
||||
private final String uriTemplate;
|
||||
|
||||
|
||||
public URITemplatePreviewURIService(final String uriTemplate)
|
||||
{
|
||||
// PRECONDITIONS
|
||||
@@ -55,40 +50,8 @@ public class URITemplatePreviewURIService
|
||||
this.uriTemplate = uriTemplate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public String getPreviewURI(final String storeId, final String pathToAsset)
|
||||
public String getPreviewURI(final String storeId, final String webapp)
|
||||
{
|
||||
String result = uriTemplate;
|
||||
|
||||
if (uriTemplate.contains(URI_TEMPLATE_PARAMETER_STORE_ID))
|
||||
{
|
||||
if (storeId != null && storeId.trim().length() > 0)
|
||||
{
|
||||
result = result.replace(URI_TEMPLATE_PARAMETER_STORE_ID, storeId);
|
||||
return super.getPreviewURI(storeId, webapp, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Shouldn't ever happen (store ids are always provided), but better to be safe than sorry
|
||||
result = result.replace(URI_TEMPLATE_PARAMETER_STORE_ID, "");
|
||||
}
|
||||
}
|
||||
|
||||
if (uriTemplate.contains(URI_TEMPLATE_PARAMETER_PATH_TO_ASSET))
|
||||
{
|
||||
if (pathToAsset != null && pathToAsset.trim().length() > 0)
|
||||
{
|
||||
result = result.replace(URI_TEMPLATE_PARAMETER_PATH_TO_ASSET, pathToAsset);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = result.replace(URI_TEMPLATE_PARAMETER_PATH_TO_ASSET, "");
|
||||
}
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,37 +25,34 @@
|
||||
|
||||
package org.alfresco.web.bean.wcm.preview;
|
||||
|
||||
import org.alfresco.config.JNDIConstants;
|
||||
import org.alfresco.web.bean.wcm.AVMUtil;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
|
||||
|
||||
/**
|
||||
* A PreviewURIService that constructs a virtualisation server URI.
|
||||
*
|
||||
* @author Peter Monks (peter.monks@alfresco.com)
|
||||
* @version $Id$
|
||||
*
|
||||
* @since 2.2.1
|
||||
*
|
||||
* @deprecated see org.alfresco.wcm.preview.VirtualisationServerPreviewURIService
|
||||
*/
|
||||
public class VirtualisationServerPreviewURIService
|
||||
implements PreviewURIService
|
||||
public class VirtualisationServerPreviewURIService extends org.alfresco.wcm.preview.VirtualisationServerPreviewURIService implements PreviewURIService
|
||||
{
|
||||
/**
|
||||
* @see org.alfresco.web.bean.wcm.preview.PreviewURIService#getPreviewURI(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public String getPreviewURI(final String storeId, final String pathToAsset)
|
||||
public String getPreviewURI(final String sbStoreId, final String pathToAsset)
|
||||
{
|
||||
if ((pathToAsset == null) || (pathToAsset.length() == 0))
|
||||
{
|
||||
return AVMUtil.buildStoreUrl(storeId);
|
||||
}
|
||||
ServiceRegistry serviceRegistry = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
|
||||
|
||||
// Sanity checking
|
||||
if (!pathToAsset.startsWith('/' + JNDIConstants.DIR_DEFAULT_WWW + '/' + JNDIConstants.DIR_DEFAULT_APPBASE))
|
||||
{
|
||||
throw new IllegalStateException("Invalid asset path in AVM node ref: " + storeId + ":" + pathToAsset);
|
||||
}
|
||||
this.setAvmService(serviceRegistry.getAVMService());
|
||||
this.setVirtServerRegistry(serviceRegistry.getVirtServerRegistry());
|
||||
|
||||
return AVMUtil.buildAssetUrl(storeId, pathToAsset);
|
||||
return super.getPreviewURI(sbStoreId, pathToAsset, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@@ -377,7 +377,7 @@ public class RenderingEngineTemplateImpl
|
||||
final String formInstanceDataAvmPath = formInstanceData.getPath();
|
||||
final String renditionAvmPath = rendition.getPath();
|
||||
final String parentPath = AVMNodeConverter.SplitBase(formInstanceDataAvmPath)[0];
|
||||
final String sandboxUrl = AVMUtil.buildStoreUrl(AVMUtil.getStoreName(formInstanceDataAvmPath));
|
||||
final String sandboxUrl = AVMUtil.getPreviewURI(AVMUtil.getStoreName(formInstanceDataAvmPath));
|
||||
final String webappUrl = AVMUtil.buildWebappUrl(formInstanceDataAvmPath);
|
||||
final HashMap<QName, Object> model = new HashMap<QName, Object>();
|
||||
// add simple scalar parameters
|
||||
|
@@ -185,5 +185,20 @@
|
||||
<f:verbatim>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
</f:verbatim>
|
||||
<h:outputText value="#{msg.website_preview_provider}:"/>
|
||||
<f:verbatim>
|
||||
</td>
|
||||
<td>
|
||||
</f:verbatim>
|
||||
<h:selectOneMenu id="previewprovider" value="#{WizardManager.bean.previewProvider}">
|
||||
<f:selectItems value="#{WizardManager.bean.previewProvidersList}" />
|
||||
</h:selectOneMenu>
|
||||
<f:verbatim>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</f:verbatim>
|
||||
|
Reference in New Issue
Block a user