org.jasig.portal.portlet.url
Class PortletUrlSyntaxProviderImpl

java.lang.Object
  extended by org.jasig.portal.portlet.url.PortletUrlSyntaxProviderImpl
All Implemented Interfaces:
IPortletUrlSyntaxProvider

public class PortletUrlSyntaxProviderImpl
extends Object
implements IPortletUrlSyntaxProvider

Contains the logic and string constants for generating and parsing portlet URL parameters.

Version:
$Revision$
Author:
Eric Dalquist

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
PortletUrlSyntaxProviderImpl()
           
 
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)
           
protected  void generatePortletUrl(HttpServletRequest request, IPortletWindow portletWindow, IPortletWindowId delegationChildId, PortletUrl portletUrl, StringBuilder url)
           
 String generatePortletUrl(HttpServletRequest request, IPortletWindow portletWindow, PortletUrl portletUrl)
          Generates a full portlet URL for the current request, passed portlet window & portlet URL data object.
 Set<WindowState> getAnchoringWindowStates()
           
 int getBufferLength()
           
 String getDefaultEncoding()
           
protected  String getEncoding(HttpServletRequest request)
          Tries to determine the encoded from the request, if not available falls back to configured default.
 IPortalRequestUtils getPortalRequestUtils()
           
 IPortletDefinitionRegistry getPortletDefinitionRegistry()
           
 IPortletDelegationManager getPortletDelegationManager()
           
 IPortletEntityRegistry getPortletEntityRegistry()
           
 IPortletWindowRegistry getPortletWindowRegistry()
           
 Set<WindowState> getTransientWindowStates()
           
protected  Set<String> getUrlParameterNames(HttpServletRequest request)
          Parses the request URL to return a Set of the parameter names that appeared on the URL string.
 IUserInstanceManager getUserInstanceManager()
           
 boolean isUseAnchors()
           
protected  void parsePortletParameters(HttpServletRequest request, PortletUrl portletUrl, org.jasig.portal.portlet.url.PortletUrlSyntaxProviderImpl.UrlTarget urlTarget)
           
 PortletUrl parsePortletUrl(HttpServletRequest request)
          Parses out PortletUrl data from the request.
protected  org.jasig.portal.portlet.url.PortletUrlSyntaxProviderImpl.UrlTarget resolveTargetWindowId(HttpServletRequest request)
           
 void setAnchoringWindowStates(Set<WindowState> anchoringWindowStates)
          WindowStates where anchors should be added to the ends of the generated URLS, only if setUseAnchors(boolean) is true.
 void setBufferLength(int bufferLength)
           
 void setDefaultEncoding(String defaultEncoding)
           
 void setPortalRequestUtils(IPortalRequestUtils portalRequestUtils)
           
 void setPortletDefinitionRegistry(IPortletDefinitionRegistry portletDefinitionRegistry)
           
 void setPortletDelegationManager(IPortletDelegationManager portletDelegationManager)
           
 void setPortletEntityRegistry(IPortletEntityRegistry portletEntityRegistry)
           
 void setPortletWindowRegistry(IPortletWindowRegistry portletWindowRegistry)
           
 void setTransientWindowStates(Set<WindowState> transientWindowStates)
          WindowStates that have transient IPortletWindows.
 void setUseAnchors(boolean useAnchors)
          If anchors should be added to generated URLs
 void setUserInstanceManager(IUserInstanceManager userInstanceManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

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

PortletUrlSyntaxProviderImpl

public PortletUrlSyntaxProviderImpl()
Method Detail

isUseAnchors

public boolean isUseAnchors()
Returns:
the useAnchors

setUseAnchors

public void setUseAnchors(boolean useAnchors)
If anchors should be added to generated URLs


getPortalRequestUtils

public IPortalRequestUtils getPortalRequestUtils()
Returns:
the portalRequestUtils

setPortalRequestUtils

public void setPortalRequestUtils(IPortalRequestUtils portalRequestUtils)
Parameters:
portalRequestUtils - the portalRequestUtils to set

getDefaultEncoding

public String getDefaultEncoding()
Returns:
the defaultEncoding

setDefaultEncoding

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

getBufferLength

public int getBufferLength()
Returns:
the bufferLength

setBufferLength

public void setBufferLength(int bufferLength)
Parameters:
bufferLength - the bufferLength to set

getPortletWindowRegistry

public IPortletWindowRegistry getPortletWindowRegistry()
Returns:
the portletWindowRegistry

setPortletWindowRegistry

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

getPortletDefinitionRegistry

public IPortletDefinitionRegistry getPortletDefinitionRegistry()

setPortletDefinitionRegistry

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

getPortletEntityRegistry

public IPortletEntityRegistry getPortletEntityRegistry()

setPortletEntityRegistry

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

getUserInstanceManager

public IUserInstanceManager getUserInstanceManager()

setUserInstanceManager

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

getTransientWindowStates

public Set<WindowState> getTransientWindowStates()

setTransientWindowStates

public void setTransientWindowStates(Set<WindowState> transientWindowStates)
WindowStates that have transient IPortletWindows. These states must be the ONLY content rendering links on the page. Defaults to EXCLUSIVE and DETACHED.


getAnchoringWindowStates

public Set<WindowState> getAnchoringWindowStates()

setAnchoringWindowStates

public void setAnchoringWindowStates(Set<WindowState> anchoringWindowStates)
WindowStates where anchors should be added to the ends of the generated URLS, only if setUseAnchors(boolean) is true. Defaults to MINIMIZED and NORMAL


getPortletDelegationManager

public IPortletDelegationManager getPortletDelegationManager()

setPortletDelegationManager

public void setPortletDelegationManager(IPortletDelegationManager portletDelegationManager)

parsePortletUrl

public PortletUrl parsePortletUrl(HttpServletRequest request)
Description copied from interface: IPortletUrlSyntaxProvider
Parses out PortletUrl data from the request.

Specified by:
parsePortletUrl in interface IPortletUrlSyntaxProvider
Parameters:
request - The request to parse parameters from
Returns:
The PortletUrl data for the request, null if no portlet is targeted by this request

parsePortletParameters

protected void parsePortletParameters(HttpServletRequest request,
                                      PortletUrl portletUrl,
                                      org.jasig.portal.portlet.url.PortletUrlSyntaxProviderImpl.UrlTarget urlTarget)

resolveTargetWindowId

protected org.jasig.portal.portlet.url.PortletUrlSyntaxProviderImpl.UrlTarget resolveTargetWindowId(HttpServletRequest request)

getUrlParameterNames

protected Set<String> getUrlParameterNames(HttpServletRequest request)
Parses the request URL to return a Set of the parameter names that appeared on the URL string.

Parameters:
request - The request to look at.
Returns:
The Set of parameter names from the URL.

generatePortletUrl

public String generatePortletUrl(HttpServletRequest request,
                                 IPortletWindow portletWindow,
                                 PortletUrl portletUrl)
Description copied from interface: IPortletUrlSyntaxProvider
Generates a full portlet URL for the current request, passed portlet window & portlet URL data object. The generated URL will be complete and ready for rendering.

Specified by:
generatePortletUrl in interface IPortletUrlSyntaxProvider
Parameters:
request - The current request
portletWindow - The portlet window the parameters are for
portletUrl - The Portlet URL data to be written.
Returns:
A fully generated portlet URL ready to be rendered

generatePortletUrl

protected void generatePortletUrl(HttpServletRequest request,
                                  IPortletWindow portletWindow,
                                  IPortletWindowId delegationChildId,
                                  PortletUrl portletUrl,
                                  StringBuilder url)

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 appeneded between each name/value pair added when multiple values are passed.


Copyright © 2010 Jasig. All Rights Reserved.