WW-3831 adds the same behaviour as in ServletUrlRenderer to render dynamic action in URL tag

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1344990 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Lukasz Lenart
2012-06-01 05:42:55 +00:00
parent b0a7c6c8d3
commit e3b66874d6
@@ -94,17 +94,24 @@ public class PortletUrlRenderer implements UrlRenderer {
String namespace = urlComponent.determineNamespace(urlComponent.getNamespace(), urlComponent.getStack(), urlComponent.getHttpServletRequest());
urlComponent.setNamespace(namespace);
if (onlyActionSpecified(urlComponent)) {
result = portletUrlHelper.buildUrl(urlComponent.getAction(), urlComponent.getNamespace(), urlComponent.getMethod(),
urlComponent.getParameters(), urlComponent.getPortletUrlType(), urlComponent.getPortletMode(), urlComponent.getWindowState());
if (StringUtils.isNotEmpty(urlComponent.getAction())) {
String action = urlComponent.findString(urlComponent.getAction());
result = portletUrlHelper.buildUrl(action, urlComponent.getNamespace(), urlComponent.getMethod(),
urlComponent.getParameters(), urlComponent.getPortletUrlType(), urlComponent.getPortletMode(), urlComponent.getWindowState());
}
else {
result = portletUrlHelper.buildUrl(urlComponent.getAction(), urlComponent.getNamespace(), urlComponent.getMethod(),
urlComponent.getParameters(), urlComponent.getPortletUrlType(), urlComponent.getPortletMode(), urlComponent.getWindowState());
}
} else if (onlyValueSpecified(urlComponent)) {
result = portletUrlHelper.buildResourceUrl(urlComponent.getValue(), urlComponent.getParameters());
} else {
result = createDefaultUrl(urlComponent);
}
}
final String anchor = urlComponent.getAnchor();
if (anchor != null && anchor.length() > 0) {
result += '#' + anchor;
String anchor = urlComponent.getAnchor();
if (StringUtils.isNotEmpty(anchor)) {
result += '#' + urlComponent.findString(anchor);
}
String var = urlComponent.getVar();