{
pageMapName = "";
}
}
WebRequestEncoder encoder = new WebRequestEncoder(url);
if (!application.getHomePage().equals(pageClass)
|| !"".equals(pageMapName)
|| (application.getHomePage().equals(pageClass) && requestTarget instanceof BookmarkableListenerInterfaceRequestTarget))
{
/*
* Add <page-map-name>:<bookmarkable-page-class>
*
* Encode the url so it is correct even for class names containing
* non ASCII characters, like ä, æ, ø, å etc.
*
* The reason for this is that when redirecting to these
* bookmarkable pages, we need to have the url encoded correctly
* because we can't rely on the browser to interpret the unencoded
* url correctly.
*/
encoder.addValue(WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME, pageMapName
+ Component.PATH_SEPARATOR + pageClass.getName());
}
// Get page parameters
final PageParameters parameters = requestTarget.getPageParameters();
if (parameters != null)
{
final Iterator iterator;
if (UnitTestSettings.getSortUrlParameters())
{
iterator = new TreeSet(parameters.keySet()).iterator();
}
else
{
iterator = parameters.keySet().iterator();
}
while (iterator.hasNext())
{
final String key = (String)iterator.next();
final String values[] = parameters.getStringArray(key);
if (values != null)
{
for (int i = 0; i < values.length; i++)
{
encoder.addValue(key, values[i]);
}
}
}
}
return url;