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;
}
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;
}
Aggregations