org.jasig.portal.url
Class PortalUrlProviderImpl

java.lang.Object
  extended by org.jasig.portal.url.PortalUrlProviderImpl
All Implemented Interfaces:
IPortalUrlProvider, IUrlGenerator

public class PortalUrlProviderImpl
extends Object
implements IPortalUrlProvider, IUrlGenerator

Version:
$Revision: 21632 $
Author:
Eric Dalquist

Field Summary
protected  org.apache.commons.logging.Log logger
           
static String NO_STATE_REGEX
           
static String PARAM_PORTLET_MODE
           
static String PARAM_REQUEST_TARGET
           
static String PARAM_WINDOW_STATE
           
static String PORTAL_PARAM_PREFIX
           
static String PORTAL_REQUEST_REGEX
           
static String PORTLET_CONTROL_PREFIX
           
static String PORTLET_PARAM_PREFIX
           
static String SEPERATOR
           
 
Constructor Summary
PortalUrlProviderImpl()
           
 
Method Summary
protected  void encodeAndAppend(StringBuilder url, String encoding, String name, List<String> values)
          Encodes parameter name and value(s) on to the url using the specified encoding.
protected  void encodeAndAppend(StringBuilder url, String encoding, String name, String... values)
           
 String generatePortalUrl(HttpServletRequest request, IBasePortalUrl basePortalUrl, String targetFolderId)
           
 String generatePortletUrl(HttpServletRequest request, IPortalPortletUrl portalPortletUrl, IPortletWindowId portletWindowId)
           
 IBasePortalUrl getDefaultUrl(HttpServletRequest request)
          Gets the default portal URL, this is equivalent to the first URL rendered by the portal when a user logs in.
protected  String getEncoding(HttpServletRequest request)
          Tries to determine the encoded from the request, if not available falls back to configured default.
protected  XPathExpression getFindChannelTabIdExpression(String channelNodeId)
           
protected  XPathExpression getFindTabIdExpression(String tabNodeId)
           
 IBasePortalUrl getFolderUrlByNodeId(HttpServletRequest request, String folderNodeId)
           
 IPortalRequestInfo getPortalRequestInfo(HttpServletRequest request)
          Get the portal request information for the specified request.
 IPortalPortletUrl getPortletUrl(HttpServletRequest request, IPortletWindowId portletWindowId)
           
 IPortalPortletUrl getPortletUrlByFName(HttpServletRequest request, String portletFName)
           
 IPortalPortletUrl getPortletUrlByNodeId(HttpServletRequest request, String portletNodeId)
           
protected  StringBuilder getUrlBase(HttpServletRequest request)
           
 void setChannelRegistryStore(IChannelRegistryStore channelRegistryStore)
           
 void setDefaultEncoding(String defaultEncoding)
           
 void setPortletDefinitionRegistry(IPortletDefinitionRegistry portletDefinitionRegistry)
           
 void setPortletEntityRegistry(IPortletEntityRegistry portletEntityRegistry)
           
 void setPortletWindowRegistry(ITransientPortletWindowRegistry portletWindowRegistry)
           
 void setUserInstanceManager(IUserInstanceManager userInstanceManager)
           
protected  String verifyFolderId(HttpServletRequest request, String folderNodeId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPERATOR

public static final String SEPERATOR
See Also:
Constant Field Values

PORTAL_PARAM_PREFIX

public static final String PORTAL_PARAM_PREFIX
See Also:
Constant Field Values

PORTLET_CONTROL_PREFIX

public static final String PORTLET_CONTROL_PREFIX
See Also:
Constant Field Values

PORTLET_PARAM_PREFIX

public static final String PORTLET_PARAM_PREFIX
See Also:
Constant Field Values

PARAM_REQUEST_TARGET

public static final String PARAM_REQUEST_TARGET
See Also:
Constant Field Values

PARAM_WINDOW_STATE

public static final String PARAM_WINDOW_STATE
See Also:
Constant Field Values

PARAM_PORTLET_MODE

public static final String PARAM_PORTLET_MODE
See Also:
Constant Field Values

NO_STATE_REGEX

public static final String NO_STATE_REGEX
See Also:
Constant Field Values

PORTAL_REQUEST_REGEX

public static final String PORTAL_REQUEST_REGEX
See Also:
Constant Field Values

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

PortalUrlProviderImpl

public PortalUrlProviderImpl()
Method Detail

setDefaultEncoding

public void setDefaultEncoding(String defaultEncoding)
Parameters:
defaultEncoding - the defaultEncoding to set

setUserInstanceManager

public void setUserInstanceManager(IUserInstanceManager userInstanceManager)
Parameters:
userInstanceManager - the userInstanceManager to set

setPortletDefinitionRegistry

public void setPortletDefinitionRegistry(IPortletDefinitionRegistry portletDefinitionRegistry)
Parameters:
portletDefinitionRegistry - the portletDefinitionRegistry to set

setPortletEntityRegistry

public void setPortletEntityRegistry(IPortletEntityRegistry portletEntityRegistry)
Parameters:
portletEntityRegistry - the portletEntityRegistry to set

setPortletWindowRegistry

public void setPortletWindowRegistry(ITransientPortletWindowRegistry portletWindowRegistry)
Parameters:
portletWindowRegistry - the portletWindowRegistry to set

setChannelRegistryStore

public void setChannelRegistryStore(IChannelRegistryStore channelRegistryStore)
Parameters:
channelRegistryStore - the channelRegistryStore to set

getPortalRequestInfo

public IPortalRequestInfo getPortalRequestInfo(HttpServletRequest request)
                                        throws InvalidPortalRequestException
Description copied from interface: IPortalUrlProvider
Get the portal request information for the specified request.

Specified by:
getPortalRequestInfo in interface IPortalUrlProvider
Parameters:
request - The current portal request
Returns:
Information about the current request
Throws:
InvalidPortalRequestException

getDefaultUrl

public IBasePortalUrl getDefaultUrl(HttpServletRequest request)
Description copied from interface: IPortalUrlProvider
Gets the default portal URL, this is equivalent to the first URL rendered by the portal when a user logs in.

Specified by:
getDefaultUrl in interface IPortalUrlProvider
Parameters:
request - The current portal request
Returns:
Default IBasePortalUrl

getFolderUrlByNodeId

public IBasePortalUrl getFolderUrlByNodeId(HttpServletRequest request,
                                           String folderNodeId)
Specified by:
getFolderUrlByNodeId in interface IPortalUrlProvider
Parameters:
request - The current portal request
folderNodeId - ID of the folder in the user's layout that should be targeted by the URL.
Returns:
Folder targeted IBasePortalUrl

getPortletUrl

public IPortalPortletUrl getPortletUrl(HttpServletRequest request,
                                       IPortletWindowId portletWindowId)
Specified by:
getPortletUrl in interface IPortalUrlProvider
Parameters:
request - The current portal request
portletWindowId - ID of the portlet window that should be targeted by the URL.
Returns:
Portlet targeted IBasePortalUrl

getPortletUrlByFName

public IPortalPortletUrl getPortletUrlByFName(HttpServletRequest request,
                                              String portletFName)
Specified by:
getPortletUrlByFName in interface IPortalUrlProvider
Parameters:
request - The current portal request
portletFName - The fname of the portlet that should be targeted by the URL
Returns:
Portlet targeted IBasePortalUrl

getPortletUrlByNodeId

public IPortalPortletUrl getPortletUrlByNodeId(HttpServletRequest request,
                                               String portletNodeId)
Specified by:
getPortletUrlByNodeId in interface IPortalUrlProvider
Parameters:
request - The current portal request
portletNodeId - ID of the channel in the user's layout that should be targeted by the URL.
Returns:
Portlet targeted IBasePortalUrl

verifyFolderId

protected String verifyFolderId(HttpServletRequest request,
                                String folderNodeId)

getEncoding

protected String getEncoding(HttpServletRequest request)
Tries to determine the encoded from the request, if not available falls back to configured default.

Parameters:
request - The current request.
Returns:
The encoding to use.

encodeAndAppend

protected void encodeAndAppend(StringBuilder url,
                               String encoding,
                               String name,
                               String... values)

encodeAndAppend

protected void encodeAndAppend(StringBuilder url,
                               String encoding,
                               String name,
                               List<String> values)
Encodes parameter name and value(s) on to the url using the specified encoding. The option to pass more than one value is provided to avoid encoding the same name multiple times.

Parameters:
url - The URL StringBuilder to append the parameters to
encoding - The encoding to use.
name - The name of the parameter
values - The values for the parameter, a & will be appended between each name/value pair added when multiple values are passed.

getUrlBase

protected StringBuilder getUrlBase(HttpServletRequest request)
Parameters:
request - The current requet
Returns:
The base URL, will be absolute (start with / or protocol://) and will end with a /

generatePortalUrl

public String generatePortalUrl(HttpServletRequest request,
                                IBasePortalUrl basePortalUrl,
                                String targetFolderId)
Specified by:
generatePortalUrl in interface IUrlGenerator
Parameters:
request - The current request
basePortalUrl - The URL object to create a URL string from
targetFolderId - The targeted folder id from the user's layout
Returns:
A URL to be used in markup or as a redirect. The URL will be absolute, starting with a / or with a protocol such as http://

generatePortletUrl

public String generatePortletUrl(HttpServletRequest request,
                                 IPortalPortletUrl portalPortletUrl,
                                 IPortletWindowId portletWindowId)
Specified by:
generatePortletUrl in interface IUrlGenerator
Parameters:
request - The current request
portalPortletUrl - The URL object to create a URL string from
portletWindowId - The targeted portlet window ID
Returns:
A URL to be used in markup or as a redirect. The URL will be absolute, starting with a / or with a protocol such as http://

getFindChannelTabIdExpression

protected XPathExpression getFindChannelTabIdExpression(String channelNodeId)

getFindTabIdExpression

protected XPathExpression getFindTabIdExpression(String tabNodeId)


Copyright © 2010 Jasig. All Rights Reserved.