Search in sources :

Example 16 with IPortalRequestInfo

use of org.apereo.portal.url.IPortalRequestInfo in project uPortal by Jasig.

the class FocusedOnOnePortletPredicate method apply.

@Override
public boolean apply(final HttpServletRequest request) {
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
    if (null == portalRequestInfo) {
        logger.warn("Portal request info was not available for this request, " + "so assuming that it does not represent focus on one portlet.");
        // focused-on-one-portlet portal state.
        return false;
    }
    final UrlState urlState = portalRequestInfo.getUrlState();
    // true when there is a portal request and that request is not for a portal in NORMAL state
    // i.e. portal is in some other state, like Maximized or Exclusive or Detached.
    // false otherwise.
    final boolean doesRequestFocusOnOnePortlet = (!(UrlState.NORMAL.equals(urlState)));
    logger.debug("Determined request with UrlState {} {} focus on one portlet.", urlState, doesRequestFocusOnOnePortlet ? "does" : "does not");
    return doesRequestFocusOnOnePortlet;
}
Also used : IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) UrlState(org.apereo.portal.url.UrlState)

Example 17 with IPortalRequestInfo

use of org.apereo.portal.url.IPortalRequestInfo in project uPortal by Jasig.

the class URLInSpecificState method apply.

@Override
public boolean apply(final HttpServletRequest request) {
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
    if (null == portalRequestInfo) {
        logger.warn("Portal request info was not available for this request, " + "so assuming that it does not represent focus on one portlet.");
        // focused-on-one-portlet portal state.
        return false;
    }
    final UrlState urlState = portalRequestInfo.getUrlState();
    boolean stateEqual = urlState.toString().equals(state);
    return isNegated ? !stateEqual : stateEqual;
}
Also used : IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) UrlState(org.apereo.portal.url.UrlState)

Example 18 with IPortalRequestInfo

use of org.apereo.portal.url.IPortalRequestInfo in project uPortal by Jasig.

the class LocalPortletRequestContextServiceImpl method getPortletActionRequestContext.

/* (non-Javadoc)
     * @see org.apache.pluto.container.PortletRequestContextService#getPortletActionRequestContext(org.apache.pluto.container.PortletContainer, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.pluto.container.PortletWindow)
     */
@Override
public PortletRequestContext getPortletActionRequestContext(PortletContainer container, HttpServletRequest containerRequest, HttpServletResponse containerResponse, PortletWindow window) {
    final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(containerRequest, window);
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(containerRequest);
    return new PortletRequestContextImpl(container, portletWindow, containerRequest, containerResponse, this.requestPropertiesManager, portalRequestInfo, portletCookieService, requestAttributeService);
}
Also used : IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) PortletRequestContextImpl(org.apereo.portal.portlet.container.PortletRequestContextImpl) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Example 19 with IPortalRequestInfo

use of org.apereo.portal.url.IPortalRequestInfo in project uPortal by Jasig.

the class LocalPortletRequestContextServiceImpl method getPortletEventRequestContext.

/* (non-Javadoc)
     * @see org.apache.pluto.container.PortletRequestContextService#getPortletEventRequestContext(org.apache.pluto.container.PortletContainer, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.pluto.container.PortletWindow)
     */
@Override
public PortletRequestContext getPortletEventRequestContext(PortletContainer container, HttpServletRequest containerRequest, HttpServletResponse containerResponse, PortletWindow window) {
    final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(containerRequest, window);
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(containerRequest);
    return new PortletRequestContextImpl(container, portletWindow, containerRequest, containerResponse, this.requestPropertiesManager, portalRequestInfo, portletCookieService, requestAttributeService);
}
Also used : IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) PortletRequestContextImpl(org.apereo.portal.portlet.container.PortletRequestContextImpl) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Example 20 with IPortalRequestInfo

use of org.apereo.portal.url.IPortalRequestInfo in project uPortal by Jasig.

the class AnalyticsIncorporationComponent method serializePageData.

protected String serializePageData(HttpServletRequest request, long startTime) {
    final Map<String, Object> pageData = new HashMap<>();
    pageData.put("executionTimeNano", System.nanoTime() - startTime);
    final IPortalRequestInfo portalRequestInfo = urlSyntaxProvider.getPortalRequestInfo(request);
    pageData.put("urlState", portalRequestInfo.getUrlState());
    final String targetedLayoutNodeId = portalRequestInfo.getTargetedLayoutNodeId();
    if (targetedLayoutNodeId != null) {
        final AggregatedTabMapping mappedTabForLayoutId = aggregatedTabLookupDao.getMappedTabForLayoutId(targetedLayoutNodeId);
        pageData.put("tab", mappedTabForLayoutId);
    }
    try {
        return mapper.writeValueAsString(pageData);
    } catch (JsonParseException e) {
        logger.warn("Failed to convert this request's page data to JSON, no page level analytics will be included", e);
    } catch (JsonMappingException e) {
        logger.warn("Failed to convert this request's page data to JSON, no page level analytics will be included", e);
    } catch (IOException e) {
        logger.warn("Failed to convert this request's page data to JSON, no page level analytics will be included", e);
    }
    return "{}";
}
Also used : IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) HashMap(java.util.HashMap) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) IOException(java.io.IOException) JsonParseException(com.fasterxml.jackson.core.JsonParseException) AggregatedTabMapping(org.apereo.portal.events.aggr.tabs.AggregatedTabMapping)

Aggregations

IPortalRequestInfo (org.apereo.portal.url.IPortalRequestInfo)25 IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)12 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)8 IPortletRequestInfo (org.apereo.portal.url.IPortletRequestInfo)6 UrlState (org.apereo.portal.url.UrlState)6 Locale (java.util.Locale)3 PortletRequestContextImpl (org.apereo.portal.portlet.container.PortletRequestContextImpl)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 PrintWriter (java.io.PrintWriter)2 WindowState (javax.portlet.WindowState)2 CharacterEventReader (org.apereo.portal.character.stream.CharacterEventReader)2 CharacterDataEvent (org.apereo.portal.character.stream.events.CharacterDataEvent)2 CharacterEvent (org.apereo.portal.character.stream.events.CharacterEvent)2 IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)2 PortletRenderResult (org.apereo.portal.portlet.rendering.PortletRenderResult)2 JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 ImmutableList (com.google.common.collect.ImmutableList)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1