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.
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPortletLifecycleIdpublic static final String P_AUTH
public static final String P_L_ID
public static final String P_P_AUTH
public static final String P_P_CACHEABILITY
public static final String P_P_COL_ID
public static final String P_P_COL_POS
public static final String P_P_COL_COUNT
public static final String P_P_ID
public static final String P_P_MODE
public static final String P_P_LIFECYCLE
public static final String P_O_P_ID
public static final String P_P_RESOURCE_ID
public static final String P_P_STATE
public static final String P_P_STATE_RCV
protected static final String LIFECYCLE_RESOURCE_PHASE_ID
public LiferayURLGeneratorBaseImpl(String baseURL, String responseNamespace)
baseURL - The String-based URL generated by Liferay Portal's PortletURLImpl#toString() method.responseNamespace - The response namespace.public LiferayURLGeneratorBaseImpl(String baseURL, javax.portlet.PortletMode portletMode, String responseNamespace, javax.portlet.WindowState windowState)
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.public String generateURL(Map<String,String[]> additionalParameterMap)
LiferayURLGeneratorgenerateURL in interface LiferayURLGeneratoradditionalParameterMap - Additional URL parameters.public String generateURL(Map<String,String[]> additionalParameterMap, String cacheability, String resourceId)
LiferayURLGeneratorgenerateURL in interface LiferayURLGeneratoradditionalParameterMap - Additional URL parameters.cacheability - The resource's cacheability level.resourceId - The resource ID.public String generateURL(Map<String,String[]> additionalParameterMap, javax.portlet.PortletMode portletMode, javax.portlet.WindowState windowState)
LiferayURLGeneratorgenerateURL in interface LiferayURLGeneratoradditionalParameterMap - Additional URL parameters.portletMode - The portlet mode.windowState - The window state.public String generateURL(Map<String,String[]> additionalParameterMap, String cacheability, javax.portlet.PortletMode portletMode, String resourceId, javax.portlet.WindowState windowState)
protected void appendParameterToURL(String parameterName, String parameterValue, StringBuilder url)
protected void appendParameterToURL(boolean firstParameter,
String parameterName,
String parameterValue,
StringBuilder url)
protected void appendParameterToURL(boolean firstParameter,
boolean namespaced,
String parameterName,
String parameterValue,
StringBuilder url)
protected void parse()
Copyright © 2016 Liferay, Inc.. All rights reserved.