// the viewId into
// the response
// (interaction
// state)
RenderResponse renderResponse = (RenderResponse) getResponse();
PortletURL actionURL = null;
// Non-JSF actions are renderURLs as we merely dispatch to them
if (urlType == Bridge.PortletPhase.ACTION_PHASE)
{
actionURL = renderResponse.createActionURL();
}
else
{
actionURL = renderResponse.createRenderURL();
}
// Add parameters so they don't get lost
Enumeration<String> list = queryStr.getParameterNames();
while (list.hasMoreElements())
{
String param = list.nextElement().toString();
if (param.equals(Bridge.PORTLET_MODE_PARAMETER))
{
try
{
actionURL.setPortletMode(new PortletMode(queryStr.getParameter(param)));
}
catch (Exception e)
{
; // do nothing -- just ignore
}
}
else if (param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
{
try
{
actionURL.setWindowState(new WindowState(queryStr.getParameter(param)));
}
catch (Exception e)
{
; // do nothing -- just ignore
}
}
else if (param.equals(Bridge.PORTLET_SECURE_PARAMETER))
{
try
{
actionURL.setSecure(Boolean.getBoolean(queryStr.getParameter(param)));
}
catch (Exception e)
{
; // do nothing -- just ignore
}
}
else
{
actionURL.setParameter(param, queryStr.getParameter(param));
}
}
// Carry forward render parameters if this is a portlet:url that references the current view
if (isPortletURLSelfReference)
{
Map m = mOrigPortletRequest.getParameterMap();
Set<Map.Entry<String, String[]>> s = m.entrySet();
Iterator<Map.Entry<String, String[]>> i = s.iterator();
while (i.hasNext())
{
Map.Entry<String, String[]> entry = i.next();
// only add if not already added from above
if (queryStr.getParameter(entry.getKey()) == null)
{
actionURL.setParameter(entry.getKey(), entry.getValue());
}
}
}
url = actionURL.toString();
// JSF expects encodeActionURL to not perturb any XML encoding (or lack thereof) of the url.
// I.e. the caller is responsible for either pre or post XML escaping the string sent/returned
// by encodeActionURL. Unfortunately, the portlet 1.0 spec didn't define whether toString()
// returns an XML encoded string or not. Most containers behaved like the servlet environment and did not,