Search in sources :

Example 11 with IPortletUrlBuilder

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

the class SearchPortletController method calculateAutocompleteResourceUrl.

/**
 * Create a resourceUrl for <code>AJAX_RESPONSE_RESOURCE_ID</code>. The resource URL is for the
 * ajax typing search results response.
 *
 * @param request render request
 * @param response render response
 */
private String calculateAutocompleteResourceUrl(RenderRequest request, RenderResponse response) {
    final HttpServletRequest httpRequest = this.portalRequestUtils.getPortletHttpRequest(request);
    final IPortalUrlBuilder portalUrlBuilder = this.portalUrlProvider.getPortalUrlBuilderByPortletFName(httpRequest, "search", UrlType.RESOURCE);
    final IPortletUrlBuilder portletUrlBuilder = portalUrlBuilder.getPortletUrlBuilder(portalUrlBuilder.getTargetPortletWindowId());
    portletUrlBuilder.setResourceId(AJAX_RESPONSE_RESOURCE_ID);
    return portletUrlBuilder.getPortalUrlBuilder().getUrlString();
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IPortletUrlBuilder(org.apereo.portal.url.IPortletUrlBuilder) IPortalUrlBuilder(org.apereo.portal.url.IPortalUrlBuilder)

Example 12 with IPortletUrlBuilder

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

the class LocalPortletRequestContextServiceImpl method getPortletActionResponseContext.

/* (non-Javadoc)
     * @see org.apache.pluto.container.PortletRequestContextService#getPortletActionResponseContext(org.apache.pluto.container.PortletContainer, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.pluto.container.PortletWindow)
     */
@Override
public PortletActionResponseContext getPortletActionResponseContext(PortletContainer container, HttpServletRequest containerRequest, HttpServletResponse containerResponse, PortletWindow window) {
    final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(containerRequest, window);
    final IPortalActionUrlBuilder portalActionUrlBuilder = this.portalUrlProvider.getPortalActionUrlBuilder(containerRequest);
    final IPortletUrlBuilder portletUrlBuilder = portalActionUrlBuilder.getPortletUrlBuilder(portletWindow.getPortletWindowId());
    return new PortletActionResponseContextImpl(container, portletWindow, containerRequest, containerResponse, requestPropertiesManager, portalActionUrlBuilder, portletUrlBuilder, this.portletContextService, this.portletCookieService);
}
Also used : IPortletUrlBuilder(org.apereo.portal.url.IPortletUrlBuilder) PortletActionResponseContextImpl(org.apereo.portal.portlet.container.PortletActionResponseContextImpl) IPortalActionUrlBuilder(org.apereo.portal.url.IPortalActionUrlBuilder) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Example 13 with IPortletUrlBuilder

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

the class LocalPortletRequestContextServiceImpl method getPortletEventResponseContext.

/* (non-Javadoc)
     * @see org.apache.pluto.container.PortletRequestContextService#getPortletEventResponseContext(org.apache.pluto.container.PortletContainer, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.pluto.container.PortletWindow)
     */
@Override
public PortletEventResponseContext getPortletEventResponseContext(PortletContainer container, HttpServletRequest containerRequest, HttpServletResponse containerResponse, PortletWindow window) {
    final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(containerRequest, window);
    final IPortalActionUrlBuilder portalActionUrlBuilder = this.portalUrlProvider.getPortalActionUrlBuilder(containerRequest);
    final IPortletUrlBuilder portletUrlBuilder = portalActionUrlBuilder.getPortletUrlBuilder(portletWindow.getPortletWindowId());
    return new PortletEventResponseContextImpl(container, portletWindow, containerRequest, containerResponse, requestPropertiesManager, portletUrlBuilder, this.portletContextService, this.portletCookieService);
}
Also used : IPortletUrlBuilder(org.apereo.portal.url.IPortletUrlBuilder) PortletEventResponseContextImpl(org.apereo.portal.portlet.container.PortletEventResponseContextImpl) IPortalActionUrlBuilder(org.apereo.portal.url.IPortalActionUrlBuilder) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Example 14 with IPortletUrlBuilder

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

the class PortletMimeResponseContextImpl method getPortletURLProvider.

/* (non-Javadoc)
     * @see org.apache.pluto.container.PortletMimeResponseContext#getPortletURLProvider(org.apache.pluto.container.PortletURLProvider.TYPE)
     */
@Override
public PortletURLProvider getPortletURLProvider(TYPE type) {
    final IPortletWindowId portletWindowId = this.portletWindow.getPortletWindowId();
    final UrlType urlType = UrlType.fromPortletUrlType(type);
    final IPortalUrlBuilder portalUrlBuilder = this.portalUrlProvider.getPortalUrlBuilderByPortletWindow(containerRequest, portletWindowId, urlType);
    final IPortletUrlBuilder portletUrlBuilder = portalUrlBuilder.getPortletUrlBuilder(portletWindowId);
    return new PortletURLProviderImpl(portletUrlBuilder);
}
Also used : IPortletUrlBuilder(org.apereo.portal.url.IPortletUrlBuilder) PortletURLProviderImpl(org.apereo.portal.portlet.url.PortletURLProviderImpl) IPortalUrlBuilder(org.apereo.portal.url.IPortalUrlBuilder) UrlType(org.apereo.portal.url.UrlType) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 15 with IPortletUrlBuilder

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

the class MarketplaceSearchService method getSearchResults.

/**
 * Returns a list of search results that pertain to the marketplace query is the query to search
 * will search name, title, description, fname, and captions
 */
@Override
public SearchResults getSearchResults(PortletRequest request, SearchRequest query) {
    final String queryString = query.getSearchTerms().toLowerCase();
    final List<IPortletDefinition> portlets = portletDefinitionRegistry.getAllPortletDefinitions();
    final HttpServletRequest httpServletRequest = this.portalRequestUtils.getPortletHttpRequest(request);
    final SearchResults results = new SearchResults();
    for (IPortletDefinition portlet : portlets) {
        if (this.matches(queryString, new MarketplacePortletDefinition(portlet, this.marketplaceService, this.portletCategoryRegistry))) {
            final SearchResult result = new SearchResult();
            result.setTitle(portlet.getTitle());
            result.setSummary(portlet.getDescription());
            result.getType().add("marketplace");
            final IPortletWindow portletWindow = this.portletWindowRegistry.getOrCreateDefaultPortletWindowByFname(httpServletRequest, portlet.getFName());
            // If user does not have browse permission, exclude the portlet.
            if (portletWindow != null && authorizationService.canPrincipalBrowse(authorizationService.newPrincipal(request.getRemoteUser(), EntityEnum.PERSON.getClazz()), portlet)) {
                final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
                final IPortalUrlBuilder portalUrlBuilder = this.portalUrlProvider.getPortalUrlBuilderByPortletFName(httpServletRequest, portlet.getFName(), UrlType.RENDER);
                final IPortletUrlBuilder portletUrlBuilder = portalUrlBuilder.getPortletUrlBuilder(portletWindowId);
                portletUrlBuilder.setWindowState(PortletUtils.getWindowState("maximized"));
                result.setExternalUrl(portalUrlBuilder.getUrlString());
                PortletUrl url = new PortletUrl();
                url.setType(PortletUrlType.RENDER);
                url.setPortletMode("VIEW");
                url.setWindowState("maximized");
                PortletUrlParameter actionParam = new PortletUrlParameter();
                actionParam.setName("action");
                actionParam.getValue().add("view");
                url.getParam().add(actionParam);
                PortletUrlParameter fNameParam = new PortletUrlParameter();
                fNameParam.setName("fName");
                fNameParam.getValue().add(portlet.getFName());
                url.getParam().add(fNameParam);
                result.setPortletUrl(url);
                // Add the result to list to return
                results.getSearchResult().add(result);
            }
        }
    }
    return results;
}
Also used : IPortletUrlBuilder(org.apereo.portal.url.IPortletUrlBuilder) SearchResult(org.apereo.portal.search.SearchResult) SearchResults(org.apereo.portal.search.SearchResults) IPortalUrlBuilder(org.apereo.portal.url.IPortalUrlBuilder) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) HttpServletRequest(javax.servlet.http.HttpServletRequest) PortletUrlParameter(org.apereo.portal.search.PortletUrlParameter) PortletUrl(org.apereo.portal.search.PortletUrl) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Aggregations

IPortletUrlBuilder (org.apereo.portal.url.IPortletUrlBuilder)17 IPortalUrlBuilder (org.apereo.portal.url.IPortalUrlBuilder)11 IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)9 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)8 HttpServletRequest (javax.servlet.http.HttpServletRequest)4 UrlType (org.apereo.portal.url.UrlType)4 PortletUrlParameter (org.apereo.portal.search.PortletUrlParameter)3 IPortalActionUrlBuilder (org.apereo.portal.url.IPortalActionUrlBuilder)3 WindowState (javax.portlet.WindowState)2 MockPortletWindowId (org.apereo.portal.mock.portlet.om.MockPortletWindowId)2 PortletUrl (org.apereo.portal.search.PortletUrl)2 PortletUrlType (org.apereo.portal.search.PortletUrlType)2 Test (org.junit.Test)2 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2 StringWriter (java.io.StringWriter)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 Locale (java.util.Locale)1 Map (java.util.Map)1