Author: mwringe
Date: 2010-11-01 17:25:30 -0400 (Mon, 01 Nov 2010)
New Revision: 4893
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java
portal/trunk/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletURLBuilder.java
Log:
GTNPORTAL-1597: if the URLFormat specifies it wants to work with XML, then use &
instead of just & when creating urls.
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java 2010-11-01
16:55:20 UTC (rev 4892)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java 2010-11-01
21:25:30 UTC (rev 4893)
@@ -60,6 +60,7 @@
private static final String QMARK = "?";
private static final String EQ = "=";
private static final String AMP = "&";
+ private static final String XMLAMP = "&";
public ExoPortletInvocationContext(PortalRequestContext portalRequestContext,
UIPortlet portlet)
{
@@ -95,6 +96,12 @@
public String renderURL(ContainerURL containerURL, URLFormat format)
{
+ boolean wantEscapeXML = false;
+ if (format != null && format.getWantEscapeXML() != null)
+ {
+ wantEscapeXML = format.getWantEscapeXML();
+ }
+
// todo: shouldn't we be using URLFormat to decide on the path to use at the
beginning of the URL?
StringBuilder baseURL = new StringBuilder(this.portalRequestURI).append(QMARK)
.append(PortalRequestContext.UI_COMPONENT_ID).append(EQ).append(this.portletId);
@@ -119,30 +126,30 @@
if (!type.equals(Constants.PORTAL_RENDER))
{
- appendParameter(baseURL, Constants.TYPE_PARAMETER, type);
+ appendParameter(baseURL, Constants.TYPE_PARAMETER, type, wantEscapeXML);
}
if (format != null && format.getWantSecure() != null)
{
- appendParameter(baseURL, Constants.SECURE_PARAMETER,
format.getWantSecure().toString());
+ appendParameter(baseURL, Constants.SECURE_PARAMETER,
format.getWantSecure().toString(), wantEscapeXML);
}
StateString navigationalState = containerURL.getNavigationalState();
if (navigationalState != null &&
!navigationalState.getStringValue().equals(StateString.JBPNS_PREFIX))
{
- appendParameter(baseURL, NAVIGATIONAL_STATE_PARAM_NAME,
navigationalState.getStringValue());
+ appendParameter(baseURL, NAVIGATIONAL_STATE_PARAM_NAME,
navigationalState.getStringValue(), wantEscapeXML);
}
WindowState windowState = containerURL.getWindowState();
if (windowState != null)
{
- appendParameter(baseURL, Constants.WINDOW_STATE_PARAMETER,
windowState.toString());
+ appendParameter(baseURL, Constants.WINDOW_STATE_PARAMETER,
windowState.toString(), wantEscapeXML);
}
Mode mode = containerURL.getMode();
if (mode != null)
{
- appendParameter(baseURL, Constants.PORTLET_MODE_PARAMETER, mode.toString());
+ appendParameter(baseURL, Constants.PORTLET_MODE_PARAMETER, mode.toString(),
wantEscapeXML);
}
if (containerURL instanceof ActionURL)
@@ -152,25 +159,25 @@
StateString state = actionURL.getInteractionState();
if (state != null &&
!state.getStringValue().equals(StateString.JBPNS_PREFIX))
{
- appendParameter(baseURL, INTERACTION_STATE_PARAM_NAME,
state.getStringValue());
+ appendParameter(baseURL, INTERACTION_STATE_PARAM_NAME,
state.getStringValue(), wantEscapeXML);
}
}
else if (containerURL instanceof ResourceURL)
{
ResourceURL resourceURL = (ResourceURL)containerURL;
- appendParameter(baseURL, Constants.RESOURCE_ID_PARAMETER,
resourceURL.getResourceId());
+ appendParameter(baseURL, Constants.RESOURCE_ID_PARAMETER,
resourceURL.getResourceId(), wantEscapeXML);
CacheLevel cachability = resourceURL.getCacheability();
if (cachability != null)
{
- appendParameter(baseURL, Constants.CACHELEVEL_PARAMETER,
cachability.name());
+ appendParameter(baseURL, Constants.CACHELEVEL_PARAMETER, cachability.name(),
wantEscapeXML);
}
StateString resourceState = resourceURL.getResourceState();
if (resourceState != null &&
!resourceState.getStringValue().equals(StateString.JBPNS_PREFIX))
{
- appendParameter(baseURL, RESOURCE_STATE_PARAM_NAME,
resourceState.getStringValue());
+ appendParameter(baseURL, RESOURCE_STATE_PARAM_NAME,
resourceState.getStringValue(), wantEscapeXML);
}
}
else
@@ -187,12 +194,12 @@
{
for (String value : values)
{
- appendParameter(baseURL, key, value);
+ appendParameter(baseURL, key, value, wantEscapeXML);
}
}
else
{
- appendParameter(baseURL, "removePP", key);
+ appendParameter(baseURL, "removePP", key, wantEscapeXML);
}
}
}
@@ -201,11 +208,18 @@
return baseURL.toString();
}
- private void appendParameter(StringBuilder builder, String name, String value)
+ private void appendParameter(StringBuilder builder, String name, String value, boolean
wantEscapeXML)
{
if (value != null)
{
- builder.append(AMP).append(name).append(EQ).append(value);
+ if (wantEscapeXML)
+ {
+ builder.append(XMLAMP).append(name).append(EQ).append(value);
+ }
+ else
+ {
+ builder.append(AMP).append(name).append(EQ).append(value);
+ }
}
}
}
Modified:
portal/trunk/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletURLBuilder.java
===================================================================
---
portal/trunk/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletURLBuilder.java 2010-11-01
16:55:20 UTC (rev 4892)
+++
portal/trunk/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletURLBuilder.java 2010-11-01
21:25:30 UTC (rev 4893)
@@ -58,7 +58,7 @@
protected void createURL(StringBuilder builder, UIComponent targetComponent, String
action, String targetBeanId,
Parameter[] params)
{
- String baseUrl = getBaseURL().replaceAll("&", AMP);
+ String baseUrl = getBaseURL();
builder.append(baseUrl).append(AMP).append(UIComponent.UICOMPONENT).append(EQUALS).append(
targetComponent.getId());