* @see org.displaytag.util.Href#toString()
*/
@Override
public String toString()
{
final PortletURL url;
if (this.isAction())
{
url = this.renderResponse.createActionURL();
}
else
{
url = this.renderResponse.createRenderURL();
}
if (this.isRequestedSecure())
{
try
{
url.setSecure(true);
}
catch (PortletSecurityException pse)
{
throw new RuntimeException("Creating secure PortletURL Failed.", pse);
}
}
if (this.getRequestedMode() != null)
{
try
{
url.setPortletMode(this.getRequestedMode());
}
catch (PortletModeException pme)
{
final IllegalStateException ise = new IllegalStateException("Requested PortletMode='"
+ this.getRequestedMode()
+ "' could not be set.");
ise.initCause(pme);
throw ise;
}
}
if (this.getRequestedState() != null)
{
try
{
url.setWindowState(this.getRequestedState());
}
catch (WindowStateException wse)
{
final IllegalStateException ise = new IllegalStateException("Requested WindowState='"
+ this.getRequestedState()
+ "' could not be set.");
ise.initCause(wse);
throw ise;
}
}
for (final Iterator<Entry<String, String[]>> paramItr = this.parameters.entrySet().iterator(); paramItr
.hasNext();)
{
final Entry<String, String[]> entry = paramItr.next();
final String name = entry.getKey();
final String[] value = entry.getValue();
url.setParameter(name, value);
}
if (this.getAnchor() == null)
{
return url.toString();
}
else
{
return url.toString() + "#" + this.getAnchor();
}
}