com.liferay.faces.bridge.filter.liferay.internal
Class LiferayURLGeneratorBaseImpl

java.lang.Object
  extended by com.liferay.faces.bridge.filter.liferay.internal.LiferayURLGeneratorBaseImpl
All Implemented Interfaces:
LiferayURLGenerator
Direct Known Subclasses:
LiferayURLGeneratorActionImpl, LiferayURLGeneratorRenderImpl, LiferayURLGeneratorResourceImpl

public abstract class LiferayURLGeneratorBaseImpl
extends Object
implements LiferayURLGenerator

This abstract class implements the LiferayURLGenerator contract for generating URLs that are compatible with Liferay Portal. The main reason why this is necessary is because the Liferay Portal's com.liferay.portlet.PortletURLImpl#toString() method returns different values depending on the portlet lifecycle phase during which it is called. Additionally, it sometimes includes the public render parameters in the URL (which are not required for JSF portlets). Another issue is related to ICEfaces, which uses a server-side DOM-diff algorithm within it's RenderKit. When DOM-diff strategies are used, it is critical that URLs always be the same regardless of which portlet lifecycle phase is executing. For example, a URL generated during the PortletRequest.RENDER_PHASE of the portlet lifecycle must be identical to the one generated during the PortletRequest.RESOURCE_PHASE, or else a DOM-diff will be detected.

The constructors of this class receive a String-based parameter named "baseURL" which is expected to be the result of calling the toString() method of a Liferay URL. The baseURL is then parsed and the URL parameters are cached so that the generateURL(Map) method can quickly generate a consistent URL.

Author:
Neil Griffin

Field Summary
protected static String LIFECYCLE_RESOURCE_PHASE_ID
           
static String P_AUTH
           
static String P_L_ID
           
static String P_O_P_ID
           
static String P_P_AUTH
           
static String P_P_CACHEABILITY
           
static String P_P_COL_COUNT
           
static String P_P_COL_ID
           
static String P_P_COL_POS
           
static String P_P_ID
           
static String P_P_LIFECYCLE
           
static String P_P_MODE
           
static String P_P_RESOURCE_ID
           
static String P_P_STATE
           
static String P_P_STATE_RCV
           
 
Constructor Summary
LiferayURLGeneratorBaseImpl(String baseURL, javax.portlet.PortletMode portletMode, String responseNamespace, javax.portlet.WindowState windowState)
          Constructs a new instance.
LiferayURLGeneratorBaseImpl(String baseURL, String responseNamespace)
          Constructs a new instance.
 
Method Summary
protected  void appendParameterToURL(boolean firstParameter, boolean namespaced, String parameterName, String parameterValue, StringBuilder url)
           
protected  void appendParameterToURL(boolean firstParameter, String parameterName, String parameterValue, StringBuilder url)
           
protected  void appendParameterToURL(String parameterName, String parameterValue, StringBuilder url)
           
protected  String encode(String value)
           
 String generateURL(Map<String,String[]> additionalParameterMap)
          Generates a Liferay-compatible URL with the specified additional URL parameters.
 String generateURL(Map<String,String[]> additionalParameterMap, javax.portlet.PortletMode portletMode, javax.portlet.WindowState windowState)
          Generates a Liferay-compatible URL with the specified additional URL parameters, portlet mode, and window state.
 String generateURL(Map<String,String[]> additionalParameterMap, String cacheability, javax.portlet.PortletMode portletMode, String resourceId, javax.portlet.WindowState windowState)
           
 String generateURL(Map<String,String[]> additionalParameterMap, String cacheability, String resourceId)
          Generates a Liferay-compatible URL with the specified additional URL parameters and resource ID.
protected  void parse()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.liferay.faces.bridge.filter.liferay.LiferayURLGenerator
getPortletLifecycleId
 

Field Detail

P_AUTH

public static final String P_AUTH
See Also:
Constant Field Values

P_L_ID

public static final String P_L_ID
See Also:
Constant Field Values

P_P_AUTH

public static final String P_P_AUTH
See Also:
Constant Field Values

P_P_CACHEABILITY

public static final String P_P_CACHEABILITY
See Also:
Constant Field Values

P_P_COL_ID

public static final String P_P_COL_ID
See Also:
Constant Field Values

P_P_COL_POS

public static final String P_P_COL_POS
See Also:
Constant Field Values

P_P_COL_COUNT

public static final String P_P_COL_COUNT
See Also:
Constant Field Values

P_P_ID

public static final String P_P_ID
See Also:
Constant Field Values

P_P_MODE

public static final String P_P_MODE
See Also:
Constant Field Values

P_P_LIFECYCLE

public static final String P_P_LIFECYCLE
See Also:
Constant Field Values

P_O_P_ID

public static final String P_O_P_ID
See Also:
Constant Field Values

P_P_RESOURCE_ID

public static final String P_P_RESOURCE_ID
See Also:
Constant Field Values

P_P_STATE

public static final String P_P_STATE
See Also:
Constant Field Values

P_P_STATE_RCV

public static final String P_P_STATE_RCV
See Also:
Constant Field Values

LIFECYCLE_RESOURCE_PHASE_ID

protected static final String LIFECYCLE_RESOURCE_PHASE_ID
See Also:
Constant Field Values
Constructor Detail

LiferayURLGeneratorBaseImpl

public LiferayURLGeneratorBaseImpl(String baseURL,
                                   String responseNamespace)
Constructs a new instance.

Parameters:
baseURL - The String-based URL generated by Liferay Portal's PortletURLImpl#toString() method.
responseNamespace - The response namespace.

LiferayURLGeneratorBaseImpl

public LiferayURLGeneratorBaseImpl(String baseURL,
                                   javax.portlet.PortletMode portletMode,
                                   String responseNamespace,
                                   javax.portlet.WindowState windowState)
Constructs a new instance.

Parameters:
baseURL - The String-based URL generated by Liferay Portal's com.liferay.portlet.PortletURLImpl#toString() method. method.
portletMode - The portlet mode specified by Liferay Portal's com.liferay.portlet.PortletURLImpl#getPortletMode() method. method.
responseNamespace - The response namespace.
windowState - The window state specified by Liferay Portal's com.liferay.portlet.PortletURLImpl#getWindowState() method. method.
Method Detail

generateURL

public String generateURL(Map<String,String[]> additionalParameterMap)
Description copied from interface: LiferayURLGenerator
Generates a Liferay-compatible URL with the specified additional URL parameters.

Specified by:
generateURL in interface LiferayURLGenerator
Parameters:
additionalParameterMap - Additional URL parameters.
Returns:
The Liferay-compatible URL.

generateURL

public String generateURL(Map<String,String[]> additionalParameterMap,
                          String cacheability,
                          String resourceId)
Description copied from interface: LiferayURLGenerator
Generates a Liferay-compatible URL with the specified additional URL parameters and resource ID.

Specified by:
generateURL in interface LiferayURLGenerator
Parameters:
additionalParameterMap - Additional URL parameters.
cacheability - The resource's cacheability level.
resourceId - The resource ID.
Returns:
The Liferay-compatible URL.

generateURL

public String generateURL(Map<String,String[]> additionalParameterMap,
                          javax.portlet.PortletMode portletMode,
                          javax.portlet.WindowState windowState)
Description copied from interface: LiferayURLGenerator
Generates a Liferay-compatible URL with the specified additional URL parameters, portlet mode, and window state.

Specified by:
generateURL in interface LiferayURLGenerator
Parameters:
additionalParameterMap - Additional URL parameters.
portletMode - The portlet mode.
windowState - The window state.
Returns:

generateURL

public String generateURL(Map<String,String[]> additionalParameterMap,
                          String cacheability,
                          javax.portlet.PortletMode portletMode,
                          String resourceId,
                          javax.portlet.WindowState windowState)

appendParameterToURL

protected void appendParameterToURL(String parameterName,
                                    String parameterValue,
                                    StringBuilder url)

appendParameterToURL

protected void appendParameterToURL(boolean firstParameter,
                                    String parameterName,
                                    String parameterValue,
                                    StringBuilder url)

appendParameterToURL

protected void appendParameterToURL(boolean firstParameter,
                                    boolean namespaced,
                                    String parameterName,
                                    String parameterValue,
                                    StringBuilder url)

encode

protected String encode(String value)

parse

protected void parse()


Copyright © 2015 Liferay, Inc.. All rights reserved.