// Begin encoding URL
final AppendingStringBuffer url = new AppendingStringBuffer(64);
// Get page Class
final Class<? extends Page> pageClass = requestTarget.getPageClass();
final Application application = Application.get();
// Find pagemap name
String pageMapName = requestTarget.getPageMapName();
if (pageMapName == null)
{
IRequestTarget currentTarget = requestCycle.getRequestTarget();
if (currentTarget instanceof IPageRequestTarget)
{
Page currentPage = ((IPageRequestTarget)currentTarget).getPage();
final IPageMap pageMap = currentPage.getPageMap();
if (pageMap.isDefault())
{
pageMapName = "";
}
else
{
pageMapName = pageMap.getName();
}
}
else
{
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,