Search in sources :

Example 6 with IPortalRequestInfo

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

the class PortalController method renderExclusive.

@RequestMapping(headers = { "org.apereo.portal.url.UrlType=RENDER", "org.apereo.portal.url.UrlState.EXCLUSIVE=true" })
public void renderExclusive(HttpServletRequest request, HttpServletResponse response) {
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
    final IPortletRequestInfo portletRequestInfo = portalRequestInfo.getTargetedPortletRequestInfo();
    if (portletRequestInfo == null) {
        throw new IllegalArgumentException("A portlet must be targeted when using the EXCLUSIVE WindowState: " + portalRequestInfo);
    }
    final IPortletWindowId portletWindowId = portletRequestInfo.getPortletWindowId();
    this.portletExecutionManager.getPortletOutput(portletWindowId, request, response);
}
Also used : IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) IPortletRequestInfo(org.apereo.portal.url.IPortletRequestInfo) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with IPortalRequestInfo

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

the class PortalController method resourceRequest.

@RequestMapping(headers = { "org.apereo.portal.url.UrlType=RESOURCE" })
public void resourceRequest(HttpServletRequest request, HttpServletResponse response) {
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
    final IPortletRequestInfo portletRequestInfo = portalRequestInfo.getTargetedPortletRequestInfo();
    if (portletRequestInfo != null) {
        final IPortletWindowId targetWindowId = portletRequestInfo.getPortletWindowId();
        this.portletExecutionManager.doPortletServeResource(targetWindowId, request, response);
    } else {
        this.logger.error("portletRequestInfo was null for resourceRequest");
    }
}
Also used : IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) IPortletRequestInfo(org.apereo.portal.url.IPortletRequestInfo) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with IPortalRequestInfo

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

the class RequestRenderingPipelineUtilsImpl method getPortletDefinitionFromServletRequest.

@Override
public IPortletDefinition getPortletDefinitionFromServletRequest(HttpServletRequest request) {
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
    if (portalRequestInfo != null && portalRequestInfo.getTargetedPortletWindowId() != null) {
        IPortletWindowId targetedPortletWindowId = portalRequestInfo.getTargetedPortletWindowId();
        IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, targetedPortletWindowId);
        if (portletWindow != null && portletWindow.getPortletEntity() != null) {
            final IPortletEntity portletEntity = portletWindow.getPortletEntity();
            IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
            return portletDefinition;
        }
    }
    return null;
}
Also used : IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Example 9 with IPortalRequestInfo

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

the class PortletRendererImpl method publishRenderEvent.

/**
 * Publish the portlet render event
 */
protected void publishRenderEvent(IPortletWindow portletWindow, HttpServletRequest httpServletRequest, RenderPart renderPart, long executionTime, boolean cached) {
    final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
    // Determine if the portlet was targeted
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(httpServletRequest);
    final boolean targeted = portletWindowId.equals(portalRequestInfo.getTargetedPortletWindowId());
    renderPart.publishRenderExecutionEvent(this.portalEventFactory, this, httpServletRequest, portletWindowId, executionTime, targeted, cached);
}
Also used : IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 10 with IPortalRequestInfo

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

the class WindowStateSettingsStAXComponent method getEventReader.

/* (non-Javadoc)
     * @see org.apereo.portal.rendering.PipelineComponent#getEventReader(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
@Override
public PipelineEventReader<XMLEventReader, XMLEvent> getEventReader(HttpServletRequest request, HttpServletResponse response) {
    final PipelineEventReader<XMLEventReader, XMLEvent> pipelineEventReader = this.wrappedComponent.getEventReader(request, response);
    final XMLEventReader eventReader = pipelineEventReader.getEventReader();
    final IStylesheetDescriptor stylesheetDescriptor = stylesheetAttributeSource.getStylesheetDescriptor(request);
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
    final XMLEventReader filteredEventReader;
    if (portalRequestInfo.getTargetedPortletWindowId() == null) {
        final IStylesheetParameterDescriptor defaultWindowStateParam = stylesheetDescriptor.getStylesheetParameterDescriptor("dashboardForcedWindowState");
        if (defaultWindowStateParam != null) {
            // Set all window states to the specified default
            final WindowState windowState = PortletUtils.getWindowState(defaultWindowStateParam.getDefaultValue());
            filteredEventReader = new SinglePortletWindowStateSettingXMLEventReader(request, eventReader, windowState);
        } else {
            // Make sure there aren't any portlets in a "targeted" window state
            filteredEventReader = new NonTargetedPortletWindowStateSettingXMLEventReader(request, eventReader);
        }
    } else {
        // Not mobile, don't bother filtering
        filteredEventReader = eventReader;
    }
    final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties();
    return new PipelineEventReaderImpl<XMLEventReader, XMLEvent>(filteredEventReader, outputProperties);
}
Also used : WindowState(javax.portlet.WindowState) IStylesheetParameterDescriptor(org.apereo.portal.layout.om.IStylesheetParameterDescriptor) IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) XMLEvent(javax.xml.stream.events.XMLEvent) XMLEventReader(javax.xml.stream.XMLEventReader) FilteringXMLEventReader(org.apereo.portal.xml.stream.FilteringXMLEventReader) IStylesheetDescriptor(org.apereo.portal.layout.om.IStylesheetDescriptor)

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