}
@Override
public Url mapHandler(IRequestHandler requestHandler) {
if (requestHandler instanceof BrixNodeRequestHandler) {
BrixNodeRequestHandler handler = (BrixNodeRequestHandler) requestHandler;
String nodeURL = handler.getNodeURL();
return encode(nodeURL, handler.getPageParameters(), null);
} else if (requestHandler instanceof ListenerInterfaceRequestHandler) {
ListenerInterfaceRequestHandler handler = (ListenerInterfaceRequestHandler) requestHandler;
if (handler.getPage() instanceof BrixNodeWebPage) {
BrixNodeWebPage page = (BrixNodeWebPage) handler.getPage();
String componentPath = handler.getComponentPath();
RequestListenerInterface listenerInterface = handler.getListenerInterface();
Integer renderCount = null;
if (listenerInterface.isIncludeRenderCount()) {
renderCount = page.getRenderCount();
}
PageInfo pageInfo = new PageInfo(page.getPageId());
ComponentInfo componentInfo = new ComponentInfo(renderCount, requestListenerInterfaceToString(listenerInterface),
componentPath, handler.getBehaviorIndex());
PageComponentInfo info = new PageComponentInfo(pageInfo, componentInfo);
Url url = encode(page);
encodePageComponentInfo(url, info);
return url;
} else {
return null;
}
} else if (requestHandler instanceof RenderPageRequestHandler) {
RenderPageRequestHandler handler = (RenderPageRequestHandler) requestHandler;
if (handler.getPage() instanceof BrixNodeWebPage) {
BrixNodeWebPage page = (BrixNodeWebPage) handler.getPage();
PageInfo i = new PageInfo(page.getPageId());
PageComponentInfo info = new PageComponentInfo(i, null);
Url url = encode(page);
encodePageComponentInfo(url, info);
return url;
} else {
return null;
}
} else if (requestHandler instanceof BookmarkableListenerInterfaceRequestHandler) {
BookmarkableListenerInterfaceRequestHandler target = (BookmarkableListenerInterfaceRequestHandler) requestHandler;
BrixNodeWebPage page = (BrixNodeWebPage) target.getPage();
BrixNode node = page.getModelObject();
PageInfo info = new PageInfo(page.getPageId());
return encode(node, page.getBrixPageParameters(), info);
} else if (requestHandler instanceof BookmarkablePageRequestHandler
&& ((BookmarkablePageRequestHandler) requestHandler).getPageClass().equals(HomePage.class)) {
BrixNode node = ((BrixRequestCycleProcessor) RequestCycle.get().getActiveRequestHandler()).getNodeForUriPath(Path.ROOT);
return mapHandler(new BrixNodeRequestHandler(new BrixNodeModel(node)));
} else {
return null;
}
}