use of org.apereo.portal.url.IPortalUrlBuilder in project uPortal by Jasig.
the class UserAccountHelper method sendLoginToken.
public void sendLoginToken(HttpServletRequest request, ILocalAccountPerson account, IPasswordResetNotification notification) {
Locale locale = getCurrentUserLocale(request);
IPortalUrlBuilder builder = urlProvider.getPortalUrlBuilderByPortletFName(request, PORTLET_FNAME_LOGIN, UrlType.RENDER);
IPortletUrlBuilder portletUrlBuilder = builder.getTargetedPortletUrlBuilder();
portletUrlBuilder.addParameter("username", account.getName());
portletUrlBuilder.addParameter("loginToken", (String) account.getAttributeValue("loginToken"));
portletUrlBuilder.setPortletMode(PortletMode.VIEW);
portletUrlBuilder.setWindowState(WindowState.MAXIMIZED);
try {
String path = fixPortletPath(request, builder);
URL url = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), path);
notification.sendNotification(url, account, locale);
} catch (MalformedURLException e) {
log.error(e);
}
}
use of org.apereo.portal.url.IPortalUrlBuilder 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);
}
use of org.apereo.portal.url.IPortalUrlBuilder in project uPortal by Jasig.
the class PortletRegistrySearchService method getSearchResults.
@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 (matches(queryString, portlet)) {
final SearchResult result = new SearchResult();
result.setTitle(portlet.getTitle());
result.setSummary(portlet.getDescription());
result.getType().add(searchResultType);
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());
results.getSearchResult().add(result);
}
}
}
return results;
}
use of org.apereo.portal.url.IPortalUrlBuilder in project uPortal by Jasig.
the class SearchPortletController method calculateSearchLaunchUrl.
/**
* Create an actionUrl for the indicated portlet The resource URL is for the ajax typing search
* results response.
*
* @param request render request
* @param response render response
*/
private String calculateSearchLaunchUrl(RenderRequest request, RenderResponse response) {
final HttpServletRequest httpRequest = this.portalRequestUtils.getPortletHttpRequest(request);
final IPortalUrlBuilder portalUrlBuilder = this.portalUrlProvider.getPortalUrlBuilderByPortletFName(httpRequest, "search", UrlType.ACTION);
return portalUrlBuilder.getUrlString();
}
use of org.apereo.portal.url.IPortalUrlBuilder 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();
}
Aggregations