Unfortunately quite a large update, combined BaseDispatcher and DispatcherServlet into a modern, standard compliant CCMDispatcherServlet, modified various classes to enable CCM installed in any arbitrary context, not just ROOT. Part 1. Currently it works for ScientificCMS only, for other bundles StylesheetPaths.txt has to be modified.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2557 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
c21769dfc8
commit
13b7c7cf2e
|
|
@ -131,7 +131,7 @@ public class SiteProxyGenerator extends AtoZGeneratorAbstractImpl {
|
||||||
ParameterMap map = new ParameterMap();
|
ParameterMap map = new ParameterMap();
|
||||||
map.setParameter("oid", m_oid.toString());
|
map.setParameter("oid", m_oid.toString());
|
||||||
|
|
||||||
URL here = Web.getContext().getRequestURL();
|
URL here = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
return (new URL(here.getScheme(), here.getServerName(), here
|
return (new URL(here.getScheme(), here.getServerName(), here
|
||||||
.getServerPort(), "", "", "/redirect/", map)).toString();
|
.getServerPort(), "", "", "/redirect/", map)).toString();
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ public class CategoryGenerator extends AtoZGeneratorAbstractImpl {
|
||||||
ParameterMap map = new ParameterMap();
|
ParameterMap map = new ParameterMap();
|
||||||
map.setParameter("oid", m_oid.toString());
|
map.setParameter("oid", m_oid.toString());
|
||||||
|
|
||||||
URL here = Web.getContext().getRequestURL();
|
URL here = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
return (new URL(here.getScheme(), here.getServerName(), here
|
return (new URL(here.getScheme(), here.getServerName(), here
|
||||||
.getServerPort(), "", "", "/redirect/", map)).toString();
|
.getServerPort(), "", "", "/redirect/", map)).toString();
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ public class ItemGenerator extends AtoZGeneratorAbstractImpl {
|
||||||
ParameterMap map = new ParameterMap();
|
ParameterMap map = new ParameterMap();
|
||||||
map.setParameter("oid", m_oid.toString());
|
map.setParameter("oid", m_oid.toString());
|
||||||
|
|
||||||
URL here = Web.getContext().getRequestURL();
|
URL here = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
return (new URL(here.getScheme(), here.getServerName(), here
|
return (new URL(here.getScheme(), here.getServerName(), here
|
||||||
.getServerPort(), "", "", "/redirect/", map)).toString();
|
.getServerPort(), "", "", "/redirect/", map)).toString();
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@ public class BookmarkEditPane extends DynamicListWizard {
|
||||||
public Component getComponent(List list, PageState state,
|
public Component getComponent(List list, PageState state,
|
||||||
Object value, String key, int index, boolean isSelected) {
|
Object value, String key, int index, boolean isSelected) {
|
||||||
|
|
||||||
Bookmarks app = (Bookmarks) Web.getContext()
|
Bookmarks app = (Bookmarks) Web.getWebContext()
|
||||||
.getApplication();
|
.getApplication();
|
||||||
BookmarkCollection bColl = app.getBookmarks();
|
BookmarkCollection bColl = app.getBookmarks();
|
||||||
final long size = bColl.size();
|
final long size = bColl.size();
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ public class BookmarkPortlet extends AppPortlet {
|
||||||
if (!PermissionService.checkPermission(
|
if (!PermissionService.checkPermission(
|
||||||
new PermissionDescriptor(PrivilegeDescriptor.READ,
|
new PermissionDescriptor(PrivilegeDescriptor.READ,
|
||||||
app,
|
app,
|
||||||
Web.getContext().getUser()))) {
|
Web.getWebContext().getUser()))) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (URL.getDispatcherPath() + app.getPrimaryURL());
|
return (URL.getDispatcherPath() + app.getPrimaryURL());
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@ public class SimplePage extends com.arsdigita.ui.SimplePage {
|
||||||
* Two xml attributes are added in addition to the bebop standard
|
* Two xml attributes are added in addition to the bebop standard
|
||||||
* implementation.
|
* implementation.
|
||||||
*/
|
*/
|
||||||
if (Web.getContext().getRequestURL() != null) {
|
if (Web.getWebContext().getRequestURL() != null) {
|
||||||
page.addAttribute("url", Web.getContext().getRequestURL().toString());
|
page.addAttribute("url", Web.getWebContext().getRequestURL().toString());
|
||||||
|
|
||||||
page.addAttribute("textOnly", "/text".equals(
|
page.addAttribute("textOnly", "/text".equals(
|
||||||
DispatcherHelper
|
DispatcherHelper
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
generateXMLBody(fake, element, c);
|
generateXMLBody(fake, element, c);
|
||||||
String action = form.getAction();
|
String action = form.getAction();
|
||||||
if (action == null) {
|
if (action == null) {
|
||||||
final URL requestURL = Web.getContext().getRequestURL();
|
final URL requestURL = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
if (requestURL == null) {
|
if (requestURL == null) {
|
||||||
action = state.getRequest().getRequestURI();
|
action = state.getRequest().getRequestURI();
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ public class FormSectionItem extends ContentPage
|
||||||
|
|
||||||
String action = c.getAction();
|
String action = c.getAction();
|
||||||
if (action == null) {
|
if (action == null) {
|
||||||
final URL requestURL = Web.getContext().getRequestURL();
|
final URL requestURL = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
if (requestURL == null) {
|
if (requestURL == null) {
|
||||||
action = state.getRequest().getRequestURI();
|
action = state.getRequest().getRequestURI();
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ public class SurveyXMLGenerator extends SimpleXMLGenerator {
|
||||||
|
|
||||||
String action = pForm.getAction();
|
String action = pForm.getAction();
|
||||||
if (action == null) {
|
if (action == null) {
|
||||||
final URL requestURL = Web.getContext().getRequestURL();
|
final URL requestURL = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
if (requestURL == null) {
|
if (requestURL == null) {
|
||||||
action = state.getRequest().getRequestURI();
|
action = state.getRequest().getRequestURI();
|
||||||
|
|
|
||||||
|
|
@ -60,12 +60,9 @@ public abstract class CMS {
|
||||||
return s_initialContext;
|
return s_initialContext;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private static final CMSConfig s_config = new CMSConfig();
|
|
||||||
static {
|
/** Config object containing various parameter */
|
||||||
s_log.debug("Static initializer starting...");
|
private static final CMSConfig s_config = CMSConfig.getInstanceOf();
|
||||||
s_config.load();
|
|
||||||
s_log.debug("Static initializer finished.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
*
|
*
|
||||||
* @return The <code>CMSConfig</code> record; it cannot be null
|
* @return The <code>CMSConfig</code> record; it cannot be null
|
||||||
*/
|
*/
|
||||||
public static synchronized CMSConfig getInstance() {
|
public static synchronized CMSConfig getInstanceOf() {
|
||||||
if (s_config == null) {
|
if (s_config == null) {
|
||||||
s_config = new CMSConfig();
|
s_config = new CMSConfig();
|
||||||
s_config.load();
|
s_config.load();
|
||||||
|
|
@ -668,6 +668,8 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
// Moved to publishToFile.PublishToFileConfig as of version 6.0.2
|
// Moved to publishToFile.PublishToFileConfig as of version 6.0.2
|
||||||
// private final Parameter m_disableItemPfs;
|
// private final Parameter m_disableItemPfs;
|
||||||
// private final Parameter m_publishToFileClass;
|
// private final Parameter m_publishToFileClass;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor, but do NOT instantiate this class directly.
|
* Constructor, but do NOT instantiate this class directly.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ public class ContentBundle extends ContentItem {
|
||||||
s_log.debug("Item id is: " + instance.getID());
|
s_log.debug("Item id is: " + instance.getID());
|
||||||
final Workflow workflow = template.instantiateNewWorkflow();
|
final Workflow workflow = template.instantiateNewWorkflow();
|
||||||
workflow.setObjectID(instance.getID());
|
workflow.setObjectID(instance.getID());
|
||||||
workflow.start(Web.getContext().getUser());
|
workflow.start(Web.getWebContext().getUser());
|
||||||
workflow.save();
|
workflow.save();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ public class ContentCenterServlet extends BaseApplicationServlet {
|
||||||
// ContentCenter workspace = (ContentCenter) app;
|
// ContentCenter workspace = (ContentCenter) app;
|
||||||
|
|
||||||
/* Check user and privilegies */
|
/* Check user and privilegies */
|
||||||
if (Web.getContext().getUser() == null) { // user not logged in
|
if (Web.getWebContext().getUser() == null) { // user not logged in
|
||||||
throw new LoginSignal(sreq); // send to login page
|
throw new LoginSignal(sreq); // send to login page
|
||||||
}
|
}
|
||||||
// Check whether logged in user has access to at least one content section
|
// Check whether logged in user has access to at least one content section
|
||||||
|
|
|
||||||
|
|
@ -1330,7 +1330,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
|
||||||
Assert.isTrue(isLive(), "Attempt to republish non live item " + getOID());
|
Assert.isTrue(isLive(), "Attempt to republish non live item " + getOID());
|
||||||
|
|
||||||
//ToDo Remove item from cache
|
//ToDo Remove item from cache
|
||||||
if (CMSConfig.getInstance().getEnableXmlCache()) {
|
if (CMSConfig.getInstanceOf().getEnableXmlCache()) {
|
||||||
XMLDeliveryCache.getInstance().removeFromCache(getOID());
|
XMLDeliveryCache.getInstance().removeFromCache(getOID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1974,7 +1974,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*final AssociationCopierLoader assocCopierLoader =
|
/*final AssociationCopierLoader assocCopierLoader =
|
||||||
AssociationCopierLoader.getInstance();
|
AssociationCopierLoader.getInstanceOf();
|
||||||
final AssociationCopier assocCopier = assocCopierLoader.
|
final AssociationCopier assocCopier = assocCopierLoader.
|
||||||
getAssociationCopierFor(property, source);
|
getAssociationCopierFor(property, source);
|
||||||
if (assocCopier != null) {
|
if (assocCopier != null) {
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ public class ContentSection extends Application {
|
||||||
private final static String ITEM_QUERY = "com.arsdigita.cms.ItemsInSection";
|
private final static String ITEM_QUERY = "com.arsdigita.cms.ItemsInSection";
|
||||||
private final static String SECTION_ID = "sectionId";
|
private final static String SECTION_ID = "sectionId";
|
||||||
|
|
||||||
private static final CMSConfig s_config = CMSConfig.getInstance();
|
private static final CMSConfig s_config = CMSConfig.getInstanceOf();
|
||||||
/* DO NOT use CMSConfig constructor to instantiate !
|
/* DO NOT use CMSConfig constructor to instantiate !
|
||||||
private static final CMSConfig s_config = new CMSConfig();
|
private static final CMSConfig s_config = new CMSConfig();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,9 @@ public class ContentSectionServlet extends BaseApplicationServlet {
|
||||||
sreq = DispatcherHelper.restoreOriginalRequest(sreq);
|
sreq = DispatcherHelper.restoreOriginalRequest(sreq);
|
||||||
rd.forward(sreq, sresp);
|
rd.forward(sreq, sresp);
|
||||||
} else {
|
} else {
|
||||||
// sresp.sendError(404, packageURL + " not found on this server.");
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.debug("No dispatcher found for" + rd);
|
||||||
|
}
|
||||||
String requestUri = sreq.getRequestURI(); // same as ctx.getRemainingURLPart()
|
String requestUri = sreq.getRequestURI(); // same as ctx.getRemainingURLPart()
|
||||||
sresp.sendError(404, requestUri + " not found on this server.");
|
sresp.sendError(404, requestUri + " not found on this server.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ public class CustomizableContentItemXMLRenderer
|
||||||
//Build paginator
|
//Build paginator
|
||||||
|
|
||||||
//Get pageNumber from request URL
|
//Get pageNumber from request URL
|
||||||
URL requestUrl = Web.getContext().getRequestURL();
|
URL requestUrl = Web.getWebContext().getRequestURL();
|
||||||
String pageNumberValue = requestUrl.getParameter("pageNumber");
|
String pageNumberValue = requestUrl.getParameter("pageNumber");
|
||||||
long pageNumber;
|
long pageNumber;
|
||||||
if (pageNumberValue == null) {
|
if (pageNumberValue == null) {
|
||||||
|
|
|
||||||
|
|
@ -493,7 +493,7 @@ class DomainCopier extends DomainService {
|
||||||
* @param dobj
|
* @param dobj
|
||||||
*/
|
*/
|
||||||
private void checkXmlCache(final DomainObject dobj) {
|
private void checkXmlCache(final DomainObject dobj) {
|
||||||
if ((dobj instanceof ContentItem) && CMSConfig.getInstance().getEnableXmlCache()) {
|
if ((dobj instanceof ContentItem) && CMSConfig.getInstanceOf().getEnableXmlCache()) {
|
||||||
final ContentItem item = (ContentItem) dobj;
|
final ContentItem item = (ContentItem) dobj;
|
||||||
XMLDeliveryCache.getInstance().removeFromCache(item.getOID());
|
XMLDeliveryCache.getInstance().removeFromCache(item.getOID());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
/** Creates a s_logging category with name = to the full name of class */
|
/** Creates a s_logging category with name = to the full name of class */
|
||||||
private static Logger s_log = Logger.getLogger(Initializer.class);
|
private static Logger s_log = Logger.getLogger(Initializer.class);
|
||||||
/** Configuration object for the CMS module */
|
/** Configuration object for the CMS module */
|
||||||
private static final CMSConfig s_conf = CMSConfig.getInstance();
|
private static final CMSConfig s_conf = CMSConfig.getInstanceOf();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor, adds db connection information and various sub-initializers
|
* Constructor, adds db connection information and various sub-initializers
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ public final class XMLDeliveryCache {
|
||||||
* The real cache.
|
* The real cache.
|
||||||
*/
|
*/
|
||||||
private CacheTable cache = new CacheTable(XMLDeliveryCache.class.getName(),
|
private CacheTable cache = new CacheTable(XMLDeliveryCache.class.getName(),
|
||||||
CMSConfig.getInstance().getXmlCacheSize(),
|
CMSConfig.getInstanceOf().getXmlCacheSize(),
|
||||||
CMSConfig.getInstance().getXmlCacheSize(),
|
CMSConfig.getInstanceOf().getXmlCacheSize(),
|
||||||
true);
|
true);
|
||||||
/**
|
/**
|
||||||
* Maps from the OID of the master version of an item in the cache to the OID of the item in the cache.
|
* Maps from the OID of the master version of an item in the cache to the OID of the item in the cache.
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ public abstract class CompoundContentItemPanel
|
||||||
parent.newChildElement("nav:paginator",
|
parent.newChildElement("nav:paginator",
|
||||||
"http://ccm.redhat.com/navigation");
|
"http://ccm.redhat.com/navigation");
|
||||||
|
|
||||||
URL requestURL = Web.getContext().getRequestURL();
|
URL requestURL = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
ParameterMap map = new ParameterMap();
|
ParameterMap map = new ParameterMap();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public class GenericOrgaUnitPaginator<T extends DataQuery> {
|
||||||
"nav:paginator",
|
"nav:paginator",
|
||||||
"http://ccm.redhat.com/navigation");
|
"http://ccm.redhat.com/navigation");
|
||||||
|
|
||||||
final URL requestUrl = Web.getContext().getRequestURL();
|
final URL requestUrl = Web.getWebContext().getRequestURL();
|
||||||
final ParameterMap parameters = new ParameterMap();
|
final ParameterMap parameters = new ParameterMap();
|
||||||
if (requestUrl.getParameterMap() != null) {
|
if (requestUrl.getParameterMap() != null) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class Paginator {
|
||||||
final Element paginatorElem = parent.newChildElement(
|
final Element paginatorElem = parent.newChildElement(
|
||||||
"nav:paginator", "http://ccm.redhat.com/navigation");
|
"nav:paginator", "http://ccm.redhat.com/navigation");
|
||||||
|
|
||||||
final URL requestUrl = Web.getContext().getRequestURL();
|
final URL requestUrl = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
final ParameterMap parameters = new ParameterMap();
|
final ParameterMap parameters = new ParameterMap();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package com.arsdigita.cms.dispatcher;
|
package com.arsdigita.cms.dispatcher;
|
||||||
|
|
||||||
import com.arsdigita.cms.Asset;
|
import com.arsdigita.cms.Asset;
|
||||||
|
|
||||||
import com.arsdigita.kernel.NoValidURLException;
|
import com.arsdigita.kernel.NoValidURLException;
|
||||||
import com.arsdigita.kernel.URLFinder;
|
import com.arsdigita.kernel.URLFinder;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
|
|
@ -25,28 +24,27 @@ import com.arsdigita.web.Web;
|
||||||
import com.arsdigita.web.WebConfig;
|
import com.arsdigita.web.WebConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mbooth@redhat.com
|
* Implementation of URLFinder for Assets.
|
||||||
*
|
*
|
||||||
* Implementation of URLFinder for Assets
|
* @author mbooth@redhat.com
|
||||||
*/
|
*/
|
||||||
public class AssetURLFinder implements URLFinder {
|
public class AssetURLFinder implements URLFinder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Find URL for an asset.
|
||||||
* find URL for an asset
|
|
||||||
*
|
*
|
||||||
* @param oid the OID of the asset
|
* @param oid the OID of the asset
|
||||||
* @param context the context of the lookup (live/draft)
|
* @param context the context of the lookup (live/draft)
|
||||||
*
|
* @return
|
||||||
*/
|
*/
|
||||||
public String find(OID oid, String context) throws NoValidURLException {
|
public String find(OID oid, String context) throws NoValidURLException {
|
||||||
if( !"live".equals( context ) )
|
if( !"live".equals( context ) )
|
||||||
throw new NoValidURLException("No draft URL for assets");
|
throw new NoValidURLException("No draft URL for assets");
|
||||||
|
|
||||||
WebConfig config = Web.getConfig();
|
StringBuilder url = new StringBuilder();
|
||||||
|
url.append( Web.getConfig().getDispatcherServletPath() );
|
||||||
StringBuffer url = new StringBuffer();
|
// Must be wrong! ContextPath is before ServletPath!
|
||||||
url.append( config.getDispatcherServletPath() );
|
// url.append( Web.getConfig().getDispatcherContextPath() );
|
||||||
url.append( config.getDispatcherContextPath() );
|
|
||||||
url.append( "/cms-service/stream/asset/?asset_id=" );
|
url.append( "/cms-service/stream/asset/?asset_id=" );
|
||||||
url.append( oid.get( Asset.ID ).toString() );
|
url.append( oid.get( Asset.ID ).toString() );
|
||||||
|
|
||||||
|
|
@ -54,10 +52,10 @@ public class AssetURLFinder implements URLFinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Find URL for an asset in the live context
|
||||||
* find URL for an asset in the live context
|
|
||||||
*
|
*
|
||||||
* @param oid the OID of the asset
|
* @param oid the OID of the asset
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public String find(OID oid) throws NoValidURLException {
|
public String find(OID oid) throws NoValidURLException {
|
||||||
return find(oid, "live");
|
return find(oid, "live");
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ import com.arsdigita.dispatcher.RequestContext;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
// import com.arsdigita.kernel.KernelContext;
|
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||||
import com.arsdigita.kernel.permissions.PermissionService;
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
|
|
@ -150,6 +149,7 @@ public class CMSPage extends Page implements ResourceHandler {
|
||||||
* This method is called by the {@link com.arsdigita.dispatcher.Dispatcher}
|
* This method is called by the {@link com.arsdigita.dispatcher.Dispatcher}
|
||||||
* that initializes this page.
|
* that initializes this page.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public synchronized void init() {
|
public synchronized void init() {
|
||||||
s_log.debug("Initializing the page");
|
s_log.debug("Initializing the page");
|
||||||
|
|
||||||
|
|
@ -196,6 +196,7 @@ public class CMSPage extends Page implements ResourceHandler {
|
||||||
* On the other hand, if deprecated, implementing ResourceHandler
|
* On the other hand, if deprecated, implementing ResourceHandler
|
||||||
* may not be required
|
* may not be required
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public ContentSection getContentSection(HttpServletRequest request) {
|
public ContentSection getContentSection(HttpServletRequest request) {
|
||||||
// Resets all content sections associations.
|
// Resets all content sections associations.
|
||||||
// return ContentSectionDispatcher.getContentSection(request);
|
// return ContentSectionDispatcher.getContentSection(request);
|
||||||
|
|
@ -261,6 +262,7 @@ public class CMSPage extends Page implements ResourceHandler {
|
||||||
*
|
*
|
||||||
* @pre m_transformer != null
|
* @pre m_transformer != null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void dispatch(final HttpServletRequest request,
|
public void dispatch(final HttpServletRequest request,
|
||||||
final HttpServletResponse response ,
|
final HttpServletResponse response ,
|
||||||
RequestContext actx
|
RequestContext actx
|
||||||
|
|
@ -270,6 +272,7 @@ public class CMSPage extends Page implements ResourceHandler {
|
||||||
DeveloperSupport.startStage("CMSPage.dispatch: serve page");
|
DeveloperSupport.startStage("CMSPage.dispatch: serve page");
|
||||||
|
|
||||||
CMSExcursion excursion = new CMSExcursion() {
|
CMSExcursion excursion = new CMSExcursion() {
|
||||||
|
@Override
|
||||||
public void excurse() throws IOException, ServletException {
|
public void excurse() throws IOException, ServletException {
|
||||||
Application app = Application.getCurrentApplication(request);
|
Application app = Application.getCurrentApplication(request);
|
||||||
ContentSection section = null;
|
ContentSection section = null;
|
||||||
|
|
@ -350,7 +353,7 @@ public class CMSPage extends Page implements ResourceHandler {
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * @deprecated Use Kernel.getContext().getParty() if possible and
|
// * @deprecated Use Kernel.getContext().getParty() if possible and
|
||||||
// * Web.getContext().getUser() if necessary.
|
// * Web.getWebContext().getUser() if necessary.
|
||||||
// */
|
// */
|
||||||
// public static User getCurrentUser(PageState state) {
|
// public static User getCurrentUser(PageState state) {
|
||||||
// return (User) Kernel.getContext().getParty();
|
// return (User) Kernel.getContext().getParty();
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ public class ContentItemDispatcher implements Dispatcher {
|
||||||
final ContentItem item = getContentItem(request);
|
final ContentItem item = getContentItem(request);
|
||||||
//get the Content Section
|
//get the Content Section
|
||||||
final ContentSection section =
|
final ContentSection section =
|
||||||
(ContentSection) Web.getContext().getApplication();
|
(ContentSection) Web.getWebContext().getApplication();
|
||||||
|
|
||||||
Assert.exists(item);
|
Assert.exists(item);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
public String getCurrentContext(final PageState state) {
|
public String getCurrentContext(final PageState state) {
|
||||||
s_log.debug("Getting the current context");
|
s_log.debug("Getting the current context");
|
||||||
|
|
||||||
// XXX need to use Web.getContext().getRequestURL() here.
|
// XXX need to use Web.getWebContext().getRequestURL() here.
|
||||||
String url = state.getRequest().getRequestURI();
|
String url = state.getRequest().getRequestURI();
|
||||||
|
|
||||||
final ContentSection section =
|
final ContentSection section =
|
||||||
|
|
@ -410,6 +410,7 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
||||||
* @param item The content item
|
* @param item The content item
|
||||||
* @param request The HTTP request
|
* @param request The HTTP request
|
||||||
* @return The master page
|
* @return The master page
|
||||||
|
* @throws javax.servlet.ServletException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CMSPage getMasterPage(final ContentItem item,
|
public CMSPage getMasterPage(final ContentItem item,
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ public class SimpleXMLGenerator implements XMLGenerator {
|
||||||
|
|
||||||
final XMLDeliveryCache xmlCache = XMLDeliveryCache.getInstance();
|
final XMLDeliveryCache xmlCache = XMLDeliveryCache.getInstance();
|
||||||
|
|
||||||
if (CMSConfig.getInstance().getEnableXmlCache() && xmlCache.isCached(item.getOID(), useContext, listMode)) {
|
if (CMSConfig.getInstanceOf().getEnableXmlCache() && xmlCache.isCached(item.getOID(), useContext, listMode)) {
|
||||||
xmlCache.retrieveFromCache(content, item.getOID(), useContext, listMode);
|
xmlCache.retrieveFromCache(content, item.getOID(), useContext, listMode);
|
||||||
} else {
|
} else {
|
||||||
final ContentItemXMLRenderer renderer = new ContentItemXMLRenderer(content);
|
final ContentItemXMLRenderer renderer = new ContentItemXMLRenderer(content);
|
||||||
|
|
@ -239,7 +239,7 @@ public class SimpleXMLGenerator implements XMLGenerator {
|
||||||
|
|
||||||
//Only published items
|
//Only published items
|
||||||
//Only the XML of the item itself, no extra XML
|
//Only the XML of the item itself, no extra XML
|
||||||
if (CMSConfig.getInstance().getEnableXmlCache() && item.isLiveVersion()) {
|
if (CMSConfig.getInstanceOf().getEnableXmlCache() && item.isLiveVersion()) {
|
||||||
xmlCache.cache(item.getOID(), item, content, useContext, listMode);
|
xmlCache.cache(item.getOID(), item, content, useContext, listMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ import com.arsdigita.util.servlet.HttpHost;
|
||||||
import com.arsdigita.util.servlet.HttpResourceLocator;
|
import com.arsdigita.util.servlet.HttpResourceLocator;
|
||||||
import com.arsdigita.web.Host;
|
import com.arsdigita.web.Host;
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
import com.arsdigita.web.WebConfig;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
|
|
@ -47,6 +47,7 @@ import java.math.BigDecimal;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -185,20 +186,18 @@ public class PublishToFile implements PublishToFileListener {
|
||||||
* @return the source URL for fetching the item
|
* @return the source URL for fetching the item
|
||||||
*/
|
*/
|
||||||
public static URL getSource(final String path) {
|
public static URL getSource(final String path) {
|
||||||
|
|
||||||
if (Assert.isEnabled()) {
|
if (Assert.isEnabled()) {
|
||||||
Assert.exists(path, String.class);
|
Assert.exists(path, String.class);
|
||||||
Assert.isTrue(path.startsWith("/"), "Path starts with '/'");
|
Assert.isTrue(path.startsWith("/"), "Path starts with '/'");
|
||||||
}
|
}
|
||||||
|
|
||||||
final WebConfig config = Web.getConfig();
|
|
||||||
final HttpHost host = Web.getConfig().getHost();
|
|
||||||
|
|
||||||
// def scheme, no query str
|
// def scheme, no query str
|
||||||
|
|
||||||
final HttpResourceLocator hrl = new HttpResourceLocator
|
final HttpResourceLocator hrl = new HttpResourceLocator
|
||||||
(host,
|
(Web.getConfig().getHost(),
|
||||||
config.getDispatcherContextPath(),
|
Web.getConfig().getDispatcherContextPath(),
|
||||||
config.getDispatcherServletPath(),
|
Web.getConfig().getDispatcherServletPath(),
|
||||||
path,
|
path,
|
||||||
null);
|
null);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ public class IntermediaQueryEngine extends BaseQueryEngine {
|
||||||
Calendar startCal = GregorianCalendar.getInstance();
|
Calendar startCal = GregorianCalendar.getInstance();
|
||||||
startCal.setTime(start);
|
startCal.setTime(start);
|
||||||
/*
|
/*
|
||||||
Calendar truncCal = GregorianCalendar.getInstance();
|
Calendar truncCal = GregorianCalendar.getInstanceOf();
|
||||||
truncCal.set(Calendar.DAY_OF_YEAR, startCal.get(Calendar.DAY_OF_YEAR));
|
truncCal.set(Calendar.DAY_OF_YEAR, startCal.get(Calendar.DAY_OF_YEAR));
|
||||||
truncCal.set(Calendar.YEAR, startCal.get(Calendar.YEAR));
|
truncCal.set(Calendar.YEAR, startCal.get(Calendar.YEAR));
|
||||||
truncCal.set(Calendar.MINUTE, 0);
|
truncCal.set(Calendar.MINUTE, 0);
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ public class BrowsePane extends LayoutPanel implements Resettable {
|
||||||
().getRootFolder();
|
().getRootFolder();
|
||||||
BigDecimal folderID = root.getID();
|
BigDecimal folderID = root.getID();
|
||||||
|
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
if ( user != null ) {
|
if ( user != null ) {
|
||||||
Folder homeFolder = Folder.getUserHomeFolder(user,CMS.getContext().getContentSection());
|
Folder homeFolder = Folder.getUserHomeFolder(user,CMS.getContext().getContentSection());
|
||||||
if ( homeFolder != null ) {
|
if ( homeFolder != null ) {
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ package com.arsdigita.cms.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.*;
|
import com.arsdigita.bebop.*;
|
||||||
import com.arsdigita.bebop.page.PageTransformer;
|
import com.arsdigita.bebop.page.PageTransformer;
|
||||||
import com.arsdigita.cms.ContentItem;
|
|
||||||
import com.arsdigita.cms.ContentSection;
|
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
|
|
@ -143,6 +141,9 @@ public class CMSApplicationPage extends Page {
|
||||||
*
|
*
|
||||||
* This method is called by the various servlets serving the various pages
|
* This method is called by the various servlets serving the various pages
|
||||||
* of the CMS package, before serving and displaying the page.
|
* of the CMS package, before serving and displaying the page.
|
||||||
|
* @param sreq
|
||||||
|
* @param sresp
|
||||||
|
* @param app
|
||||||
*/
|
*/
|
||||||
public synchronized void init(HttpServletRequest sreq,
|
public synchronized void init(HttpServletRequest sreq,
|
||||||
HttpServletResponse sresp,
|
HttpServletResponse sresp,
|
||||||
|
|
@ -344,7 +345,7 @@ public class CMSApplicationPage extends Page {
|
||||||
// document it in the classes. Probably remove one ore the other
|
// document it in the classes. Probably remove one ore the other
|
||||||
// way from the API if possible.
|
// way from the API if possible.
|
||||||
User user = (User) Kernel.getContext().getParty();
|
User user = (User) Kernel.getContext().getParty();
|
||||||
// User user = Web.getContext().getUser();
|
// User user = Web.getWebContext().getUser();
|
||||||
if ( user != null ) {
|
if ( user != null ) {
|
||||||
pageElement.addAttribute("name",user.getDisplayName());
|
pageElement.addAttribute("name",user.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ public class CMSItemSearchPage extends CMSApplicationPage {
|
||||||
private ItemSearchCreateItemPane m_create;
|
private ItemSearchCreateItemPane m_create;
|
||||||
private BigDecimalParameter m_sectionId;
|
private BigDecimalParameter m_sectionId;
|
||||||
private int m_lastTab;
|
private int m_lastTab;
|
||||||
private static final CMSConfig s_conf = CMSConfig.getInstance();
|
private static final CMSConfig s_conf = CMSConfig.getInstanceOf();
|
||||||
private static final boolean LIMIT_TO_CONTENT_SECTION = false;
|
private static final boolean LIMIT_TO_CONTENT_SECTION = false;
|
||||||
public static final String CONTENT_SECTION = "section_id";
|
public static final String CONTENT_SECTION = "section_id";
|
||||||
|
|
||||||
|
|
@ -309,7 +309,7 @@ public class CMSItemSearchPage extends CMSApplicationPage {
|
||||||
public void excurse()
|
public void excurse()
|
||||||
throws IOException, ServletException {
|
throws IOException, ServletException {
|
||||||
ContentSection section = null;
|
ContentSection section = null;
|
||||||
Application app = Web.getContext().getApplication();
|
Application app = Web.getWebContext().getApplication();
|
||||||
if (app instanceof ContentSection) {
|
if (app instanceof ContentSection) {
|
||||||
section = (ContentSection) app;
|
section = (ContentSection) app;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ public class ContentSectionPage extends CMSPage implements ActionListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
SecurityManager sm = CMS.getContext().getSecurityManager();
|
SecurityManager sm = CMS.getContext().getSecurityManager();
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
//m_tabbedPane.setTabVisible(state, m_userAdminPane, sm.canAccess(user, SecurityConstants.STAFF_ADMIN));
|
//m_tabbedPane.setTabVisible(state, m_userAdminPane, sm.canAccess(user, SecurityConstants.STAFF_ADMIN));
|
||||||
|
|
||||||
if (ContentSection.getConfig().getHideAdminTabs()) {
|
if (ContentSection.getConfig().getHideAdminTabs()) {
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ public class FlatItemList extends SegmentedPanel
|
||||||
m_homeFolderLabel = new Label(new PrintListener() {
|
m_homeFolderLabel = new Label(new PrintListener() {
|
||||||
public final void prepare(final PrintEvent e) {
|
public final void prepare(final PrintEvent e) {
|
||||||
Label label = (Label) e.getTarget();
|
Label label = (Label) e.getTarget();
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
|
|
||||||
Folder folder = Folder.getUserHomeFolder(user, CMS.getContext().getContentSection());
|
Folder folder = Folder.getUserHomeFolder(user, CMS.getContext().getContentSection());
|
||||||
if (folder != null) {
|
if (folder != null) {
|
||||||
|
|
@ -448,12 +448,12 @@ public class FlatItemList extends SegmentedPanel
|
||||||
} else if (source == m_togglePrivateAction) {
|
} else if (source == m_togglePrivateAction) {
|
||||||
togglePermissions(s);
|
togglePermissions(s);
|
||||||
} else if (source == m_setHomeFolderAction) {
|
} else if (source == m_setHomeFolderAction) {
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
Folder folder = m_folder.getFolder(s);
|
Folder folder = m_folder.getFolder(s);
|
||||||
user = (User) DomainObjectFactory.newInstance(user.getOID());
|
user = (User) DomainObjectFactory.newInstance(user.getOID());
|
||||||
Folder.setUserHomeFolder(user, folder);
|
Folder.setUserHomeFolder(user, folder);
|
||||||
} else if( source == m_removeHomeFolderAction) {
|
} else if( source == m_removeHomeFolderAction) {
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
ContentSection section = CMS.getContext().getContentSection();
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
UserHomeFolderMap map = UserHomeFolderMap.findUserHomeFolderMap(user, section);
|
UserHomeFolderMap map = UserHomeFolderMap.findUserHomeFolderMap(user, section);
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class FormSecurityListener implements FormSubmissionListener {
|
||||||
public final void submitted(final FormSectionEvent e)
|
public final void submitted(final FormSectionEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
final User user = Web.getContext().getUser();
|
final User user = Web.getWebContext().getUser();
|
||||||
final SecurityManager sm = Utilities.getSecurityManager(state);
|
final SecurityManager sm = Utilities.getSecurityManager(state);
|
||||||
|
|
||||||
if (m_item == null) {
|
if (m_item == null) {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class ImageSelectPage extends CMSPage {
|
||||||
private final StringParameter m_imageComponentKey;
|
private final StringParameter m_imageComponentKey;
|
||||||
private final MapComponentSelectionModel m_imageComponent;
|
private final MapComponentSelectionModel m_imageComponent;
|
||||||
private final ImageComponentSelectListener m_selectListener;
|
private final ImageComponentSelectListener m_selectListener;
|
||||||
private static final CMSConfig s_conf = CMSConfig.getInstance();
|
private static final CMSConfig s_conf = CMSConfig.getInstanceOf();
|
||||||
public static final String CONTENT_SECTION = "section_id";
|
public static final String CONTENT_SECTION = "section_id";
|
||||||
public static final String RESULT = "result";
|
public static final String RESULT = "result";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class ItemSearchFlatBrowsePane extends SimpleContainer {
|
||||||
private final QueryFieldsRequestLocal queryFields = new QueryFieldsRequestLocal();
|
private final QueryFieldsRequestLocal queryFields = new QueryFieldsRequestLocal();
|
||||||
//private final List<String> queryFields = new ArrayList<String>();
|
//private final List<String> queryFields = new ArrayList<String>();
|
||||||
//private final Submit submit;
|
//private final Submit submit;
|
||||||
private final static CMSConfig CMS_CONFIG = CMSConfig.getInstance();
|
private final static CMSConfig CMS_CONFIG = CMSConfig.getInstanceOf();
|
||||||
|
|
||||||
public ItemSearchFlatBrowsePane() {
|
public ItemSearchFlatBrowsePane() {
|
||||||
//super(name);
|
//super(name);
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ public class ItemSearchPage extends CMSPage {
|
||||||
private ItemSearchCreateItemPane m_create;
|
private ItemSearchCreateItemPane m_create;
|
||||||
private BigDecimalParameter m_sectionId;
|
private BigDecimalParameter m_sectionId;
|
||||||
private int m_lastTab;
|
private int m_lastTab;
|
||||||
private static final CMSConfig s_conf = CMSConfig.getInstance();
|
private static final CMSConfig s_conf = CMSConfig.getInstanceOf();
|
||||||
private static final boolean LIMIT_TO_CONTENT_SECTION = false;
|
private static final boolean LIMIT_TO_CONTENT_SECTION = false;
|
||||||
public static final String CONTENT_SECTION = "section_id";
|
public static final String CONTENT_SECTION = "section_id";
|
||||||
|
|
||||||
|
|
@ -305,7 +305,7 @@ public class ItemSearchPage extends CMSPage {
|
||||||
public void excurse()
|
public void excurse()
|
||||||
throws IOException, ServletException {
|
throws IOException, ServletException {
|
||||||
ContentSection section = null;
|
ContentSection section = null;
|
||||||
Application app = Web.getContext().getApplication();
|
Application app = Web.getWebContext().getApplication();
|
||||||
if (app instanceof ContentSection) {
|
if (app instanceof ContentSection) {
|
||||||
section = (ContentSection) app;
|
section = (ContentSection) app;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class UserAdminPane extends SimpleContainer {
|
||||||
if ( !isVisible(state) ) { return; }
|
if ( !isVisible(state) ) { return; }
|
||||||
|
|
||||||
SecurityManager sm = CMS.getContext().getSecurityManager();
|
SecurityManager sm = CMS.getContext().getSecurityManager();
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
|
|
||||||
if ( !sm.canAccess(user,SecurityConstants.STAFF_ADMIN) ) {
|
if ( !sm.canAccess(user,SecurityConstants.STAFF_ADMIN) ) {
|
||||||
m_deniedLabel.generateXML(state, parent);
|
m_deniedLabel.generateXML(state, parent);
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ public class ApplyWorkflowFormSection extends FormSection implements FormInitLis
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if (super.isVisible(state) &&
|
if (super.isVisible(state) &&
|
||||||
getSecurityManager(state).canAccess
|
getSecurityManager(state).canAccess
|
||||||
(Web.getContext().getUser(), SecurityConstants.APPLY_ALTERNATE_WORKFLOWS,
|
(Web.getWebContext().getUser(), SecurityConstants.APPLY_ALTERNATE_WORKFLOWS,
|
||||||
m_creationSelector.getFolder(state))) {
|
m_creationSelector.getFolder(state))) {
|
||||||
TaskCollection t = m_listener.getCollection(state);
|
TaskCollection t = m_listener.getCollection(state);
|
||||||
if (t.next()) {
|
if (t.next()) {
|
||||||
|
|
@ -192,7 +192,7 @@ public class ApplyWorkflowFormSection extends FormSection implements FormInitLis
|
||||||
*/
|
*/
|
||||||
public void applyWorkflow(PageState state, ContentItem item) {
|
public void applyWorkflow(PageState state, ContentItem item) {
|
||||||
final BigDecimal flowID = (BigDecimal) m_radio.getValue(state);
|
final BigDecimal flowID = (BigDecimal) m_radio.getValue(state);
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
final ContentSection section = m_creationSelector.getContentSection(state);
|
final ContentSection section = m_creationSelector.getContentSection(state);
|
||||||
Folder f = m_creationSelector.getFolder(state);
|
Folder f = m_creationSelector.getFolder(state);
|
||||||
final WorkflowTemplate template;
|
final WorkflowTemplate template;
|
||||||
|
|
@ -246,7 +246,7 @@ public class ApplyWorkflowFormSection extends FormSection implements FormInitLis
|
||||||
TaskCollection templates = super.getCollection(state);
|
TaskCollection templates = super.getCollection(state);
|
||||||
Filter f = templates.addInSubqueryFilter
|
Filter f = templates.addInSubqueryFilter
|
||||||
("id", "com.arsdigita.cms.getWorkflowTemplateUserFilter");
|
("id", "com.arsdigita.cms.getWorkflowTemplateUserFilter");
|
||||||
f.set("userId", Web.getContext().getUser().getID());
|
f.set("userId", Web.getWebContext().getUser().getID());
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -677,7 +677,7 @@ class CategoryItemPane extends BaseItemPane {
|
||||||
*/
|
*/
|
||||||
private boolean isItemEditable(ContentItem item, PageState state) {
|
private boolean isItemEditable(ContentItem item, PageState state) {
|
||||||
BigDecimal id = item.getID();
|
BigDecimal id = item.getID();
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(),
|
ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(),
|
||||||
Integer.parseInt(id.toString())));
|
Integer.parseInt(id.toString())));
|
||||||
Iterator permissions = PermissionService.getImpliedPrivileges(
|
Iterator permissions = PermissionService.getImpliedPrivileges(
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ public class ContentSectionContainer extends CMSContainer {
|
||||||
ContentSection section = form.getContentSection(state);
|
ContentSection section = form.getContentSection(state);
|
||||||
SecurityManager sm = new SecurityManager(section);
|
SecurityManager sm = new SecurityManager(section);
|
||||||
Folder folder = null;
|
Folder folder = null;
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
folder = Folder.getUserHomeFolder(user, section);
|
folder = Folder.getUserHomeFolder(user, section);
|
||||||
}
|
}
|
||||||
|
|
@ -438,7 +438,7 @@ public class ContentSectionContainer extends CMSContainer {
|
||||||
int row, int column) {
|
int row, int column) {
|
||||||
ContentSection section = (ContentSection) value;
|
ContentSection section = (ContentSection) value;
|
||||||
Folder folder = null;
|
Folder folder = null;
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
folder = Folder.getUserHomeFolder(user, section);
|
folder = Folder.getUserHomeFolder(user, section);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ public class TasksPanel extends CMSContainer {
|
||||||
ContentSection sec = (ContentSection) m_sectionSel.getSelectedObject(s);
|
ContentSection sec = (ContentSection) m_sectionSel.getSelectedObject(s);
|
||||||
Assert.exists(sec);
|
Assert.exists(sec);
|
||||||
|
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
Folder folder = Folder.getUserHomeFolder(user, sec);
|
Folder folder = Folder.getUserHomeFolder(user, sec);
|
||||||
if (folder != null) {
|
if (folder != null) {
|
||||||
|
|
@ -670,7 +670,7 @@ public class TasksPanel extends CMSContainer {
|
||||||
String sectionPath = item.getContentSection().getPath();
|
String sectionPath = item.getContentSection().getPath();
|
||||||
|
|
||||||
if (wf != null) {
|
if (wf != null) {
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE);
|
Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE);
|
||||||
Iterator i = engine.getEnabledTasks(user, wf.getID()).iterator();
|
Iterator i = engine.getEnabledTasks(user, wf.getID()).iterator();
|
||||||
if (i.hasNext()) {
|
if (i.hasNext()) {
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ public class MainPage extends CMSApplicationPage implements ActionListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
SecurityManager sm = CMS.getContext().getSecurityManager();
|
SecurityManager sm = CMS.getContext().getSecurityManager();
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
m_tabbedPane.setTabVisible(state,
|
m_tabbedPane.setTabVisible(state,
|
||||||
m_userAdminPane,
|
m_userAdminPane,
|
||||||
sm.canAccess(user,
|
sm.canAccess(user,
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ public class ContentSoonExpiredPane extends SimpleContainer {
|
||||||
if ( !isVisible(state) ) { return; }
|
if ( !isVisible(state) ) { return; }
|
||||||
|
|
||||||
SecurityManager sm = CMS.getContext().getSecurityManager();
|
SecurityManager sm = CMS.getContext().getSecurityManager();
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
|
|
||||||
DataTable dt = getDataTable();
|
DataTable dt = getDataTable();
|
||||||
DataQuery dq = dt.getDataQuery(state);
|
DataQuery dq = dt.getDataQuery(state);
|
||||||
|
|
@ -198,7 +198,7 @@ public class ContentSoonExpiredPane extends SimpleContainer {
|
||||||
int row, int column) {
|
int row, int column) {
|
||||||
boolean canEdit = false;
|
boolean canEdit = false;
|
||||||
BigDecimal id = (BigDecimal) key;
|
BigDecimal id = (BigDecimal) key;
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
ContentItem ci = getItemFromIdString(id.toString());
|
ContentItem ci = getItemFromIdString(id.toString());
|
||||||
Iterator permissions = PermissionService.getImpliedPrivileges(ci.getOID(), user.getOID());
|
Iterator permissions = PermissionService.getImpliedPrivileges(ci.getOID(), user.getOID());
|
||||||
while (permissions.hasNext()) {
|
while (permissions.hasNext()) {
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ public class FolderManipulator extends SimpleContainer
|
||||||
d.addError(globalize("cms.ui.folder.not_within_same_folder"));
|
d.addError(globalize("cms.ui.folder.not_within_same_folder"));
|
||||||
}
|
}
|
||||||
// check create item permission
|
// check create item permission
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
if (!sm.canAccess(user, SecurityManager.NEW_ITEM, target)) {
|
if (!sm.canAccess(user, SecurityManager.NEW_ITEM, target)) {
|
||||||
d.addError(globalize("cms.ui.folder.no_permission_for_item"));
|
d.addError(globalize("cms.ui.folder.no_permission_for_item"));
|
||||||
}
|
}
|
||||||
|
|
@ -606,7 +606,7 @@ public class FolderManipulator extends SimpleContainer
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible(PageState state) {
|
public boolean isVisible(PageState state) {
|
||||||
if (super.isVisible(state)
|
if (super.isVisible(state)
|
||||||
&& (modelBuilder.getFolderSize(state) >= CMSConfig.getInstance().
|
&& (modelBuilder.getFolderSize(state) >= CMSConfig.getInstanceOf().
|
||||||
getFolderAtoZShowLimit())) {
|
getFolderAtoZShowLimit())) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class Summary extends CMSContainer {
|
||||||
|
|
||||||
ContentItem item = getContentItem(state);
|
ContentItem item = getContentItem(state);
|
||||||
ContentSection section = getContentSection(state);
|
ContentSection section = getContentSection(state);
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
|
|
||||||
// NOT USED - CUSTOMIZED SUMMARY
|
// NOT USED - CUSTOMIZED SUMMARY
|
||||||
// Take advantage of caching in the CMS Dispatcher.
|
// Take advantage of caching in the CMS Dispatcher.
|
||||||
|
|
@ -350,7 +350,7 @@ public class Summary extends CMSContainer {
|
||||||
String key = state.getControlEventName();
|
String key = state.getControlEventName();
|
||||||
String value = state.getControlEventValue();
|
String value = state.getControlEventValue();
|
||||||
if (RESTART_WORKFLOW.equals(key)) {
|
if (RESTART_WORKFLOW.equals(key)) {
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
ContentItem item = getContentItem(state);
|
ContentItem item = getContentItem(state);
|
||||||
ContentSection section = item.getContentSection();
|
ContentSection section = item.getContentSection();
|
||||||
Workflow w = Workflow.getObjectWorkflow(item);
|
Workflow w = Workflow.getObjectWorkflow(item);
|
||||||
|
|
@ -397,7 +397,7 @@ public class Summary extends CMSContainer {
|
||||||
TaskCollection templates = item.getContentSection().getWorkflowTemplates();
|
TaskCollection templates = item.getContentSection().getWorkflowTemplates();
|
||||||
Filter f = templates.addInSubqueryFilter
|
Filter f = templates.addInSubqueryFilter
|
||||||
("id", "com.arsdigita.cms.getWorkflowTemplateUserFilter");
|
("id", "com.arsdigita.cms.getWorkflowTemplateUserFilter");
|
||||||
f.set("userId", Web.getContext().getUser().getID());
|
f.set("userId", Web.getWebContext().getUser().getID());
|
||||||
templates.addEqualsFilter(ACSObject.ID, workflow.getWorkflowTemplate().getID());
|
templates.addEqualsFilter(ACSObject.ID, workflow.getWorkflowTemplate().getID());
|
||||||
|
|
||||||
PrivilegeDescriptor pd = PrivilegeDescriptor.get(SecurityConstants.CMS_WORKFLOW_ADMIN);
|
PrivilegeDescriptor pd = PrivilegeDescriptor.get(SecurityConstants.CMS_WORKFLOW_ADMIN);
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ public class ItemLifecycleAdminPane extends BaseItemPane {
|
||||||
|
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
if (CMSConfig.getInstance().getThreadedPublishing()
|
if (CMSConfig.getInstanceOf().getThreadedPublishing()
|
||||||
&& PublishLock.getInstance().isLocked(m_item.getContentItem(
|
&& PublishLock.getInstance().isLocked(m_item.getContentItem(
|
||||||
state))) {
|
state))) {
|
||||||
if (PublishLock.getInstance().hasError(m_item.getContentItem(
|
if (PublishLock.getInstance().hasError(m_item.getContentItem(
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,10 @@ import java.text.DateFormat;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains the component which displays the information for a particular lifecycle, with
|
* This class contains the component which displays the information for a
|
||||||
* the ability to edit and delete. This information also includes the associated phases for this
|
* particular lifecycle, with the ability to edit and delete. This information
|
||||||
* lifecycle, also with the ability to add, edit, and delete.
|
* also includes the associated phases for this lifecycle, also with the ability
|
||||||
|
* to add, edit, and delete.
|
||||||
*
|
*
|
||||||
* @author Michael Pih
|
* @author Michael Pih
|
||||||
* @author Jack Chung
|
* @author Jack Chung
|
||||||
|
|
@ -284,12 +285,12 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
public final void actionPerformed(final ActionEvent e) {
|
public final void actionPerformed(final ActionEvent e) {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
final ContentItem item = m_item.getContentItem(state);
|
final ContentItem item = m_item.getContentItem(state);
|
||||||
final User user = Web.getContext().getUser();
|
final User user = Web.getWebContext().getUser();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* jensp 2011-12-14: Check is threaded publishing is active. If yes, execute publishing in a thread.
|
* jensp 2011-12-14: Check is threaded publishing is active. If yes, execute publishing in a thread.
|
||||||
*/
|
*/
|
||||||
if (CMSConfig.getInstance().getThreadedPublishing()) {
|
if (CMSConfig.getInstanceOf().getThreadedPublishing()) {
|
||||||
final Republisher republisher = new Republisher(item, user);
|
final Republisher republisher = new Republisher(item, user);
|
||||||
final Thread thread = new Thread(republisher);
|
final Thread thread = new Thread(republisher);
|
||||||
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||||
|
|
@ -307,10 +308,10 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
item.getOID().toString()),
|
item.getOID().toString()),
|
||||||
ex);
|
ex);
|
||||||
|
|
||||||
if ((CMSConfig.getInstance().
|
if ((CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureSender()
|
getPublicationFailureSender()
|
||||||
== null)
|
== null)
|
||||||
&& (CMSConfig.getInstance().
|
&& (CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver() == null)) {
|
getPublicationFailureReceiver() == null)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -318,7 +319,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
final PartyCollection receiverParties = Party.retrieveAllParties();
|
final PartyCollection receiverParties = Party.retrieveAllParties();
|
||||||
Party receiver = null;
|
Party receiver = null;
|
||||||
receiverParties.addEqualsFilter("primaryEmail",
|
receiverParties.addEqualsFilter("primaryEmail",
|
||||||
CMSConfig.getInstance().
|
CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver());
|
getPublicationFailureReceiver());
|
||||||
if (receiverParties.next()) {
|
if (receiverParties.next()) {
|
||||||
receiver = receiverParties.getParty();
|
receiver = receiverParties.getParty();
|
||||||
|
|
@ -328,7 +329,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
final PartyCollection senderParties = Party.retrieveAllParties();
|
final PartyCollection senderParties = Party.retrieveAllParties();
|
||||||
Party sender = null;
|
Party sender = null;
|
||||||
senderParties.addEqualsFilter("primaryEmail",
|
senderParties.addEqualsFilter("primaryEmail",
|
||||||
CMSConfig.getInstance().
|
CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver());
|
getPublicationFailureReceiver());
|
||||||
if (senderParties.next()) {
|
if (senderParties.next()) {
|
||||||
sender = senderParties.getParty();
|
sender = senderParties.getParty();
|
||||||
|
|
@ -430,12 +431,12 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
public final void actionPerformed(final ActionEvent e) {
|
public final void actionPerformed(final ActionEvent e) {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
final ContentItem item = m_item.getContentItem(state);
|
final ContentItem item = m_item.getContentItem(state);
|
||||||
final User user = Web.getContext().getUser();
|
final User user = Web.getWebContext().getUser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* jensp 2011-12-14: Execute is a thread if threaded publishing is active.
|
* jensp 2011-12-14: Execute is a thread if threaded publishing is active.
|
||||||
*/
|
*/
|
||||||
if (CMSConfig.getInstance().getThreadedPublishing()) {
|
if (CMSConfig.getInstanceOf().getThreadedPublishing()) {
|
||||||
final Republisher republisher = new Republisher(item, user);
|
final Republisher republisher = new Republisher(item, user);
|
||||||
final Thread thread = new Thread(republisher);
|
final Thread thread = new Thread(republisher);
|
||||||
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||||
|
|
@ -453,10 +454,10 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
item.getOID().toString()),
|
item.getOID().toString()),
|
||||||
ex);
|
ex);
|
||||||
|
|
||||||
if ((CMSConfig.getInstance().
|
if ((CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureSender()
|
getPublicationFailureSender()
|
||||||
== null)
|
== null)
|
||||||
&& (CMSConfig.getInstance().
|
&& (CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver() == null)) {
|
getPublicationFailureReceiver() == null)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -464,7 +465,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
final PartyCollection receiverParties = Party.retrieveAllParties();
|
final PartyCollection receiverParties = Party.retrieveAllParties();
|
||||||
Party receiver = null;
|
Party receiver = null;
|
||||||
receiverParties.addEqualsFilter("primaryEmail",
|
receiverParties.addEqualsFilter("primaryEmail",
|
||||||
CMSConfig.getInstance().
|
CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver());
|
getPublicationFailureReceiver());
|
||||||
if (receiverParties.next()) {
|
if (receiverParties.next()) {
|
||||||
receiver = receiverParties.getParty();
|
receiver = receiverParties.getParty();
|
||||||
|
|
@ -474,7 +475,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
final PartyCollection senderParties = Party.retrieveAllParties();
|
final PartyCollection senderParties = Party.retrieveAllParties();
|
||||||
Party sender = null;
|
Party sender = null;
|
||||||
senderParties.addEqualsFilter("primaryEmail",
|
senderParties.addEqualsFilter("primaryEmail",
|
||||||
CMSConfig.getInstance().
|
CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver());
|
getPublicationFailureReceiver());
|
||||||
if (senderParties.next()) {
|
if (senderParties.next()) {
|
||||||
sender = senderParties.getParty();
|
sender = senderParties.getParty();
|
||||||
|
|
@ -656,7 +657,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
FormProcessException {
|
FormProcessException {
|
||||||
final PageState state = fse.getPageState();
|
final PageState state = fse.getPageState();
|
||||||
final FormData data = fse.getFormData();
|
final FormData data = fse.getFormData();
|
||||||
final User user = Web.getContext().getUser();
|
final User user = Web.getWebContext().getUser();
|
||||||
|
|
||||||
String selected = (String) data.get(LIFECYCLE_ACTION);
|
String selected = (String) data.get(LIFECYCLE_ACTION);
|
||||||
final ContentItem item = m_item.getContentItem(state);
|
final ContentItem item = m_item.getContentItem(state);
|
||||||
|
|
@ -666,7 +667,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
* active.
|
* active.
|
||||||
*/
|
*/
|
||||||
if (REPUBLISH.equals(selected)) {
|
if (REPUBLISH.equals(selected)) {
|
||||||
if (CMSConfig.getInstance().getThreadedPublishing()) {
|
if (CMSConfig.getInstanceOf().getThreadedPublishing()) {
|
||||||
final RepublishRunner runner = new RepublishRunner(item, user);
|
final RepublishRunner runner = new RepublishRunner(item, user);
|
||||||
final Thread thread = new Thread(runner);
|
final Thread thread = new Thread(runner);
|
||||||
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||||
|
|
@ -684,10 +685,10 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
item.getOID().toString()),
|
item.getOID().toString()),
|
||||||
ex);
|
ex);
|
||||||
|
|
||||||
if ((CMSConfig.getInstance().
|
if ((CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureSender()
|
getPublicationFailureSender()
|
||||||
== null)
|
== null)
|
||||||
&& (CMSConfig.getInstance().
|
&& (CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver() == null)) {
|
getPublicationFailureReceiver() == null)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -695,7 +696,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
final PartyCollection receiverParties = Party.retrieveAllParties();
|
final PartyCollection receiverParties = Party.retrieveAllParties();
|
||||||
Party receiver = null;
|
Party receiver = null;
|
||||||
receiverParties.addEqualsFilter("primaryEmail",
|
receiverParties.addEqualsFilter("primaryEmail",
|
||||||
CMSConfig.getInstance().
|
CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver());
|
getPublicationFailureReceiver());
|
||||||
if (receiverParties.next()) {
|
if (receiverParties.next()) {
|
||||||
receiver = receiverParties.getParty();
|
receiver = receiverParties.getParty();
|
||||||
|
|
@ -705,7 +706,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
final PartyCollection senderParties = Party.retrieveAllParties();
|
final PartyCollection senderParties = Party.retrieveAllParties();
|
||||||
Party sender = null;
|
Party sender = null;
|
||||||
senderParties.addEqualsFilter("primaryEmail",
|
senderParties.addEqualsFilter("primaryEmail",
|
||||||
CMSConfig.getInstance().
|
CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver());
|
getPublicationFailureReceiver());
|
||||||
if (senderParties.next()) {
|
if (senderParties.next()) {
|
||||||
sender = senderParties.getParty();
|
sender = senderParties.getParty();
|
||||||
|
|
@ -753,7 +754,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (REPUBLISH_AND_RESET.equals(selected)) {
|
} else if (REPUBLISH_AND_RESET.equals(selected)) {
|
||||||
if (CMSConfig.getInstance().getThreadedPublishing()) {
|
if (CMSConfig.getInstanceOf().getThreadedPublishing()) {
|
||||||
final RepublishAndResetRunner runner = new RepublishAndResetRunner(item, user);
|
final RepublishAndResetRunner runner = new RepublishAndResetRunner(item, user);
|
||||||
final Thread thread = new Thread(runner);
|
final Thread thread = new Thread(runner);
|
||||||
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||||
|
|
@ -771,10 +772,10 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
item.getOID().toString()),
|
item.getOID().toString()),
|
||||||
ex);
|
ex);
|
||||||
|
|
||||||
if ((CMSConfig.getInstance().
|
if ((CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureSender()
|
getPublicationFailureSender()
|
||||||
== null)
|
== null)
|
||||||
&& (CMSConfig.getInstance().
|
&& (CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver() == null)) {
|
getPublicationFailureReceiver() == null)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -782,7 +783,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
final PartyCollection receiverParties = Party.retrieveAllParties();
|
final PartyCollection receiverParties = Party.retrieveAllParties();
|
||||||
Party receiver = null;
|
Party receiver = null;
|
||||||
receiverParties.addEqualsFilter("primaryEmail",
|
receiverParties.addEqualsFilter("primaryEmail",
|
||||||
CMSConfig.getInstance().
|
CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver());
|
getPublicationFailureReceiver());
|
||||||
if (receiverParties.next()) {
|
if (receiverParties.next()) {
|
||||||
receiver = receiverParties.getParty();
|
receiver = receiverParties.getParty();
|
||||||
|
|
@ -792,7 +793,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
||||||
final PartyCollection senderParties = Party.retrieveAllParties();
|
final PartyCollection senderParties = Party.retrieveAllParties();
|
||||||
Party sender = null;
|
Party sender = null;
|
||||||
senderParties.addEqualsFilter("primaryEmail",
|
senderParties.addEqualsFilter("primaryEmail",
|
||||||
CMSConfig.getInstance().
|
CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver());
|
getPublicationFailureReceiver());
|
||||||
if (senderParties.next()) {
|
if (senderParties.next()) {
|
||||||
sender = senderParties.getParty();
|
sender = senderParties.getParty();
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>A form to select and apply a lifecycle to a content item.</p>
|
||||||
* A form to select and apply a lifecycle to a content item.</p>
|
|
||||||
*
|
*
|
||||||
* @author Michael Pih
|
* @author Michael Pih
|
||||||
* @author Xixi D'moon <xdmoon@redhat.com>
|
* @author Xixi D'moon <xdmoon@redhat.com>
|
||||||
|
|
@ -97,7 +96,8 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
class ItemLifecycleSelectForm extends BaseForm {
|
class ItemLifecycleSelectForm extends BaseForm {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(ItemLifecycleSelectForm.class);
|
private static final Logger s_log =
|
||||||
|
Logger.getLogger(ItemLifecycleSelectForm.class);
|
||||||
private final static String LIFECYCLE = "lifecycle";
|
private final static String LIFECYCLE = "lifecycle";
|
||||||
private final static String START_DATE = "start_date";
|
private final static String START_DATE = "start_date";
|
||||||
private final static String END_DATE = "end_date";
|
private final static String END_DATE = "end_date";
|
||||||
|
|
@ -347,8 +347,8 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* jensp 2011-12-14: Some larger changes to the behavior of the process listener. The real
|
* jensp 2011-12-14: Some larger changes to the behavior of the process
|
||||||
* action has been moved to the
|
* listener. The real action has been moved to the
|
||||||
* @link{Publisher} class. If threaded publishing is active, the publish
|
* @link{Publisher} class. If threaded publishing is active, the publish
|
||||||
* process runs in a separate thread (the item is locked before using
|
* process runs in a separate thread (the item is locked before using
|
||||||
* {@link PublishLock}. If threaded publishing is not active, nothing has
|
* {@link PublishLock}. If threaded publishing is not active, nothing has
|
||||||
|
|
@ -363,7 +363,7 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
final ContentItem item = m_item.getContentItem(state);
|
final ContentItem item = m_item.getContentItem(state);
|
||||||
|
|
||||||
final Publisher publisher = new Publisher(state);
|
final Publisher publisher = new Publisher(state);
|
||||||
if (CMSConfig.getInstance().getThreadedPublishing()) {
|
if (CMSConfig.getInstanceOf().getThreadedPublishing()) {
|
||||||
final Runnable threadAction = new Runnable() {
|
final Runnable threadAction = new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -391,9 +391,9 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
item.getOID().toString()),
|
item.getOID().toString()),
|
||||||
ex);
|
ex);
|
||||||
|
|
||||||
if ((CMSConfig.getInstance().getPublicationFailureSender()
|
if ((CMSConfig.getInstanceOf().getPublicationFailureSender()
|
||||||
== null)
|
== null)
|
||||||
&& (CMSConfig.getInstance().
|
&& (CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver() == null)) {
|
getPublicationFailureReceiver() == null)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -402,7 +402,7 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
retrieveAllParties();
|
retrieveAllParties();
|
||||||
Party receiver = null;
|
Party receiver = null;
|
||||||
receiverParties.addEqualsFilter("primaryEmail",
|
receiverParties.addEqualsFilter("primaryEmail",
|
||||||
CMSConfig.getInstance().
|
CMSConfig.getInstanceOf().
|
||||||
getPublicationFailureReceiver());
|
getPublicationFailureReceiver());
|
||||||
if (receiverParties.next()) {
|
if (receiverParties.next()) {
|
||||||
receiver = receiverParties.getParty();
|
receiver = receiverParties.getParty();
|
||||||
|
|
@ -413,7 +413,7 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
retrieveAllParties();
|
retrieveAllParties();
|
||||||
Party sender = null;
|
Party sender = null;
|
||||||
senderParties.addEqualsFilter("primaryEmail", CMSConfig.
|
senderParties.addEqualsFilter("primaryEmail", CMSConfig.
|
||||||
getInstance().getPublicationFailureReceiver());
|
getInstanceOf().getPublicationFailureReceiver());
|
||||||
if (senderParties.next()) {
|
if (senderParties.next()) {
|
||||||
sender = senderParties.getParty();
|
sender = senderParties.getParty();
|
||||||
}
|
}
|
||||||
|
|
@ -446,7 +446,7 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
publisher.publish();
|
publisher.publish();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CMSConfig.getInstance().getThreadedPublishing()) {
|
if (CMSConfig.getInstanceOf().getThreadedPublishing()) {
|
||||||
throw new RedirectSignal(
|
throw new RedirectSignal(
|
||||||
URL.getDispatcherPath()
|
URL.getDispatcherPath()
|
||||||
+ ContentItemPage.getItemURL(item,
|
+ ContentItemPage.getItemURL(item,
|
||||||
|
|
@ -486,7 +486,7 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
* java.util.Date startDate = (java.util.Date)
|
* java.util.Date startDate = (java.util.Date)
|
||||||
* m_startDate.getValue(state);
|
* m_startDate.getValue(state);
|
||||||
*
|
*
|
||||||
* final Calendar start = Calendar.getInstance();
|
* final Calendar start = Calendar.getInstanceOf();
|
||||||
* start.setTime(startDate); start.set(Calendar.AM_PM,
|
* start.setTime(startDate); start.set(Calendar.AM_PM,
|
||||||
* startAmpm.intValue()); start.set(Calendar.MINUTE,
|
* startAmpm.intValue()); start.set(Calendar.MINUTE,
|
||||||
* startMinute.intValue()); start.set(Calendar.AM_PM,
|
* startMinute.intValue()); start.set(Calendar.AM_PM,
|
||||||
|
|
@ -502,7 +502,7 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
* m_endDate.getValue(state);
|
* m_endDate.getValue(state);
|
||||||
*
|
*
|
||||||
* if (endDate != null) { final Calendar end =
|
* if (endDate != null) { final Calendar end =
|
||||||
* Calendar.getInstance();
|
* Calendar.getInstanceOf();
|
||||||
*
|
*
|
||||||
* end.setTime(endDate); end.set(Calendar.AM_PM,
|
* end.setTime(endDate); end.set(Calendar.AM_PM,
|
||||||
* endAmpm.intValue()); end.set(Calendar.MINUTE,
|
* endAmpm.intValue()); end.set(Calendar.MINUTE,
|
||||||
|
|
@ -575,7 +575,7 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
* item.save();
|
* item.save();
|
||||||
*
|
*
|
||||||
* final Workflow workflow = m_workflow.getWorkflow(state); try {
|
* final Workflow workflow = m_workflow.getWorkflow(state); try {
|
||||||
* finish(workflow, item, Web.getContext().getUser()); } catch
|
* finish(workflow, item, Web.getWebContext().getUser()); } catch
|
||||||
* (TaskException te) { throw new FormProcessException(te); } //
|
* (TaskException te) { throw new FormProcessException(te); } //
|
||||||
* redirect to /content-center if streamlined creation mode is
|
* redirect to /content-center if streamlined creation mode is
|
||||||
* active. if
|
* active. if
|
||||||
|
|
@ -689,7 +689,7 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
workflowOid = null;
|
workflowOid = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
user = Web.getContext().getUser();
|
user = Web.getWebContext().getUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -698,8 +698,8 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
public void publish() {
|
public void publish() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We have to create a new instance here since it is not possible to access the same
|
* We have to create a new instance here since it is not possible to
|
||||||
* data object from multiple threads.
|
* access the same data object from multiple threads.
|
||||||
*/
|
*/
|
||||||
final OID oid = OID.valueOf(oidStr);
|
final OID oid = OID.valueOf(oidStr);
|
||||||
final ContentItem item = (ContentItem) DomainObjectFactory.
|
final ContentItem item = (ContentItem) DomainObjectFactory.
|
||||||
|
|
@ -1003,12 +1003,14 @@ class ItemLifecycleSelectForm extends BaseForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find out at which date a notification (about an item that is about to expire) should be sent,
|
* Find out at which date a notification (about an item that is about to
|
||||||
* based on the endDate (== date at which the item is unpublished) and the notification period.
|
* expire) should be sent, based on the endDate (== date at which the item
|
||||||
|
* is unpublished) and the notification period.
|
||||||
*
|
*
|
||||||
* @param endDate the endDate of the lifecycle, i.e. the date when the item is going to be
|
* @param endDate the endDate of the lifecycle, i.e. the date when the item
|
||||||
* unpublished
|
* is going to be unpublished
|
||||||
* @param notification how many hours the users shouls be notified in advance
|
* @param notification how many hours the users shouls be notified in
|
||||||
|
* advance
|
||||||
*/
|
*/
|
||||||
private java.util.Date computeNotificationDate(java.util.Date endDate,
|
private java.util.Date computeNotificationDate(java.util.Date endDate,
|
||||||
int notificationPeriod) {
|
int notificationPeriod) {
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public class TaskPortletRenderer extends AbstractPortletRenderer {
|
||||||
Label dueday;
|
Label dueday;
|
||||||
Date dday;
|
Date dday;
|
||||||
|
|
||||||
User currentUser = Web.getContext().getUser();
|
User currentUser = Web.getWebContext().getUser();
|
||||||
Date currentDate = new Date();
|
Date currentDate = new Date();
|
||||||
|
|
||||||
final int numTasks = m_portlet.getMaxNumTasks();
|
final int numTasks = m_portlet.getMaxNumTasks();
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ public final class AssignedTaskSection extends Section {
|
||||||
protected final Object initialValue(final PageState state) {
|
protected final Object initialValue(final PageState state) {
|
||||||
final Workflow workflow = m_flow.getWorkflow(state);
|
final Workflow workflow = m_flow.getWorkflow(state);
|
||||||
final Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE);
|
final Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE);
|
||||||
return engine.getEnabledTasks(Web.getContext().getUser(), workflow.getID());
|
return engine.getEnabledTasks(Web.getWebContext().getUser(), workflow.getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayList getTasks(final PageState state) {
|
final ArrayList getTasks(final PageState state) {
|
||||||
|
|
@ -160,7 +160,7 @@ public final class AssignedTaskSection extends Section {
|
||||||
|
|
||||||
final void restartWorkflow(final PageState state) {
|
final void restartWorkflow(final PageState state) {
|
||||||
final Workflow workflow = m_flow.getWorkflow(state);
|
final Workflow workflow = m_flow.getWorkflow(state);
|
||||||
workflow.start(Web.getContext().getUser());
|
workflow.start(Web.getWebContext().getUser());
|
||||||
workflow.save();
|
workflow.save();
|
||||||
|
|
||||||
// Lock tasks if not locked
|
// Lock tasks if not locked
|
||||||
|
|
@ -176,7 +176,7 @@ public final class AssignedTaskSection extends Section {
|
||||||
final CMSTask task = (CMSTask) iter.next();
|
final CMSTask task = (CMSTask) iter.next();
|
||||||
|
|
||||||
if (relevant(task) && !task.isLocked()) {
|
if (relevant(task) && !task.isLocked()) {
|
||||||
task.lock(Web.getContext().getUser());
|
task.lock(Web.getWebContext().getUser());
|
||||||
task.save();
|
task.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +189,7 @@ public final class AssignedTaskSection extends Section {
|
||||||
final CMSTask task = (CMSTask) iter.next();
|
final CMSTask task = (CMSTask) iter.next();
|
||||||
|
|
||||||
if (relevant(task) && task.isLocked()) {
|
if (relevant(task) && task.isLocked()) {
|
||||||
task.unlock(Web.getContext().getUser());
|
task.unlock(Web.getWebContext().getUser());
|
||||||
task.save();
|
task.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public final class AssignedTaskTable extends Table {
|
||||||
if (column == 1) {
|
if (column == 1) {
|
||||||
final CMSTask task = new CMSTask(new BigDecimal(e.getRowKey()
|
final CMSTask task = new CMSTask(new BigDecimal(e.getRowKey()
|
||||||
.toString()));
|
.toString()));
|
||||||
User currentUser = Web.getContext().getUser();
|
User currentUser = Web.getWebContext().getUser();
|
||||||
User lockingUser = task.getLockedUser();
|
User lockingUser = task.getLockedUser();
|
||||||
if (task.isLocked() && lockingUser != null
|
if (task.isLocked() && lockingUser != null
|
||||||
&& lockingUser.equals(currentUser)) {
|
&& lockingUser.equals(currentUser)) {
|
||||||
|
|
@ -92,7 +92,7 @@ public final class AssignedTaskTable extends Table {
|
||||||
User lockingUser = (User) value;
|
User lockingUser = (User) value;
|
||||||
if (lockingUser != null) {
|
if (lockingUser != null) {
|
||||||
StringBuilder sb = new StringBuilder("Locked by <br />");
|
StringBuilder sb = new StringBuilder("Locked by <br />");
|
||||||
if (lockingUser.equals(Web.getContext().getUser())) {
|
if (lockingUser.equals(Web.getWebContext().getUser())) {
|
||||||
sb.append("you");
|
sb.append("you");
|
||||||
p.add(new ControlLink(new Label(
|
p.add(new ControlLink(new Label(
|
||||||
gz("cms.ui.workflow.task.unlock"))));
|
gz("cms.ui.workflow.task.unlock"))));
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class AssignedTaskTableModelBuilder extends AbstractTableModelBuilder {
|
||||||
|
|
||||||
Assert.exists(engine, Engine.class);
|
Assert.exists(engine, Engine.class);
|
||||||
|
|
||||||
m_iter = engine.getEnabledTasks(Web.getContext().getUser(), workflow.getID()).iterator();
|
m_iter = engine.getEnabledTasks(Web.getWebContext().getUser(), workflow.getID()).iterator();
|
||||||
} else {
|
} else {
|
||||||
m_iter = Collections.emptyList().iterator();
|
m_iter = Collections.emptyList().iterator();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ abstract class BaseWorkflowItemPane extends BaseItemPane {
|
||||||
User lockingUser = task.getLockedUser();
|
User lockingUser = task.getLockedUser();
|
||||||
boolean visible = task.isEnabled() &&
|
boolean visible = task.isEnabled() &&
|
||||||
(lockingUser == null ||
|
(lockingUser == null ||
|
||||||
lockingUser.equals(Web.getContext().getUser()));
|
lockingUser.equals(Web.getWebContext().getUser()));
|
||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,7 +148,7 @@ abstract class BaseWorkflowItemPane extends BaseItemPane {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
m_task.getTask(state).finish
|
m_task.getTask(state).finish
|
||||||
(Web.getContext().getUser());
|
(Web.getWebContext().getUser());
|
||||||
} catch (TaskException te) {
|
} catch (TaskException te) {
|
||||||
throw new UncheckedWrapperException(te);
|
throw new UncheckedWrapperException(te);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class CommentAddForm extends BaseForm {
|
||||||
|
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
final CMSTask task = m_task.getTask(state);
|
final CMSTask task = m_task.getTask(state);
|
||||||
final User user = Web.getContext().getUser();
|
final User user = Web.getWebContext().getUser();
|
||||||
|
|
||||||
final TaskComment comment = new TaskComment
|
final TaskComment comment = new TaskComment
|
||||||
(task.getID(), user, (String) m_comment.getValue(state));
|
(task.getID(), user, (String) m_comment.getValue(state));
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ final class ItemWorkflowItemPane extends BaseWorkflowItemPane {
|
||||||
final Workflow workflow = m_workflow.getWorkflow
|
final Workflow workflow = m_workflow.getWorkflow
|
||||||
(state);
|
(state);
|
||||||
|
|
||||||
workflow.stop(Web.getContext().getUser());
|
workflow.stop(Web.getWebContext().getUser());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +125,7 @@ final class ItemWorkflowItemPane extends BaseWorkflowItemPane {
|
||||||
final Workflow workflow = m_workflow.getWorkflow
|
final Workflow workflow = m_workflow.getWorkflow
|
||||||
(state);
|
(state);
|
||||||
|
|
||||||
workflow.start(Web.getContext().getUser());
|
workflow.start(Web.getWebContext().getUser());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ class ItemWorkflowSelectForm extends CMSForm {
|
||||||
final Workflow flow = template.instantiateNewWorkflow();
|
final Workflow flow = template.instantiateNewWorkflow();
|
||||||
|
|
||||||
flow.setObjectID(itemID);
|
flow.setObjectID(itemID);
|
||||||
flow.start(Web.getContext().getUser());
|
flow.start(Web.getWebContext().getUser());
|
||||||
flow.save();
|
flow.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ public final class TaskFinishForm extends CommentAddForm {
|
||||||
s_log.debug("The task is approved; finishing the task");
|
s_log.debug("The task is approved; finishing the task");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
task.finish(Web.getContext().getUser());
|
task.finish(Web.getWebContext().getUser());
|
||||||
finishedTask = true;
|
finishedTask = true;
|
||||||
} catch (TaskException te) {
|
} catch (TaskException te) {
|
||||||
throw new FormValidationException(te.toString());
|
throw new FormValidationException(te.toString());
|
||||||
|
|
@ -183,14 +183,14 @@ public final class TaskFinishForm extends CommentAddForm {
|
||||||
+ "it");
|
+ "it");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
task.finish(Web.getContext().getUser());
|
task.finish(Web.getWebContext().getUser());
|
||||||
finishedTask = true;
|
finishedTask = true;
|
||||||
} catch (TaskException te) {
|
} catch (TaskException te) {
|
||||||
throw new FormValidationException(te.toString());
|
throw new FormValidationException(te.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (finishedTask) {
|
if (finishedTask) {
|
||||||
Iterator tasks = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE).getEnabledTasks(Web.getContext().getUser(),
|
Iterator tasks = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE).getEnabledTasks(Web.getWebContext().getUser(),
|
||||||
task.getParentID()).iterator();
|
task.getParentID()).iterator();
|
||||||
if (tasks.hasNext()) {
|
if (tasks.hasNext()) {
|
||||||
CMSTask thisTask = (CMSTask) tasks.next();
|
CMSTask thisTask = (CMSTask) tasks.next();
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ final class TaskItemPane extends BaseItemPane {
|
||||||
|
|
||||||
private boolean assigned(final PageState state) {
|
private boolean assigned(final PageState state) {
|
||||||
final Workflow workflow = m_workflow.getWorkflow(state);
|
final Workflow workflow = m_workflow.getWorkflow(state);
|
||||||
final User user = Web.getContext().getUser();
|
final User user = Web.getWebContext().getUser();
|
||||||
final CMSTask task = m_task.getTask(state);
|
final CMSTask task = m_task.getTask(state);
|
||||||
|
|
||||||
final Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE);
|
final Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE);
|
||||||
|
|
@ -230,7 +230,7 @@ final class TaskItemPane extends BaseItemPane {
|
||||||
|
|
||||||
if (hasAdmin(state)) {
|
if (hasAdmin(state)) {
|
||||||
final CMSTask task = m_task.getTask(state);
|
final CMSTask task = m_task.getTask(state);
|
||||||
task.lock(Web.getContext().getUser());
|
task.lock(Web.getWebContext().getUser());
|
||||||
task.save();
|
task.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -256,7 +256,7 @@ final class TaskItemPane extends BaseItemPane {
|
||||||
|
|
||||||
if (hasAdmin(state)) {
|
if (hasAdmin(state)) {
|
||||||
final CMSTask task = m_task.getTask(state);
|
final CMSTask task = m_task.getTask(state);
|
||||||
task.unlock(Web.getContext().getUser());
|
task.unlock(Web.getWebContext().getUser());
|
||||||
task.save();
|
task.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
|
||||||
|
version="2.4">
|
||||||
|
|
||||||
|
<!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
basic web.xml for ccm-cms
|
||||||
|
These specific web.xml snippets must be integrated before CMS can be
|
||||||
|
used in a CCM installation.
|
||||||
|
Alternatively a complete web.xml file from an installation bundle may
|
||||||
|
be used.
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>content-section</servlet-name>
|
||||||
|
<servlet-class>com.arsdigita.cms.ContentSectionServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>content-type-xsl</servlet-name>
|
||||||
|
<servlet-class>com.arsdigita.cms.dispatcher.ContentTypeXSLServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>content-item-xsl</servlet-name>
|
||||||
|
<servlet-class>com.arsdigita.cms.dispatcher.ContentItemXSLServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>template-xsl</servlet-name>
|
||||||
|
<servlet-class>com.arsdigita.cms.dispatcher.TemplateXSLServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
SERVLET MAPPINGS SECTION basically requirred by ccm-cms
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-->
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>content-section</servlet-name>
|
||||||
|
<url-pattern>/themes/servlet/content-section/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>content-item-xsl</servlet-name>
|
||||||
|
<url-pattern>/themes/servlet/content-item/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>content-type-xsl</servlet-name>
|
||||||
|
<url-pattern>/themes/servlet/content-type/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>template-xsl</servlet-name>
|
||||||
|
<url-pattern>/themes/servlet/template/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
</web-app>
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
|
||||||
|
version="2.4">
|
||||||
|
|
||||||
|
<!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
basic web.xml for ccm-cms
|
||||||
|
These specific web.xml snippets must be integrated before CMS can be
|
||||||
|
used in a CCM installation.
|
||||||
|
Alternatively a complete web.xml file from an installation bundle may
|
||||||
|
be used.
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>TextOnlyServlet</servlet-name>
|
||||||
|
<display-name>Text Only Servlet</display-name>
|
||||||
|
<servlet-class>com.arsdigita.web.InternalPrefixerServlet</servlet-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>prefix</param-name>
|
||||||
|
<param-value>/text</param-value>
|
||||||
|
</init-param>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>PrintFriendlyServlet</servlet-name>
|
||||||
|
<display-name>Printer Friendly Output Servlet</display-name>
|
||||||
|
<servlet-class>com.arsdigita.web.InternalPrefixerServlet</servlet-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>prefix</param-name>
|
||||||
|
<param-value>/print</param-value>
|
||||||
|
</init-param>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
SERVLET MAPPINGS SECTION basically requirred by ccm-cms
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-->
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>TextOnlyServlet</servlet-name>
|
||||||
|
<url-pattern>/text/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>PrintFriendlyServlet</servlet-name>
|
||||||
|
<url-pattern>/print/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
</web-app>
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
ContentSection section =
|
ContentSection section =
|
||||||
ContentSectionServlet.getContentSection(request);
|
ContentSectionServlet.getContentSection(request);
|
||||||
|
|
||||||
if (Web.getContext().getUser() == null) {
|
if (Web.getWebContext().getUser() == null) {
|
||||||
throw new LoginSignal(request);
|
throw new LoginSignal(request);
|
||||||
} else if (! ContentSectionServlet.checkAdminAccess(request, section)) {
|
} else if (! ContentSectionServlet.checkAdminAccess(request, section)) {
|
||||||
throw new com.arsdigita.cms.dispatcher.AccessDeniedException();
|
throw new com.arsdigita.cms.dispatcher.AccessDeniedException();
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
ContentSectionServlet.getContentSection(request);
|
ContentSectionServlet.getContentSection(request);
|
||||||
|
|
||||||
|
|
||||||
if (Web.getContext().getUser() == null) {
|
if (Web.getWebContext().getUser() == null) {
|
||||||
throw new LoginSignal(request);
|
throw new LoginSignal(request);
|
||||||
} else if (! ContentSectionServlet.checkAdminAccess(request, section)) {
|
} else if (! ContentSectionServlet.checkAdminAccess(request, section)) {
|
||||||
throw new com.arsdigita.cms.dispatcher.AccessDeniedException();
|
throw new com.arsdigita.cms.dispatcher.AccessDeniedException();
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public class WebAuditingSaveInfo implements AuditingSaveInfo {
|
||||||
private String m_ip;
|
private String m_ip;
|
||||||
|
|
||||||
public WebAuditingSaveInfo() {
|
public WebAuditingSaveInfo() {
|
||||||
m_user = Web.getContext().getUser();
|
m_user = Web.getWebContext().getUser();
|
||||||
// The user may be null.
|
// The user may be null.
|
||||||
|
|
||||||
HttpServletRequest req = Web.getRequest();
|
HttpServletRequest req = Web.getRequest();
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ public class Form extends FormSection implements BebopConstants {
|
||||||
String url = null;
|
String url = null;
|
||||||
|
|
||||||
if (m_action == null) {
|
if (m_action == null) {
|
||||||
final URL requestURL = Web.getContext().getRequestURL();
|
final URL requestURL = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
if (requestURL == null) {
|
if (requestURL == null) {
|
||||||
url = s.getRequest().getRequestURI();
|
url = s.getRequest().getRequestURI();
|
||||||
|
|
|
||||||
|
|
@ -976,7 +976,7 @@ public class PageState {
|
||||||
* @return the URI to which the current request was made
|
* @return the URI to which the current request was made
|
||||||
*/
|
*/
|
||||||
public String getRequestURI() {
|
public String getRequestURI() {
|
||||||
final URL url = Web.getContext().getRequestURL();
|
final URL url = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
return m_request.getRequestURI();
|
return m_request.getRequestURI();
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public class MySitePage extends Page {
|
||||||
Element elt = new Element("bebop:message", BEBOP_XML_NS);
|
Element elt = new Element("bebop:message", BEBOP_XML_NS);
|
||||||
|
|
||||||
elt.setText("MySite: dynamic page header. You requested: " +
|
elt.setText("MySite: dynamic page header. You requested: " +
|
||||||
Web.getContext().getRequestURL());
|
Web.getWebContext().getRequestURL());
|
||||||
|
|
||||||
parent.addContent(elt);
|
parent.addContent(elt);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ public class BebopApplicationServlet extends BaseApplicationServlet {
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected final void doService(final HttpServletRequest sreq,
|
protected final void doService(final HttpServletRequest sreq,
|
||||||
final HttpServletResponse sresp,
|
final HttpServletResponse sresp,
|
||||||
final Application app)
|
final Application app)
|
||||||
|
|
@ -174,6 +175,12 @@ public class BebopApplicationServlet extends BaseApplicationServlet {
|
||||||
* Provides the opportunity for subclasses to do some preprocessing
|
* Provides the opportunity for subclasses to do some preprocessing
|
||||||
* of a given url, before it is handed off to main service process.
|
* of a given url, before it is handed off to main service process.
|
||||||
* One typical action is to ensure permissions.
|
* One typical action is to ensure permissions.
|
||||||
|
* @param sreq
|
||||||
|
* @param sresp
|
||||||
|
* @param app
|
||||||
|
* @param url
|
||||||
|
* @throws javax.servlet.ServletException
|
||||||
|
* @throws java.io.IOException
|
||||||
*/
|
*/
|
||||||
protected void preprocessRequest(HttpServletRequest sreq,
|
protected void preprocessRequest(HttpServletRequest sreq,
|
||||||
HttpServletResponse sresp,
|
HttpServletResponse sresp,
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ public class PageDispatcher implements Dispatcher {
|
||||||
/**
|
/**
|
||||||
* Creates a new page dispatcher for a page object and a
|
* Creates a new page dispatcher for a page object and a
|
||||||
* PresentationManager.
|
* PresentationManager.
|
||||||
|
* @param page
|
||||||
|
* @param pres
|
||||||
*/
|
*/
|
||||||
public PageDispatcher(final Page page,
|
public PageDispatcher(final Page page,
|
||||||
final PresentationManager pres) {
|
final PresentationManager pres) {
|
||||||
|
|
@ -57,6 +59,7 @@ public class PageDispatcher implements Dispatcher {
|
||||||
/**
|
/**
|
||||||
* Creates a new page dispatcher for a page object. Uses the
|
* Creates a new page dispatcher for a page object. Uses the
|
||||||
* default presentation manager.
|
* default presentation manager.
|
||||||
|
* @param page
|
||||||
*/
|
*/
|
||||||
public PageDispatcher(final Page page) {
|
public PageDispatcher(final Page page) {
|
||||||
m_page = page;
|
m_page = page;
|
||||||
|
|
@ -66,7 +69,11 @@ public class PageDispatcher implements Dispatcher {
|
||||||
/**
|
/**
|
||||||
* Serves the Bebop page using the specified
|
* Serves the Bebop page using the specified
|
||||||
* <code>PresentationManager</code>.
|
* <code>PresentationManager</code>.
|
||||||
|
* @param req
|
||||||
|
* @param resp
|
||||||
|
* @param ctx
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void dispatch(final HttpServletRequest req,
|
public void dispatch(final HttpServletRequest req,
|
||||||
final HttpServletResponse resp,
|
final HttpServletResponse resp,
|
||||||
final RequestContext ctx)
|
final RequestContext ctx)
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,10 @@ import javax.xml.transform.stream.StreamResult;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class for managing and obtaining a Stylesheet based on the
|
* A class for managing and obtaining a Stylesheet based on the current
|
||||||
* current request's location in the site map. First, we try to find
|
* request's location in the site map.
|
||||||
* a stylesheet specific to this site node. If we can't find one,
|
* First, we try to find a stylesheet specific to this site node. If we can't
|
||||||
* then we walk up the site map until we find a parent of this site
|
* find one, then we walk up the site map until we find a parent of this site
|
||||||
* node that has a stylesheet associated with it.
|
* node that has a stylesheet associated with it.
|
||||||
*
|
*
|
||||||
* If we haven't found one by the time we reach the root, then we'll
|
* If we haven't found one by the time we reach the root, then we'll
|
||||||
|
|
@ -106,7 +106,7 @@ public class PageTransformer implements PresentationManager {
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
@Override
|
||||||
public String generateValue(HttpServletRequest request) {
|
public String generateValue(HttpServletRequest request) {
|
||||||
return Web.getContext().getRequestURL().getContextPath();
|
return Web.getWebContext().getRequestURL().getContextPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -115,7 +115,7 @@ public class PageTransformer implements PresentationManager {
|
||||||
new XSLParameterGenerator() {
|
new XSLParameterGenerator() {
|
||||||
@Override
|
@Override
|
||||||
public String generateValue(HttpServletRequest request) {
|
public String generateValue(HttpServletRequest request) {
|
||||||
return Web.getContext().getRequestURL().getContextPath()
|
return Web.getWebContext().getRequestURL().getContextPath()
|
||||||
+ com.arsdigita.web.URL.INTERNAL_THEME_DIR;
|
+ com.arsdigita.web.URL.INTERNAL_THEME_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -318,12 +318,11 @@ public class PageTransformer implements PresentationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serves an XML Document, getting and applying the appropriate
|
* Serves an XML Document, getting and applying the appropriate XSLT.
|
||||||
* XSLT. Also allows for parameters to be set for the
|
* Also allows for parameters to be set for the transformer. These will
|
||||||
* transformer. These will become top-level xsl:params in the
|
* become top-level xsl:params in the stylesheet.
|
||||||
* stylesheet. The "contextPath" parameter will always be passed
|
* The "contextPath" parameter will always be passed to XSLT, which is the
|
||||||
* to XSLT, which is the value of
|
* value of <code>req.getWebContextPath()</code>.
|
||||||
* <code>req.getContextPath()</code>.
|
|
||||||
*
|
*
|
||||||
* @param doc the Bebop page to serve
|
* @param doc the Bebop page to serve
|
||||||
* @param req the servlet request
|
* @param req the servlet request
|
||||||
|
|
@ -347,8 +346,8 @@ public class PageTransformer implements PresentationManager {
|
||||||
|
|
||||||
Profiler.startOp("XSLT");
|
Profiler.startOp("XSLT");
|
||||||
try {
|
try {
|
||||||
final String charset = Globalization.getDefaultCharset(Kernel.
|
final String charset = Globalization.getDefaultCharset(
|
||||||
getContext().getLocale());
|
Kernel.getContext().getLocale());
|
||||||
|
|
||||||
final String output = req.getParameter("output");
|
final String output = req.getParameter("output");
|
||||||
s_log.info("output=" + output);
|
s_log.info("output=" + output);
|
||||||
|
|
@ -383,8 +382,7 @@ public class PageTransformer implements PresentationManager {
|
||||||
endTransaction(req);
|
endTransaction(req);
|
||||||
|
|
||||||
// Transformers are not thread-safe, so we assume we have
|
// Transformers are not thread-safe, so we assume we have
|
||||||
// exclusive
|
// exclusive use of xf here. But we could recycle it.
|
||||||
// use of xf here. But we could recycle it.
|
|
||||||
xf.clearParameters();
|
xf.clearParameters();
|
||||||
|
|
||||||
if (params != null) {
|
if (params != null) {
|
||||||
|
|
@ -490,8 +488,8 @@ public class PageTransformer implements PresentationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ends the current transaction. Is a performance optimization to end ASAP before
|
* Ends the current transaction. Is a performance optimization to end
|
||||||
* serving the page.
|
* ASAP before serving the page.
|
||||||
*
|
*
|
||||||
* @param req HTTP request.
|
* @param req HTTP request.
|
||||||
*/
|
*/
|
||||||
|
|
@ -509,6 +507,8 @@ public class PageTransformer implements PresentationManager {
|
||||||
* XSLStylesheets. If this is called a second time with the same
|
* XSLStylesheets. If this is called a second time with the same
|
||||||
* parameter name then all previous calls are overwritten and
|
* parameter name then all previous calls are overwritten and
|
||||||
* only the last registered generator is used.
|
* only the last registered generator is used.
|
||||||
|
* @param parameterName
|
||||||
|
* @param parameterGenerator
|
||||||
*/
|
*/
|
||||||
public static void registerXSLParameterGenerator(String parameterName,
|
public static void registerXSLParameterGenerator(String parameterName,
|
||||||
XSLParameterGenerator parameterGenerator) {
|
XSLParameterGenerator parameterGenerator) {
|
||||||
|
|
@ -518,6 +518,7 @@ public class PageTransformer implements PresentationManager {
|
||||||
/**
|
/**
|
||||||
* This removes the parameter from the list of parameters that
|
* This removes the parameter from the list of parameters that
|
||||||
* will be added to stylesheets
|
* will be added to stylesheets
|
||||||
|
* @param parameterName
|
||||||
*/
|
*/
|
||||||
public static void removeXSLParameterGenerator(String parameterName) {
|
public static void removeXSLParameterGenerator(String parameterName) {
|
||||||
s_XSLParameters.remove(parameterName);
|
s_XSLParameters.remove(parameterName);
|
||||||
|
|
@ -526,6 +527,7 @@ public class PageTransformer implements PresentationManager {
|
||||||
/**
|
/**
|
||||||
* This is a Collection of all names of XSL Parameters that have been
|
* This is a Collection of all names of XSL Parameters that have been
|
||||||
* registered
|
* registered
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Collection getXSLParameterNames() {
|
public static Collection getXSLParameterNames() {
|
||||||
return s_XSLParameters.keySet();
|
return s_XSLParameters.keySet();
|
||||||
|
|
@ -534,6 +536,9 @@ public class PageTransformer implements PresentationManager {
|
||||||
/**
|
/**
|
||||||
* This takes a name and request and returns the value that should
|
* This takes a name and request and returns the value that should
|
||||||
* be used in the XSL for the given name
|
* be used in the XSL for the given name
|
||||||
|
* @param name
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getXSLParameterValue(String name,
|
public static String getXSLParameterValue(String name,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) {
|
||||||
|
|
@ -549,6 +554,8 @@ public class PageTransformer implements PresentationManager {
|
||||||
/**
|
/**
|
||||||
* This takes in a transformer and adds all of the registered
|
* This takes in a transformer and adds all of the registered
|
||||||
* xsl paraemters.
|
* xsl paraemters.
|
||||||
|
* @param transformer
|
||||||
|
* @param request
|
||||||
*/
|
*/
|
||||||
public static void addXSLParameters(Transformer transformer,
|
public static void addXSLParameters(Transformer transformer,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class ApplicationCategoryPicker extends ObjectCategoryPicker {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ACSObject getObject(PageState state) {
|
protected ACSObject getObject(PageState state) {
|
||||||
return Web.getContext().getApplication();
|
return Web.getWebContext().getApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getContext(PageState state) {
|
protected String getContext(PageState state) {
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ class Permission extends DomainObject {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void setCreationInfo() {
|
private void setCreationInfo() {
|
||||||
User user = Web.getContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
// The user may be null.
|
// The user may be null.
|
||||||
|
|
||||||
HttpServletRequest req = Web.getRequest();
|
HttpServletRequest req = Web.getRequest();
|
||||||
|
|
|
||||||
|
|
@ -490,7 +490,7 @@ public class UserContext {
|
||||||
*/
|
*/
|
||||||
public static String encodeReturnURL(HttpServletRequest req) {
|
public static String encodeReturnURL(HttpServletRequest req) {
|
||||||
StringBuilder returnURL = new StringBuilder(100);
|
StringBuilder returnURL = new StringBuilder(100);
|
||||||
returnURL.append(Web.getContext().getRequestURL().getRequestURI());
|
returnURL.append(Web.getWebContext().getRequestURL().getRequestURI());
|
||||||
returnURL.append('?');
|
returnURL.append('?');
|
||||||
|
|
||||||
// convert posted parameters to URL parameters
|
// convert posted parameters to URL parameters
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ public class CompoundInitializer implements Initializer {
|
||||||
*
|
*
|
||||||
* @param evt The data init event.
|
* @param evt The data init event.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init(DataInitEvent evt) {
|
public void init(DataInitEvent evt) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (Iterator it = m_inits.iterator(); it.hasNext(); i++) {
|
for (Iterator it = m_inits.iterator(); it.hasNext(); i++) {
|
||||||
|
|
@ -102,6 +103,7 @@ public class CompoundInitializer implements Initializer {
|
||||||
*
|
*
|
||||||
* @param evt The domain init event.
|
* @param evt The domain init event.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init(DomainInitEvent evt) {
|
public void init(DomainInitEvent evt) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (Iterator it = m_inits.iterator(); it.hasNext(); i++) {
|
for (Iterator it = m_inits.iterator(); it.hasNext(); i++) {
|
||||||
|
|
@ -142,6 +144,7 @@ public class CompoundInitializer implements Initializer {
|
||||||
*
|
*
|
||||||
* @param evt The legacy init event.
|
* @param evt The legacy init event.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init(ContextInitEvent evt) {
|
public void init(ContextInitEvent evt) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (Iterator it = m_inits.iterator(); it.hasNext(); i++) {
|
for (Iterator it = m_inits.iterator(); it.hasNext(); i++) {
|
||||||
|
|
@ -164,6 +167,7 @@ public class CompoundInitializer implements Initializer {
|
||||||
*
|
*
|
||||||
* @param evt The context close event.
|
* @param evt The context close event.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void close(ContextCloseEvent evt) {
|
public void close(ContextCloseEvent evt) {
|
||||||
s_log.info("CompoundInitializer.close(ContextCloseEvent) invoked");
|
s_log.info("CompoundInitializer.close(ContextCloseEvent) invoked");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ public class ResultsPane extends SimpleComponent {
|
||||||
long end,
|
long end,
|
||||||
long objectCount) {
|
long objectCount) {
|
||||||
Element paginator = Search.newElement("paginator");
|
Element paginator = Search.newElement("paginator");
|
||||||
URL url = Web.getContext().getRequestURL();
|
URL url = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
ParameterMap map = new ParameterMap();
|
ParameterMap map = new ParameterMap();
|
||||||
Iterator current = url.getParameterMap().keySet().iterator();
|
Iterator current = url.getParameterMap().keySet().iterator();
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.templating;
|
package com.arsdigita.templating;
|
||||||
|
|
||||||
import com.arsdigita.web.Web;
|
|
||||||
import com.arsdigita.web.Application;
|
import com.arsdigita.web.Application;
|
||||||
|
import com.arsdigita.web.Web;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
|
@ -31,10 +31,22 @@ import java.net.URLEncoder;
|
||||||
*/
|
*/
|
||||||
public class ApplicationOIDPatternGenerator implements PatternGenerator {
|
public class ApplicationOIDPatternGenerator implements PatternGenerator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Looks up the current application and returns its OID as String.
|
||||||
|
* The Return type is (unneccessarily) String[] due to the current API, but
|
||||||
|
* currently never returns more than just one value (one OID).
|
||||||
|
*
|
||||||
|
* @param key placeholder from the pattern string, without surrounding
|
||||||
|
* colons, constantly "oid" here.
|
||||||
|
* @param req current HttpServletRequest
|
||||||
|
* @return OID as String in an Array of Strings. This array is never longer
|
||||||
|
* as one element.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public String[] generateValues(String key,
|
public String[] generateValues(String key,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
|
|
||||||
final Application application = Web.getContext().getApplication();
|
final Application application = Web.getWebContext().getApplication();
|
||||||
|
|
||||||
if (application != null) {
|
if (application != null) {
|
||||||
String[] oid = new String[1];
|
String[] oid = new String[1];
|
||||||
|
|
|
||||||
|
|
@ -48,52 +48,24 @@ public class ApplicationPatternGenerator implements PatternGenerator {
|
||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] generateValues(String key,
|
public String[] generateValues(String key,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
|
|
||||||
s_log.debug("Processing Application with key: " + key );
|
s_log.debug("Processing Application with key: " + key );
|
||||||
|
|
||||||
final Application app = Web.getContext().getApplication();
|
final Application app = Web.getWebContext().getApplication();
|
||||||
if (app != null) {
|
if (app != null) {
|
||||||
String[] returnValue = { app.getApplicationType().getName() };
|
String[] returnValue = { app.getApplicationType().getName() };
|
||||||
s_log.debug("Found application >>"+returnValue+"<< in Application.");
|
s_log.debug("Found application >>"+returnValue+"<< in Application.");
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SiteNodeRequestContext is deprecated and replaced by web.WebContext
|
|
||||||
// used in the code above (Web.getContext().
|
|
||||||
// This code should never be executed.
|
|
||||||
// Findings: SideNode is requirred for modules which dont use
|
|
||||||
// legacy-compatible applications but package-type apps. content-center
|
|
||||||
// and cms-service are 2 examples. Code can be eliminated when all apps
|
|
||||||
// will use web.Application for loading and instantiation.
|
|
||||||
// UPDATE
|
|
||||||
// CMS had been migrated. It is only necessary for the root package,
|
|
||||||
// which is "Main Site" = acs-subsite which is used by some login
|
|
||||||
// redirects.
|
|
||||||
s_log.debug("ApplicationType for >>" +key +
|
s_log.debug("ApplicationType for >>" +key +
|
||||||
"<< not found. Trying SiteNodes instead.");
|
"<< not found. Trying SiteNodes instead.");
|
||||||
|
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"No ApplicationType found for type name " + key);
|
"No ApplicationType found for type name " + key);
|
||||||
|
|
||||||
/*
|
|
||||||
SiteNodeRequestContext ctx = (SiteNodeRequestContext)
|
|
||||||
DispatcherHelper.getRequestContext(req);
|
|
||||||
|
|
||||||
SiteNode node = ctx.getSiteNode();
|
|
||||||
|
|
||||||
if (node != null) {
|
|
||||||
String[] returnValue = {
|
|
||||||
node.getPackageInstance().getType().getKey()
|
|
||||||
};
|
|
||||||
s_log.debug("Found node >>" + returnValue + "<< in SiteNodes.");
|
|
||||||
return returnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_log.debug("ApplicationType for " +key +
|
|
||||||
" could not be found in SiteNodes either. Returning empty String[]");
|
|
||||||
*/
|
|
||||||
// return new String[] {};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,16 +28,39 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a set of patterns corresponding to the current
|
* Generates a set of patterns corresponding to the current
|
||||||
* web application prefix
|
* host name. (actually just retrieves the current hostname from configuration
|
||||||
|
* file, StringArray returned is for sake of methods consistency)
|
||||||
*/
|
*/
|
||||||
public class HostPatternGenerator implements PatternGenerator {
|
public class HostPatternGenerator implements PatternGenerator {
|
||||||
|
|
||||||
|
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||||
|
* by editing /WEB-INF/conf/log4j.properties int the runtime environment
|
||||||
|
* and set com.arsdigita.templating.HostPatternGenerator=DEBUG
|
||||||
|
* by uncommenting or adding the line. */
|
||||||
private static final Logger s_log =
|
private static final Logger s_log =
|
||||||
Logger.getLogger(URLPatternGenerator.class);
|
Logger.getLogger(HostPatternGenerator.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Looks up the hostname from configuration and returns it as String.
|
||||||
|
* The Return type is (unneccessarily) String[] due to the current API, but
|
||||||
|
* currently never returns more than just one value (one hostname:port).
|
||||||
|
*
|
||||||
|
* @param key placeholder from the pattern string, without surrounding
|
||||||
|
* colons, constantly "host" here.
|
||||||
|
* @param req current HttpServletRequest
|
||||||
|
* @return Hostname (including port if any), retrieved from CCM
|
||||||
|
* configuration
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public String[] generateValues(String key,
|
public String[] generateValues(String key,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
HttpHost host = Web.getConfig().getHost();
|
HttpHost host = Web.getConfig().getHost();
|
||||||
|
String hostName = host.toString();
|
||||||
|
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.debug("Generating Values for key: " + key + " [" +
|
||||||
|
"Hostname retrieved: >>" + hostName + "<<]");
|
||||||
|
}
|
||||||
|
|
||||||
return new String[] { host.toString() };
|
return new String[] { host.toString() };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ import org.apache.log4j.Logger;
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
* <td> <code>::application::</code> </td>
|
* <td> <code>::application::</code> </td>
|
||||||
* <td> Current application name </td>
|
* <td> Current CCM Application name </td>
|
||||||
* <td> <code>navigation</code> </td>
|
* <td> <code>navigation</code> </td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
|
|
@ -145,7 +145,6 @@ import org.apache.log4j.Logger;
|
||||||
* and add it in a custom integration package Initializer (e.g. ccm-ldn-aplaws)
|
* and add it in a custom integration package Initializer (e.g. ccm-ldn-aplaws)
|
||||||
* by following code:
|
* by following code:
|
||||||
* // Register additional PatternStyleSheetResolver for Web app.
|
* // Register additional PatternStyleSheetResolver for Web app.
|
||||||
* // With all modules installing in one context no longer required.
|
|
||||||
* PatternStylesheetResolver.registerPatternGenerator(
|
* PatternStylesheetResolver.registerPatternGenerator(
|
||||||
* "[myKey]",
|
* "[myKey]",
|
||||||
* new [My]PatternGenerator()
|
* new [My]PatternGenerator()
|
||||||
|
|
@ -156,7 +155,10 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class PatternStylesheetResolver implements StylesheetResolver {
|
public class PatternStylesheetResolver implements StylesheetResolver {
|
||||||
|
|
||||||
/** Logger instance for debugging. */
|
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||||
|
* by editing /WEB-INF/conf/log4j.properties int the runtime environment
|
||||||
|
* and set com.arsdigita.templating.PatternStylesheetResolver=DEBUG
|
||||||
|
* by uncommenting or adding the line. */
|
||||||
private static final Logger s_log = Logger.getLogger
|
private static final Logger s_log = Logger.getLogger
|
||||||
(PatternStylesheetResolver.class);
|
(PatternStylesheetResolver.class);
|
||||||
|
|
||||||
|
|
@ -176,6 +178,8 @@ public class PatternStylesheetResolver implements StylesheetResolver {
|
||||||
s_generators.put(key, gen);
|
s_generators.put(key, gen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Statiic initializer block to initialize the standard pattern generators
|
||||||
|
* at load time. */
|
||||||
static {
|
static {
|
||||||
s_log.debug("Static initalizer starting...");
|
s_log.debug("Static initalizer starting...");
|
||||||
registerPatternGenerator
|
registerPatternGenerator
|
||||||
|
|
@ -195,60 +199,20 @@ public class PatternStylesheetResolver implements StylesheetResolver {
|
||||||
s_log.debug("Static initalizer finished.");
|
s_log.debug("Static initalizer finished.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Complete path to the file specifing stylesheet patterns. Configurable
|
||||||
|
* by configuration option in TemplatingConfig */
|
||||||
private String m_path = null;
|
private String m_path = null;
|
||||||
// This is a List of Lists.
|
/** A List of Lists each of its lists containing one pattern to resolve
|
||||||
|
* a probably appropriate stylesheet to apply. (i.e. one row of the
|
||||||
|
* file m_path above) */
|
||||||
private List m_paths = null;
|
private List m_paths = null;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
*/
|
|
||||||
private void loadPaths(String path) {
|
|
||||||
if (s_log.isInfoEnabled()) {
|
|
||||||
s_log.info("Loading paths from " + path);
|
|
||||||
}
|
|
||||||
m_path = path;
|
|
||||||
try {
|
|
||||||
// Read the source file.
|
|
||||||
ClassLoader cload = Thread.currentThread().getContextClassLoader();
|
|
||||||
InputStream stream = cload.getResourceAsStream(path.substring(1));
|
|
||||||
s_log.debug("got stream using path " + path.substring(1));
|
|
||||||
s_log.debug("stream.available is " + stream.available());
|
|
||||||
m_paths = new ArrayList();
|
|
||||||
|
|
||||||
LineNumberReader file = new LineNumberReader
|
|
||||||
(new InputStreamReader(stream));
|
|
||||||
String line;
|
|
||||||
int lineNum;
|
|
||||||
while ((line = file.readLine()) != null) {
|
|
||||||
lineNum = file.getLineNumber();
|
|
||||||
// Ignore blank lines and comments.
|
|
||||||
line = line.trim();
|
|
||||||
s_log.debug("line is " + line);
|
|
||||||
if ("".equals(line) || line.startsWith("#")
|
|
||||||
|| line.startsWith("!") || line.startsWith("//")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Split up the line.
|
|
||||||
List list = StringUtils.splitUp(line, "/::\\w+::/");
|
|
||||||
// Save the split line.
|
|
||||||
m_paths.add(list);
|
|
||||||
}
|
|
||||||
} catch (IOException ex) {
|
|
||||||
throw new UncheckedWrapperException(
|
|
||||||
"cannot read XSLT paths from " + path, ex);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
s_log.debug("loadPaths threw exception " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public URL resolve(HttpServletRequest request) {
|
public URL resolve(HttpServletRequest request) {
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
if (m_paths == null) {
|
if (m_paths == null) {
|
||||||
|
|
@ -273,10 +237,19 @@ public class PatternStylesheetResolver implements StylesheetResolver {
|
||||||
String[] bits = (String[])files.next();
|
String[] bits = (String[])files.next();
|
||||||
|
|
||||||
String resource = StringUtils.join(bits, "");
|
String resource = StringUtils.join(bits, "");
|
||||||
|
// UGLY HACK
|
||||||
|
// If a placeholder returns an empty string (as in the example of
|
||||||
|
// the root webapp) the provided string contains a "//" as there is
|
||||||
|
// a slash before as well as after the placeholder in the pattern
|
||||||
|
// string. It's ugly so we'll replace it.
|
||||||
|
resource = resource.replace("//","/");
|
||||||
|
// The hack destroys the http protocol as well so we need another hack
|
||||||
|
resource = resource.replace("http:/","http://");
|
||||||
|
|
||||||
if (s_log.isInfoEnabled()) {
|
if (s_log.isInfoEnabled()) {
|
||||||
s_log.info("Looking to see if resource " + resource + " exists");
|
s_log.info("Looking to see if resource " + resource + " exists");
|
||||||
}
|
}
|
||||||
//java.net.URL url = Web.findResource(resource);
|
|
||||||
URL origURL = null;
|
URL origURL = null;
|
||||||
try {
|
try {
|
||||||
origURL = new URL(resource);
|
origURL = new URL(resource);
|
||||||
|
|
@ -289,8 +262,8 @@ public class PatternStylesheetResolver implements StylesheetResolver {
|
||||||
s_log.info("origURL is " + origURL);
|
s_log.info("origURL is " + origURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
final URL xfrmedURL = (origURL == null) ?
|
final URL xfrmedURL = (origURL==null) ? null : Templating
|
||||||
null : Templating.transformURL(origURL);
|
.transformURL(origURL);
|
||||||
|
|
||||||
if (s_log.isInfoEnabled()) {
|
if (s_log.isInfoEnabled()) {
|
||||||
s_log.info("Transformed resource is " + xfrmedURL);
|
s_log.info("Transformed resource is " + xfrmedURL);
|
||||||
|
|
@ -303,6 +276,10 @@ public class PatternStylesheetResolver implements StylesheetResolver {
|
||||||
}
|
}
|
||||||
if (is != null) {
|
if (is != null) {
|
||||||
is.close();
|
is.close();
|
||||||
|
// xfrmedURL may test for existence either as http request
|
||||||
|
// or as a file lookup. Anyway we return the original URL
|
||||||
|
// which used to be a http request.
|
||||||
|
// Note: we are returning the URL, not the resource!
|
||||||
return origURL;
|
return origURL;
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
|
|
@ -311,13 +288,13 @@ public class PatternStylesheetResolver implements StylesheetResolver {
|
||||||
}
|
}
|
||||||
// fall through & try next pattern
|
// fall through & try next pattern
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new UncheckedWrapperException(
|
throw new UncheckedWrapperException("cannot open stream " +
|
||||||
"cannot open stream " + resource, ex);
|
resource, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new RuntimeException
|
throw new RuntimeException("no path to XSL stylesheet found; " +
|
||||||
("no path to XSL stylesheet found; " + "try modifying " + m_path);
|
"try modifying " + m_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -343,16 +320,20 @@ public class PatternStylesheetResolver implements StylesheetResolver {
|
||||||
}
|
}
|
||||||
boolean clean = true;
|
boolean clean = true;
|
||||||
for (int i = 0 ; i < bits.length && clean ; i++) {
|
for (int i = 0 ; i < bits.length && clean ; i++) {
|
||||||
if (bits[i].startsWith("::") &&
|
if (bits[i].startsWith("::") && bits[i].endsWith("::")) {
|
||||||
bits[i].endsWith("::")) {
|
|
||||||
clean = false;
|
clean = false;
|
||||||
String[] vals = getValues(
|
String[] vals = getValues(bits[i]
|
||||||
bits[i].substring(2, bits[i].length() - 2),
|
.substring(2, bits[i].length()-2),
|
||||||
values,
|
values,
|
||||||
request);
|
request);
|
||||||
if (vals != null) {
|
if (vals != null) {
|
||||||
for (int k = 0 ; k < vals.length ; k++) {
|
for (int k = 0 ; k < vals.length ; k++) {
|
||||||
String[] newBits = new String[bits.length];
|
String[] newBits = new String[bits.length];
|
||||||
|
// In case the pattern for an element is an empty
|
||||||
|
// string (e.g. for the ROOT webapp) the slash before
|
||||||
|
// as well as after the placeholder are added
|
||||||
|
// resulting in a "//" which does no harm but is
|
||||||
|
// ugly.
|
||||||
for (int j = 0 ; j < bits.length ; j++) {
|
for (int j = 0 ; j < bits.length ; j++) {
|
||||||
if (j == i) {
|
if (j == i) {
|
||||||
newBits[j] = vals[k];
|
newBits[j] = vals[k];
|
||||||
|
|
@ -405,4 +386,50 @@ public class PatternStylesheetResolver implements StylesheetResolver {
|
||||||
return vals;
|
return vals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param path
|
||||||
|
*/
|
||||||
|
private void loadPaths(String path) {
|
||||||
|
if (s_log.isInfoEnabled()) {
|
||||||
|
s_log.info("Loading paths from " + path);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_path = path;
|
||||||
|
try {
|
||||||
|
// Read the source file.
|
||||||
|
ClassLoader cload = Thread.currentThread().getContextClassLoader();
|
||||||
|
InputStream stream = cload.getResourceAsStream(path.substring(1));
|
||||||
|
s_log.debug("got stream using path " + path.substring(1));
|
||||||
|
s_log.debug("stream.available is " + stream.available());
|
||||||
|
m_paths = new ArrayList();
|
||||||
|
|
||||||
|
LineNumberReader file = new LineNumberReader
|
||||||
|
(new InputStreamReader(stream));
|
||||||
|
String line;
|
||||||
|
int lineNum;
|
||||||
|
while ((line = file.readLine()) != null) {
|
||||||
|
lineNum = file.getLineNumber();
|
||||||
|
// Ignore blank lines and comments.
|
||||||
|
line = line.trim();
|
||||||
|
s_log.debug("line is " + line);
|
||||||
|
if ("".equals(line) || line.startsWith("#")
|
||||||
|
|| line.startsWith("!") || line.startsWith("//")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Split up the line.
|
||||||
|
List list = StringUtils.splitUp(line, "/::\\w+::/");
|
||||||
|
// Save the split line.
|
||||||
|
m_paths.add(list);
|
||||||
|
}
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new UncheckedWrapperException(
|
||||||
|
"cannot read XSLT paths from " + path, ex);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
s_log.debug("loadPaths threw exception " + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ public class PrefixPatternGenerator implements PatternGenerator {
|
||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] generateValues(String key,
|
public String[] generateValues(String key,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
String value = DispatcherHelper.getDispatcherPrefix(req);
|
String value = DispatcherHelper.getDispatcherPrefix(req);
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,10 @@ import javax.xml.transform.stream.StreamSource;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of the URIResolver interface that keeps track of
|
* An implementation of the URIResolver interface that keeps track of all the
|
||||||
* all the URLs that have been loaded. If you set this as the URI
|
* URLs that have been loaded.
|
||||||
* resolver for a Transformer then this will track all the
|
* If you set this as the URI resolver for a Transformer then this will track
|
||||||
* <code>xsl:import</code> and <code>xsl:include</code> statements.
|
* all the <code>xsl:import</code> and <code>xsl:include</code> statements.
|
||||||
*
|
*
|
||||||
* @version $Id: SimpleURIResolver.java 287 2005-02-22 00:29:02Z sskracic $
|
* @version $Id: SimpleURIResolver.java 287 2005-02-22 00:29:02Z sskracic $
|
||||||
*/
|
*/
|
||||||
|
|
@ -50,6 +50,9 @@ final class SimpleURIResolver implements URIResolver {
|
||||||
private final Set m_uniqueStylesheetURIs;
|
private final Set m_uniqueStylesheetURIs;
|
||||||
private final List m_stylesheetURIs;
|
private final List m_stylesheetURIs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor, just initializes internal properties.
|
||||||
|
*/
|
||||||
public SimpleURIResolver() {
|
public SimpleURIResolver() {
|
||||||
m_uniqueStylesheetURIs = new HashSet();
|
m_uniqueStylesheetURIs = new HashSet();
|
||||||
m_stylesheetURIs = new ArrayList();
|
m_stylesheetURIs = new ArrayList();
|
||||||
|
|
@ -70,10 +73,11 @@ final class SimpleURIResolver implements URIResolver {
|
||||||
* @param href the url to resolve
|
* @param href the url to resolve
|
||||||
* @param base the base url to resolve relative to
|
* @param base the base url to resolve relative to
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Source resolve(final String href, final String base)
|
public Source resolve(final String href, final String base)
|
||||||
throws TransformerException {
|
throws TransformerException {
|
||||||
if (s_log.isDebugEnabled()) {
|
if (s_log.isDebugEnabled()) {
|
||||||
s_log.debug("Resolve " + href + " (" + base + ")");
|
s_log.debug("Resolve " + href + " (found in " + base + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
URL baseURL = null;
|
URL baseURL = null;
|
||||||
|
|
@ -127,7 +131,10 @@ final class SimpleURIResolver implements URIResolver {
|
||||||
// are relative to 'thisURL'
|
// are relative to 'thisURL'
|
||||||
return new StreamSource(is, thisURL.toString());
|
return new StreamSource(is, thisURL.toString());
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new TransformerException(String.format("cannot read stream for %s", thisURL.toString()), ex);
|
throw new TransformerException(
|
||||||
|
String.format("cannot read stream for %s",
|
||||||
|
thisURL.toString()),
|
||||||
|
ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ public interface StylesheetResolver {
|
||||||
*
|
*
|
||||||
* @param sreq the <code>HttpServletRequest</code> for which to
|
* @param sreq the <code>HttpServletRequest</code> for which to
|
||||||
* resolve a template
|
* resolve a template
|
||||||
|
* @return URL where to try to find a stylesheet
|
||||||
*/
|
*/
|
||||||
public URL resolve(HttpServletRequest sreq);
|
public URL resolve(HttpServletRequest sreq);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,28 +57,34 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class Templating {
|
public class Templating {
|
||||||
|
|
||||||
|
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||||
|
* by editing /WEB-INF/conf/log4j.properties int hte runtime environment
|
||||||
|
* and set com.arsdigita.templating.Templating=DEBUG by uncommenting it
|
||||||
|
* or adding the line. */
|
||||||
private static final Logger s_log = Logger.getLogger(Templating.class);
|
private static final Logger s_log = Logger.getLogger(Templating.class);
|
||||||
// just a tag to assure an implementation exists
|
|
||||||
// public static final Class DEFAULT_PRESENTATION_MANAGER
|
/** This is the name of the attribute that is set in the request whose
|
||||||
// = SimplePresentationManager.class;
|
|
||||||
/**
|
|
||||||
* This is the name of the attribute that is set in the request whose
|
|
||||||
* value, if present, is a collection of TransformerExceptions that
|
* value, if present, is a collection of TransformerExceptions that
|
||||||
* can be used to produce a "pretty" error.
|
* can be used to produce a "pretty" error. */
|
||||||
*/
|
|
||||||
public static final String FANCY_ERROR_COLLECTION = "fancyErrorCollection";
|
public static final String FANCY_ERROR_COLLECTION = "fancyErrorCollection";
|
||||||
// this was instantiated with hardcoded values, not anymore
|
|
||||||
|
/**
|
||||||
|
* The cache data storage for caching XSL templates.
|
||||||
|
*/
|
||||||
private static CacheTable s_templates = null;
|
private static CacheTable s_templates = null;
|
||||||
private static final TemplatingConfig s_config = new TemplatingConfig();
|
|
||||||
|
/** Config object containing various parameter */
|
||||||
|
private static final TemplatingConfig s_config = TemplatingConfig
|
||||||
|
.getInstanceOf();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_log.debug("Static initalizer starting...");
|
s_log.debug("Static initalizer starting...");
|
||||||
s_config.load("ccm-core/templating.properties");
|
|
||||||
|
|
||||||
Exceptions.registerUnwrapper(
|
Exceptions.registerUnwrapper(
|
||||||
TransformerException.class,
|
TransformerException.class,
|
||||||
new ExceptionUnwrapper() {
|
new ExceptionUnwrapper() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Throwable unwrap(Throwable t) {
|
public Throwable unwrap(Throwable t) {
|
||||||
TransformerException ex = (TransformerException) t;
|
TransformerException ex = (TransformerException) t;
|
||||||
return ex.getCause();
|
return ex.getCause();
|
||||||
|
|
@ -112,9 +118,10 @@ public class Templating {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new instance of the current presentation manager class. This is
|
* Returns a new instance of the current presentation manager class. This is
|
||||||
* an object which has the {@link com.arsdigita.templating.PresentationManager
|
* an object which has the
|
||||||
* PresentationManager} interface which can be used to transform an XML
|
* {@link com.arsdigita.templating.PresentationManager PresentationManager}
|
||||||
* document into an output stream.
|
* interface which can be used to transform an XML document into an output
|
||||||
|
* stream.
|
||||||
*
|
*
|
||||||
* As of version 6.6.0 the bebop framework is the only instance to provide
|
* As of version 6.6.0 the bebop framework is the only instance to provide
|
||||||
* an implementation. To avoid class hierachie kludge we directly return the
|
* an implementation. To avoid class hierachie kludge we directly return the
|
||||||
|
|
@ -235,7 +242,7 @@ public class Templating {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves and retrieves the template for the given request.
|
* Resolves the template for the given request to an URL.
|
||||||
*
|
*
|
||||||
* @param sreq The current request object
|
* @param sreq The current request object
|
||||||
* @param fancyErrors Should this place any xsl errors in the request
|
* @param fancyErrors Should this place any xsl errors in the request
|
||||||
|
|
@ -250,10 +257,10 @@ public class Templating {
|
||||||
public static XSLTemplate getTemplate(final HttpServletRequest sreq,
|
public static XSLTemplate getTemplate(final HttpServletRequest sreq,
|
||||||
boolean fancyErrors,
|
boolean fancyErrors,
|
||||||
boolean useCache) {
|
boolean useCache) {
|
||||||
|
|
||||||
Assert.exists(sreq, HttpServletRequest.class);
|
Assert.exists(sreq, HttpServletRequest.class);
|
||||||
|
|
||||||
final URL sheet = getConfig().getStylesheetResolver().resolve(sreq);
|
final URL sheet = getConfig().getStylesheetResolver().resolve(sreq);
|
||||||
|
|
||||||
Assert.exists(sheet, URL.class);
|
Assert.exists(sheet, URL.class);
|
||||||
|
|
||||||
return Templating.getTemplate(sheet, fancyErrors, useCache);
|
return Templating.getTemplate(sheet, fancyErrors, useCache);
|
||||||
|
|
@ -296,7 +303,7 @@ public class Templating {
|
||||||
* @return a virtual XSL file
|
* @return a virtual XSL file
|
||||||
*/
|
*/
|
||||||
public static InputStream multiplexXSLFiles(Iterator paths) {
|
public static InputStream multiplexXSLFiles(Iterator paths) {
|
||||||
StringBuffer buf = new StringBuffer();
|
// StringBuilder buf = new StringBuilder();
|
||||||
Element root = new Element("xsl:stylesheet",
|
Element root = new Element("xsl:stylesheet",
|
||||||
"http://www.w3.org/1999/XSL/Transform");
|
"http://www.w3.org/1999/XSL/Transform");
|
||||||
root.addAttribute("version", "1.0");
|
root.addAttribute("version", "1.0");
|
||||||
|
|
@ -328,33 +335,75 @@ public class Templating {
|
||||||
return new ByteArrayInputStream(doc.toString(true).getBytes());
|
return new ByteArrayInputStream(doc.toString(true).getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transforms a URL, short-circuiting access to the resource
|
/**
|
||||||
// servlet. This xfrms most http:// urls into file:// allowing
|
* Transforms an URL, that refers to a local resource inside the running
|
||||||
// XSLT invalidation to work for these resources. It has the
|
* CCM web application. NON-local URLs remain unmodified.
|
||||||
// added benefit of speeding up loading of XSL...
|
*
|
||||||
|
* In case of a virtual path "/resource" it is short-circuiting access to
|
||||||
|
* the resource servlet. All other http:// URLs are transformed into file://
|
||||||
|
* for XSLT validation to work for these resources. It has the added benefit
|
||||||
|
* of speeding up loading of XSL...
|
||||||
|
*/
|
||||||
static URL transformURL(URL url) {
|
static URL transformURL(URL url) {
|
||||||
HttpHost self = Web.getConfig().getHost();
|
HttpHost self = Web.getConfig().getHost();
|
||||||
|
|
||||||
String path = url.getPath();
|
/** Indicates whether url refers to a local resource inside the
|
||||||
if (self.getName().equals(url.getHost()) && ((self.getPort() == url.
|
* running CCM web application (inside it's webapp context) */
|
||||||
getPort()) || (url.getPort()
|
Boolean isLocal = false;
|
||||||
== -1
|
/** Contains the transformed "localized" path to url, i.e. without
|
||||||
&& self.
|
* host part. */
|
||||||
getPort()
|
String localPath = "";
|
||||||
== 80))) {
|
|
||||||
|
|
||||||
if (path.startsWith("/resource")) {
|
// Check if the url refers to our own host
|
||||||
// A virtual path to the servlet
|
if (self.getName().equals(url.getHost())
|
||||||
path = path.substring("/resource".length());
|
&& ( (self.getPort() == url.getPort())
|
||||||
URL newURL = Web.findResource(path);
|
|| (url.getPort()== -1 && self.getPort()== 80)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
// host part denotes to a local resource, cut off host part.
|
||||||
|
localPath = url.getPath();
|
||||||
|
isLocal = true;
|
||||||
|
}
|
||||||
|
// java.net.URL is unaware of JavaEE webapplication. If CCM is not
|
||||||
|
// installed into the ROOT context, the path includes the webapp part
|
||||||
|
// which must be removed as well.
|
||||||
|
// It's a kind of HACK, unfortunately. If CCM is installed into the
|
||||||
|
// root context we don't detect whether the first part of the path
|
||||||
|
// refers to another web application inside the host and assume local
|
||||||
|
// and unrestricted access. The complete code should get refactored to
|
||||||
|
// use ServletContext#getResource(path)
|
||||||
|
String installContext = Web.getWebappContextPath();
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.debug("Installation context is >" + installContext + "<.");
|
||||||
|
}
|
||||||
|
if (!installContext.equals("")) {
|
||||||
|
// CCM is installed into a non-ROOT context
|
||||||
|
if (localPath.startsWith(installContext)) {
|
||||||
|
// remove webapp context part
|
||||||
|
localPath = localPath.substring(installContext.length());
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.debug("WebApp context removed: >>" +
|
||||||
|
localPath + "<<");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isLocal) {
|
||||||
|
// url specifies the running CCM host and port (or port isn't
|
||||||
|
// specified in url and default for running CCM host
|
||||||
|
|
||||||
|
if (localPath.startsWith("/resource")) {
|
||||||
|
// A virtual path to the ResourceServlet
|
||||||
|
localPath = localPath.substring("/resource".length()); //remove virtual part
|
||||||
|
URL newURL = Web.findResource(localPath); //without host part here!
|
||||||
if (s_log.isDebugEnabled()) {
|
if (s_log.isDebugEnabled()) {
|
||||||
s_log.debug("Transforming resource " + url + " to " + newURL);
|
s_log.debug("Transforming resource " + url + " to " + newURL);
|
||||||
}
|
}
|
||||||
return newURL;
|
return newURL;
|
||||||
} else {
|
} else {
|
||||||
// A real path to disk
|
// A real path to disk
|
||||||
final String filename =
|
final String filename = Web.getServletContext()
|
||||||
Web.getServletContext().getRealPath(path);
|
.getRealPath(localPath);
|
||||||
File file = new File(filename);
|
File file = new File(filename);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -375,12 +424,14 @@ public class Templating {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// url is not the (local) running CCM host, no transformation
|
||||||
|
// is done
|
||||||
if (s_log.isDebugEnabled()) {
|
if (s_log.isDebugEnabled()) {
|
||||||
s_log.debug("URL " + url + " is not local");
|
s_log.debug("URL " + url + " is not local");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return url;
|
return url; // returns the original, unmodified url here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -388,7 +439,7 @@ class LoggingErrorListener implements ErrorListener {
|
||||||
|
|
||||||
private static final Logger s_log =
|
private static final Logger s_log =
|
||||||
Logger.getLogger(LoggingErrorListener.class);
|
Logger.getLogger(LoggingErrorListener.class);
|
||||||
private ArrayList m_errors;
|
private final ArrayList m_errors;
|
||||||
|
|
||||||
LoggingErrorListener() {
|
LoggingErrorListener() {
|
||||||
m_errors = new ArrayList();
|
m_errors = new ArrayList();
|
||||||
|
|
@ -398,14 +449,17 @@ class LoggingErrorListener implements ErrorListener {
|
||||||
return m_errors;
|
return m_errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void warning(TransformerException e) throws TransformerException {
|
public void warning(TransformerException e) throws TransformerException {
|
||||||
log(Level.WARN, e);
|
log(Level.WARN, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void error(TransformerException e) throws TransformerException {
|
public void error(TransformerException e) throws TransformerException {
|
||||||
log(Level.ERROR, e);
|
log(Level.ERROR, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void fatalError(TransformerException e) throws TransformerException {
|
public void fatalError(TransformerException e) throws TransformerException {
|
||||||
log(Level.FATAL, e);
|
log(Level.FATAL, e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,31 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public final class TemplatingConfig extends AbstractConfig {
|
public final class TemplatingConfig extends AbstractConfig {
|
||||||
|
|
||||||
|
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||||
|
* by editing /WEB-INF/conf/log4j.properties int hte runtime environment
|
||||||
|
* and set com.arsdigita.templating.TemplatingConfig=DEBUG by uncommenting
|
||||||
|
* it */
|
||||||
private static final Logger s_log = Logger.getLogger
|
private static final Logger s_log = Logger.getLogger
|
||||||
(TemplatingConfig.class);
|
(TemplatingConfig.class);
|
||||||
|
|
||||||
|
/** Singelton config object. */
|
||||||
|
private static TemplatingConfig s_conf;
|
||||||
|
/**
|
||||||
|
* Gain a WorkspaceConfig object.
|
||||||
|
*
|
||||||
|
* Singelton pattern, don't instantiate a config object using the
|
||||||
|
* constructor directly!
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static synchronized TemplatingConfig getInstanceOf() {
|
||||||
|
if (s_conf == null) {
|
||||||
|
s_conf = new TemplatingConfig();
|
||||||
|
s_conf.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
return s_conf;
|
||||||
|
}
|
||||||
|
|
||||||
/** Fully qualified path string to file contain the pattern file for
|
/** Fully qualified path string to file contain the pattern file for
|
||||||
{@link com.arsdigita.templating.PatternStylesheetResolver
|
{@link com.arsdigita.templating.PatternStylesheetResolver
|
||||||
PatternStylesheetResolver} */
|
PatternStylesheetResolver} */
|
||||||
|
|
@ -80,17 +102,20 @@ public final class TemplatingConfig extends AbstractConfig {
|
||||||
* Gets the stylesheet resolver. This value is set via the
|
* Gets the stylesheet resolver. This value is set via the
|
||||||
* <code>com.arsdigita.templating.stylesheet_resolver</code>
|
* <code>com.arsdigita.templating.stylesheet_resolver</code>
|
||||||
* system property.
|
* system property.
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public final StylesheetResolver getStylesheetResolver() {
|
public final StylesheetResolver getStylesheetResolver() {
|
||||||
return (StylesheetResolver) get(m_resolver);
|
return (StylesheetResolver) get(m_resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Can be null. */
|
/** Can be null.
|
||||||
|
* @return */
|
||||||
public final Integer getCacheSize() {
|
public final Integer getCacheSize() {
|
||||||
return (Integer) get(m_cacheSize);
|
return (Integer) get(m_cacheSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Can be null. */
|
/** Can be null.
|
||||||
|
* @return */
|
||||||
public final Integer getCacheAge() {
|
public final Integer getCacheAge() {
|
||||||
return (Integer) get(m_cacheAge);
|
return (Integer) get(m_cacheAge);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ public class URLPatternGenerator implements PatternGenerator {
|
||||||
|
|
||||||
private String getPath() {
|
private String getPath() {
|
||||||
String base = getBasePath();
|
String base = getBasePath();
|
||||||
String url = Web.getContext().getRequestURL().getPathInfo();
|
String url = Web.getWebContext().getRequestURL().getPathInfo();
|
||||||
|
|
||||||
if (s_log.isDebugEnabled()) {
|
if (s_log.isDebugEnabled()) {
|
||||||
s_log.debug("Base is " + base + " url is " + url);
|
s_log.debug("Base is " + base + " url is " + url);
|
||||||
|
|
@ -145,16 +145,16 @@ public class URLPatternGenerator implements PatternGenerator {
|
||||||
/**
|
/**
|
||||||
* Provides the base URL of the application in the current Web request
|
* Provides the base URL of the application in the current Web request
|
||||||
* (i.e. application's PrimaryURL). If no application can be found or
|
* (i.e. application's PrimaryURL). If no application can be found or
|
||||||
* no PrimaryURL can be determined ROOT ("/") is returned.
|
no PrimaryURL can be determined ROOT ("/") is returned.
|
||||||
*
|
|
||||||
* XXX fix me, why can't we get this from Web.getContext().getRequestURL
|
XXX fix me, why can't we get this from Web.getWebContext().getRequestURL
|
||||||
*
|
*
|
||||||
* @return primary url of an application or ROOT
|
* @return primary url of an application or ROOT
|
||||||
*/
|
*/
|
||||||
private String getBasePath() {
|
private String getBasePath() {
|
||||||
|
|
||||||
// retrieve the application of the request
|
// retrieve the application of the request
|
||||||
Application app = Web.getContext().getApplication();
|
Application app = Web.getWebContext().getApplication();
|
||||||
if (app == null) {
|
if (app == null) {
|
||||||
return "/";
|
return "/";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -33,44 +33,60 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class WebAppPatternGenerator implements PatternGenerator {
|
public class WebAppPatternGenerator implements PatternGenerator {
|
||||||
|
|
||||||
/** Private Logger instance for debugging purpose. */
|
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||||
|
* by editing /WEB-INF/conf/log4j.properties int hte runtime environment
|
||||||
|
* and set com.arsdigita.templating.WebAppPatternGenerator=DEBUG by
|
||||||
|
* uncommenting or adding the line. */
|
||||||
private static final Logger s_log =
|
private static final Logger s_log =
|
||||||
Logger.getLogger(WebAppPatternGenerator.class);
|
Logger.getLogger(WebAppPatternGenerator.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param key placeholder from the pattern string, without surrounding
|
||||||
|
* colons, constantly "webapp" here.
|
||||||
|
* @param req current HttpServletRequest
|
||||||
|
* @return List of webapps contextPath names in an Array of Strings.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public String[] generateValues(String key,
|
public String[] generateValues(String key,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
|
|
||||||
Application app = Web.getContext().getApplication();
|
Application app = Web.getWebContext().getApplication();
|
||||||
String ctx = app == null ? null : app.getContextPath();
|
String ctx = (app == null) ? null : app.getContextPath();
|
||||||
|
|
||||||
if (s_log.isDebugEnabled()) {
|
|
||||||
s_log.debug("Generating Values key: " + key + " [" +
|
|
||||||
"Web.getContext(): " + Web.getContext() + "," +
|
|
||||||
"Application: " + Web.getContext().getApplication() + "," +
|
|
||||||
"ContextPath: " + ctx + "," + "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app == null || ctx == null || "".equals(ctx)) {
|
if (app == null || ctx == null || "".equals(ctx)) {
|
||||||
return new String[] { Web.ROOT_WEBAPP }; // Currently "ROOT"
|
ctx = Web.getWebappContextPath() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JavaEE requires a leading "/" for web context part, but the pattern
|
||||||
|
// string already contains a "/", so we have to remove it here to
|
||||||
|
// too avoid a "//"
|
||||||
if (ctx.startsWith("/")) {
|
if (ctx.startsWith("/")) {
|
||||||
ctx = ctx.substring(1);
|
ctx = ctx.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.debug("Generating Values key: " + key + " [" +
|
||||||
|
"Web.getWebContext(): " + Web.getWebContext() + " ," +
|
||||||
|
"Application: " + Web.getWebContext().getApplication() + "," +
|
||||||
|
"ContextPath: >" + ctx + "<]");
|
||||||
|
}
|
||||||
|
|
||||||
/* "Older version: prior 6.6. Some modules used to be installed into
|
/* "Older version: prior 6.6. Some modules used to be installed into
|
||||||
* its own web application context, but needed access to the main
|
* its own web application context, but needed access to the main
|
||||||
* applications package files (e.g. bebop) which were installed into
|
* applications package files (e.g. bebop). Therefore the webapp context
|
||||||
* to ROOT web context. Therefore ROOT had to be added.
|
* (ServletContext in API speech) of the main CCM application had to be
|
||||||
*/
|
* added (which was ROOT by default)
|
||||||
// return new String[] { ctx + "," + Web.ROOT_WEBAPP };
|
*
|
||||||
|
* As of version 6.6 all packages are installed in one web application
|
||||||
/* As of version 6.6 all packages are installed in one web application
|
* context, therefore no additional entry is required.
|
||||||
* context, therefore the ROOT entry is no longer valid.
|
|
||||||
* This variation had first be introduced with the APLAWS integration
|
* This variation had first be introduced with the APLAWS integration
|
||||||
* package, which used to register an additional WebAppPatternGenerator,
|
* package, which used to register an additional WebAppPatternGenerator,
|
||||||
* which simply cuts ","+ Web.ROOT_WEBAPP, under a different key
|
* which simply cuts ","+ Web.ROOT_WEBAPP, under a different key
|
||||||
* "Webapp" (singular) */
|
* "Webapp" (singular) */
|
||||||
|
// return new String[] { ctx + "," + Web.getRootWebappContextPath() };
|
||||||
|
|
||||||
|
|
||||||
return new String[] { ctx };
|
return new String[] { ctx };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ public interface XSLParameterGenerator {
|
||||||
* This returns the correct value for the parameter. This is the
|
* This returns the correct value for the parameter. This is the
|
||||||
* value that is added to the transformer and is available to all
|
* value that is added to the transformer and is available to all
|
||||||
* stylesheets
|
* stylesheets
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public String generateValue(HttpServletRequest request);
|
public String generateValue(HttpServletRequest request);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,14 @@ import org.w3c.dom.Document;
|
||||||
*/
|
*/
|
||||||
public final class XSLTemplate {
|
public final class XSLTemplate {
|
||||||
|
|
||||||
|
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||||
|
* by editing /WEB-INF/conf/log4j.properties int hte runtime environment
|
||||||
|
* and set com.arsdigita.templating.XSLTemplate=DEBUG by uncommenting
|
||||||
|
* or adding the line. */
|
||||||
private static final Logger s_log = Logger.getLogger(XSLTemplate.class);
|
private static final Logger s_log = Logger.getLogger(XSLTemplate.class);
|
||||||
|
|
||||||
|
/** Property containing the URL to the XSL source file or create this
|
||||||
|
* instance */
|
||||||
private final URL m_source;
|
private final URL m_source;
|
||||||
private final Templates m_templates;
|
private final Templates m_templates;
|
||||||
private final List m_dependents;
|
private final List m_dependents;
|
||||||
|
|
@ -102,6 +109,11 @@ public final class XSLTemplate {
|
||||||
throw new WrappedTransformerException(ex);
|
throw new WrappedTransformerException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List contains each include/import URL found in the style sheet
|
||||||
|
// recursively(!) (i.e. scanning each style sheet whose URL has been
|
||||||
|
// found in a style sheet, etc.
|
||||||
|
// In case of Mandalay (single entry stylesheet) about 250 URL's, all
|
||||||
|
// resolved when found Mandalay's start.xml in one go.
|
||||||
m_dependents = resolver.getStylesheetURIs();
|
m_dependents = resolver.getStylesheetURIs();
|
||||||
m_created = new Date();
|
m_created = new Date();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public class DebugPanel extends SimpleComponent {
|
||||||
UIConstants.UI_XML_NS);
|
UIConstants.UI_XML_NS);
|
||||||
exportAttributes(content);
|
exportAttributes(content);
|
||||||
|
|
||||||
URL here = Web.getContext().getRequestURL();
|
URL here = Web.getWebContext().getRequestURL();
|
||||||
|
|
||||||
URL xmlURL = selfURL(state, here, "output", "xml");
|
URL xmlURL = selfURL(state, here, "output", "xml");
|
||||||
URL xslURL = selfURL(state, here, "output", "xsl");
|
URL xslURL = selfURL(state, here, "output", "xsl");
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class UserAuthenticationListener implements RequestListener {
|
||||||
// first make sure we're not already looking at the login
|
// first make sure we're not already looking at the login
|
||||||
// page -- if we are, don't redirect!
|
// page -- if we are, don't redirect!
|
||||||
|
|
||||||
if (urlBase.equals(Web.getContext().getRequestURL().getRequestURI())) {
|
if (urlBase.equals(Web.getWebContext().getRequestURL().getRequestURI())) {
|
||||||
s_log.debug("preventing cyclic redirect to: " + urlBase);
|
s_log.debug("preventing cyclic redirect to: " + urlBase);
|
||||||
// return without redirect
|
// return without redirect
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,10 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public abstract class Record {
|
public abstract class Record {
|
||||||
|
|
||||||
|
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||||
|
* by editing /WEB-INF/conf/log4j.properties int the runtime environment
|
||||||
|
* and set com.arsdigita.util.Record=DEBUG
|
||||||
|
* by uncommenting or adding the line. */
|
||||||
private static final Logger s_log = Logger.getLogger(Record.class);
|
private static final Logger s_log = Logger.getLogger(Record.class);
|
||||||
|
|
||||||
private Class m_class;
|
private Class m_class;
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ public class ResourceManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new InputStream object reading the URL argument.
|
* Returns a new InputStream object reading the URL argument.
|
||||||
* Behaves similarly to ServletContext.getResourceAsStream(),
|
* Behaves similarly to ServletContext.getResourceAsStream(), reading
|
||||||
* reading pathnames relative to the webapp root.
|
* pathnames relative to the webapp root.
|
||||||
*
|
*
|
||||||
* @param url a URL interpreted as a pathname relative to the webapp root
|
* @param url a URL interpreted as a pathname relative to the webapp root
|
||||||
* @return a new input stream reading the named file, or null
|
* @return a new input stream reading the named file, or null
|
||||||
|
|
@ -81,12 +81,14 @@ public class ResourceManager {
|
||||||
* not configured prior to use.
|
* not configured prior to use.
|
||||||
*/
|
*/
|
||||||
public InputStream getResourceAsStream(String url) {
|
public InputStream getResourceAsStream(String url) {
|
||||||
|
|
||||||
if (m_webappRoot == null && m_servletContext == null) {
|
if (m_webappRoot == null && m_servletContext == null) {
|
||||||
throw new IllegalStateException(CONFIGURE_MESSAGE);
|
throw new IllegalStateException(CONFIGURE_MESSAGE);
|
||||||
}
|
}
|
||||||
if (StringUtils.emptyString(url)) {
|
if (StringUtils.emptyString(url)) {
|
||||||
throw new IllegalArgumentException("URL is empty: " + url);
|
throw new IllegalArgumentException("URL is empty: " + url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_servletContext != null) {
|
if (m_servletContext != null) {
|
||||||
// If we have a Servlet Context, use it.
|
// If we have a Servlet Context, use it.
|
||||||
InputStream is = m_servletContext.getResourceAsStream(url);
|
InputStream is = m_servletContext.getResourceAsStream(url);
|
||||||
|
|
@ -212,6 +214,7 @@ public class ResourceManager {
|
||||||
/**
|
/**
|
||||||
* Returns the last-modified time for the file on disk.
|
* Returns the last-modified time for the file on disk.
|
||||||
*
|
*
|
||||||
|
* @param path
|
||||||
* @return the last-modified time for the file on disk. Returns
|
* @return the last-modified time for the file on disk. Returns
|
||||||
* 0L if this isn't available (within a WAR file, for example),
|
* 0L if this isn't available (within a WAR file, for example),
|
||||||
* the file isn't found, or there's an I/O error. This is consistent
|
* the file isn't found, or there's an I/O error. This is consistent
|
||||||
|
|
|
||||||
|
|
@ -615,6 +615,10 @@ public class Application extends Resource {
|
||||||
return canonicalURL;
|
return canonicalURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getContextPath() {
|
public String getContextPath() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
@ -663,7 +667,7 @@ public class Application extends Resource {
|
||||||
@Override
|
@Override
|
||||||
protected void beforeSave() {
|
protected void beforeSave() {
|
||||||
if (isPropertyModified(PRIMARY_URL) || isNew()) {
|
if (isPropertyModified(PRIMARY_URL) || isNew()) {
|
||||||
BaseDispatcher.scheduleRefresh();
|
CCMDispatcherServlet.scheduleRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.beforeSave();
|
super.beforeSave();
|
||||||
|
|
@ -687,7 +691,7 @@ public class Application extends Resource {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void afterDelete() {
|
public void afterDelete() {
|
||||||
BaseDispatcher.scheduleRefresh();
|
CCMDispatcherServlet.scheduleRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -68,14 +68,14 @@ import org.apache.log4j.Logger;
|
||||||
* In the Application class it should define:
|
* In the Application class it should define:
|
||||||
* </p>
|
* </p>
|
||||||
* <pre>
|
* <pre>
|
||||||
* public String getContextPath() {
|
public String getWebContextPath() {
|
||||||
* return "ccm-mywebapp";
|
return "ccm-mywebapp";
|
||||||
* }
|
}
|
||||||
*
|
|
||||||
* public String getServletPath() {
|
public String getServletPath() {
|
||||||
* return "/files";
|
return "/files";
|
||||||
* }
|
}
|
||||||
* </pre>
|
</pre>
|
||||||
* <p>
|
* <p>
|
||||||
* It can then put JSP files in a 'templates/ccm-mywebapp' directory at
|
* It can then put JSP files in a 'templates/ccm-mywebapp' directory at
|
||||||
* the root of its private webapp. Files in this directory can be scoped by
|
* the root of its private webapp. Files in this directory can be scoped by
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
||||||
throw new IllegalStateException("Application not found");
|
throw new IllegalStateException("Application not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
Web.getContext().setApplication(app);
|
Web.getWebContext().setApplication(app);
|
||||||
|
|
||||||
final RequestContext rc = makeLegacyContext
|
final RequestContext rc = makeLegacyContext
|
||||||
(sreq, app, Web.getUserContext());
|
(sreq, app, Web.getUserContext());
|
||||||
|
|
|
||||||
|
|
@ -35,39 +35,43 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A base class for filters that require a persistence
|
* A base class for filters that require a persistence session to be present.
|
||||||
* session to be present. This implements the doFilter
|
* This implements the doFilter method to open up a default persistence session,
|
||||||
* method to open up a default persistence session, and
|
* and then hand off to the doService method. Subclasses should override this
|
||||||
* then hand off to the doService method. Subclasses
|
* doService method to provide the processing they require.
|
||||||
* should override this doService method to provide the
|
|
||||||
* processing they require.
|
|
||||||
*
|
*
|
||||||
* Assumes a initialized database connection and domain
|
* Assumes an initialized database connection and domain coupling machinery
|
||||||
* coupling machinery (provided by CCMApplicationListener
|
* (provided by CCMApplicationListener during container startup).
|
||||||
* during container startup).
|
|
||||||
*
|
*
|
||||||
* Actually, the class does nothing at all!
|
* Actually, the class does nothing at all!
|
||||||
*/
|
*/
|
||||||
public class BaseFilter implements Filter {
|
public class BaseFilter implements Filter {
|
||||||
|
|
||||||
private static Logger s_log = Logger.getLogger(BaseFilter.class);
|
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||||
|
* by editing /WEB-INF/conf/log4j.properties int the runtime environment
|
||||||
|
* and set com.arsdigita.web.BaseFilter=DEBUG
|
||||||
|
* by uncommenting or adding the line. */
|
||||||
|
private static final Logger s_log = Logger.getLogger(BaseFilter.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Initialization code, introduces an extension point for subclasses.
|
||||||
* @param sconfig
|
* @param sconfig
|
||||||
* @throws javax.servlet.ServletException
|
* @throws javax.servlet.ServletException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void init(final FilterConfig sconfig) throws ServletException {
|
public final void init(final FilterConfig sconfig) throws ServletException {
|
||||||
if (s_log.isInfoEnabled()) {
|
if (s_log.isInfoEnabled()) {
|
||||||
s_log.info("Initializing filter " + sconfig.getFilterName() +
|
s_log.info("Initializing filter " + sconfig.getFilterName() +
|
||||||
" (class: " + getClass().getName() + ")");
|
" (class: " + getClass().getName() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// extension point for subclasses
|
||||||
doInit();
|
doInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Initialization extension stub. Subclasses should overwrite this method
|
||||||
|
* to add functionality as required.
|
||||||
* @throws javax.servlet.ServletException
|
* @throws javax.servlet.ServletException
|
||||||
*/
|
*/
|
||||||
protected void doInit() throws ServletException {
|
protected void doInit() throws ServletException {
|
||||||
|
|
@ -75,8 +79,9 @@ public class BaseFilter implements Filter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Shutdown code, introduces an extension point for subclasses.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void destroy() {
|
public final void destroy() {
|
||||||
if (s_log.isInfoEnabled()) {
|
if (s_log.isInfoEnabled()) {
|
||||||
s_log.info
|
s_log.info
|
||||||
|
|
@ -87,7 +92,8 @@ public class BaseFilter implements Filter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Shutdown extension stub. Subclasses should overwrite this method
|
||||||
|
* to add functionality as required and properly stopp services.
|
||||||
*/
|
*/
|
||||||
protected void doDestroy() {
|
protected void doDestroy() {
|
||||||
// Empty
|
// Empty
|
||||||
|
|
@ -101,6 +107,7 @@ public class BaseFilter implements Filter {
|
||||||
* @throws java.io.IOException
|
* @throws java.io.IOException
|
||||||
* @throws javax.servlet.ServletException
|
* @throws javax.servlet.ServletException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void doFilter(ServletRequest sreq,
|
public void doFilter(ServletRequest sreq,
|
||||||
ServletResponse sresp,
|
ServletResponse sresp,
|
||||||
FilterChain chain)
|
FilterChain chain)
|
||||||
|
|
@ -118,6 +125,11 @@ public class BaseFilter implements Filter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the extension point for users of this class.
|
* This is the extension point for users of this class.
|
||||||
|
* @param sreq
|
||||||
|
* @param sresp
|
||||||
|
* @param chain
|
||||||
|
* @throws javax.servlet.ServletException
|
||||||
|
* @throws java.io.IOException
|
||||||
*/
|
*/
|
||||||
protected void doService(final HttpServletRequest sreq,
|
protected void doService(final HttpServletRequest sreq,
|
||||||
final HttpServletResponse sresp,
|
final HttpServletResponse sresp,
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ import org.apache.log4j.Logger;
|
||||||
*
|
*
|
||||||
* <blockquote><pre>
|
* <blockquote><pre>
|
||||||
* <%@page extends="com.arsdigita.web.BaseJSP" %>
|
* <%@page extends="com.arsdigita.web.BaseJSP" %>
|
||||||
* <b><%= Web.getContext().getUser().toString() %></b>
|
* <b><%= Web.getWebContext().getUser().toString() %></b>
|
||||||
* </pre></blockquote>
|
* </pre></blockquote>
|
||||||
*
|
*
|
||||||
* @see com.arsdigita.web.BaseServlet
|
* @see com.arsdigita.web.BaseServlet
|
||||||
|
|
@ -43,13 +43,18 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public abstract class BaseJSP extends BaseServlet implements HttpJspPage {
|
public abstract class BaseJSP extends BaseServlet implements HttpJspPage {
|
||||||
|
|
||||||
/** A logger instance, primarily to assist debugging . */
|
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||||
private static Logger s_log = Logger.getLogger(BaseJSP.class);
|
* by editing /WEB-INF/conf/log4j.properties int the runtime environment
|
||||||
|
* and set com.arsdigita.web.BaseJSP=DEBUG
|
||||||
|
* by uncommenting or adding the line. */
|
||||||
|
private static final Logger s_log = Logger.getLogger(BaseJSP.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Invokes the <code>_jspService(sreq, sresp)</code> method in
|
* <p>Invokes the <code>_jspService(sreq, sresp)</code> method in
|
||||||
* the environment prepared by <code>BaseServlet</code>.</p>
|
* the environment prepared by <code>BaseServlet</code>.</p>
|
||||||
*
|
*
|
||||||
|
* @throws javax.servlet.ServletException
|
||||||
|
* @throws java.io.IOException
|
||||||
* @see #_jspService(HttpServletRequest,HttpServletResponse)
|
* @see #_jspService(HttpServletRequest,HttpServletResponse)
|
||||||
* @see com.arsdigita.web.BaseServlet
|
* @see com.arsdigita.web.BaseServlet
|
||||||
* @see com.arsdigita.web.BaseServlet#doService(HttpServletRequest,HttpServletResponse)
|
* @see com.arsdigita.web.BaseServlet#doService(HttpServletRequest,HttpServletResponse)
|
||||||
|
|
@ -86,16 +91,23 @@ public abstract class BaseJSP extends BaseServlet implements HttpJspPage {
|
||||||
* <p>The method that JSP compilers will override to produce the
|
* <p>The method that JSP compilers will override to produce the
|
||||||
* body of the page.</p>
|
* body of the page.</p>
|
||||||
*
|
*
|
||||||
|
* @param sreq
|
||||||
|
* @param sresp
|
||||||
|
* @throws javax.servlet.ServletException
|
||||||
|
* @throws java.io.IOException
|
||||||
* @see javax.servlet.jsp.HttpJspPage#_jspService(HttpServletRequest,HttpServletResponse)
|
* @see javax.servlet.jsp.HttpJspPage#_jspService(HttpServletRequest,HttpServletResponse)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public abstract void _jspService(HttpServletRequest sreq,
|
public abstract void _jspService(HttpServletRequest sreq,
|
||||||
HttpServletResponse sresp)
|
HttpServletResponse sresp)
|
||||||
throws ServletException, IOException;
|
throws ServletException, IOException;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void jspInit()
|
public void jspInit()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void jspDestroy()
|
public void jspDestroy()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue