/** * Returns the page key for a content type listing page. * @param navigationKey Navigation key of the page. * @param contentType Content type of the page. * @return The requested key. */ public static PageKey contentType(final NavigationKey navigationKey, final ContentType contentType) { if (navigationKey == null) { return contentType(contentType); } return new ContentTypePage(navigationKey.withContentType(contentType)); }
/** Component execution. */ public ComponentResponse execute() { ContentType c = getDestination(); if (c == null) { // Nothing to do return ComponentResponse.OK; } NavigationKey nk = navigationKey; if (nk == null || !keepNavigationKey) { nk = NavigationKey.contentType(c); } else { nk = nk.withContentType(c); } final PageKey pk = PageKey.navigation(nk); final Route r = getRoute().toPage(pk); // External if (type != null && type.booleanValue()) { return ComponentResponse.seeOther(replaceQuery(getUriGenerator().getAbsoluteURI(r), query)); } else { return ComponentResponse.internal(r); } }