else
{
name = name.replace('"', '_');
}
Session session = Session.get();
Session.PageMapAccessMetaData meta = (Session.PageMapAccessMetaData)session
.getMetaData(Session.PAGEMAP_ACCESS_MDK);
if (meta == null)
{
meta = new Session.PageMapAccessMetaData();
session.setMetaData(Session.PAGEMAP_ACCESS_MDK, meta);
}
boolean firstAccess = meta.add(pageMap);
if (firstAccess)
{
// this is the first access to the pagemap, set window.name
JavascriptUtils.writeOpenTag(response);
response
.write("if (window.name=='' || window.name.indexOf('wicket') > -1) { window.name=\"");
response.write(name);
response.write("\"; }");
JavascriptUtils.writeCloseTag(response);
}
else
{
// Here is our trickery to detect whether the current request
// was
// made in a new window/ tab, in which case it should go in a
// different page map so that we don't intermangle the history
// of
// those windows
CharSequence url = null;
if (target instanceof IBookmarkablePageRequestTarget)
{
IBookmarkablePageRequestTarget current = (IBookmarkablePageRequestTarget)target;
BookmarkablePageRequestTarget redirect = new BookmarkablePageRequestTarget(
session.createAutoPageMapName(), current.getPageClass(), current
.getPageParameters());
url = cycle.urlFor(redirect);
}
else
{