Search in sources :

Example 6 with IPortletDescriptorKey

use of org.apereo.portal.portlet.om.IPortletDescriptorKey in project uPortal by Jasig.

the class WebAppNameContainsStringPredicate method test.

@Override
public boolean test(final HttpServletRequest request) {
    try {
        final IPortletDefinition portletDefinition = utils.getPortletDefinitionFromServletRequest(request);
        IPortletDescriptorKey portletDescriptorKey = portletDefinition.getPortletDescriptorKey();
        String portletWebAppName = portletDescriptorKey.getWebAppName();
        boolean doesMatch = portletWebAppName.contains(this.webAppNameToMatch);
        if (logger.isDebugEnabled()) {
            if (doesMatch) {
                logger.debug("Predicate is true: observed web app name [{}]" + " does match configured name [{}].", portletWebAppName, this.webAppNameToMatch);
            } else {
                logger.debug("Predicate is false: observed web app name [{}]" + " does not match configured name [{}].", portletWebAppName, this.webAppNameToMatch);
            }
        }
        return doesMatch;
    } catch (Exception e) {
        logger.error("Failed to process web app name contains string check for redirect during pipeline. Failing gracefully by returning false.", e);
    }
    return false;
}
Also used : IPortletDescriptorKey(org.apereo.portal.portlet.om.IPortletDescriptorKey) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Example 7 with IPortletDescriptorKey

use of org.apereo.portal.portlet.om.IPortletDescriptorKey in project uPortal by Jasig.

the class PortletExecutionManager method getModifiedTimeout.

/**
 * This method handles portlets that are slow to warm up. The default config multiplies the
 * portlet's configured timeout by 20 the first 5 times it executes. The key is the portlet
 * descriptor so even if you have the same portlet (web proxy for example) published 20 times
 * only the first 5 renders of ANY WPP will get the extra time.
 *
 * @param portletDefinition
 * @param request
 * @param timeout
 * @return
 */
protected final long getModifiedTimeout(IPortletDefinition portletDefinition, HttpServletRequest request, long timeout) {
    final IPortletDescriptorKey portletDescriptorKey = portletDefinition.getPortletDescriptorKey();
    final AtomicInteger counter = this.executionCount.get(portletDescriptorKey);
    final int executionCount = counter.get();
    if (executionCount > extendedTimeoutExecutions) {
        return timeout;
    }
    if (logger.isDebugEnabled()) {
        logger.debug(String.format("Modifying timeout for %40s from %7s to %8s on execution %2s\n", portletDescriptorKey.toString(), timeout, timeout * extendedTimeoutMultiplier, executionCount));
    }
    return timeout * extendedTimeoutMultiplier;
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IPortletDescriptorKey(org.apereo.portal.portlet.om.IPortletDescriptorKey)

Aggregations

IPortletDescriptorKey (org.apereo.portal.portlet.om.IPortletDescriptorKey)7 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 IPortletDefinitionParameter (org.apereo.portal.portlet.om.IPortletDefinitionParameter)2 IPortletPreference (org.apereo.portal.portlet.om.IPortletPreference)2 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 QName (javax.xml.namespace.QName)1 Attribute (javax.xml.stream.events.Attribute)1 IEntityGroup (org.apereo.portal.groups.IEntityGroup)1 IGroupMember (org.apereo.portal.groups.IGroupMember)1 ExternalPermissionDefinition (org.apereo.portal.io.xml.portlettype.ExternalPermissionDefinition)1 PortletDefinitionImpl (org.apereo.portal.portlet.dao.jpa.PortletDefinitionImpl)1