- java.lang.Object
-
- com.semanticcms.core.servlet.PageUtils
-
public final class PageUtils extends Object
Utilities for working with pages.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <R extends PageReferrer>
Set<R>filterNotMissingBook(Set<R> pageReferrers)
Filters for all pageRefs that are present (not missing books).static boolean
findAllowRobots(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page)
Finds the allowRobots setting for the given page.static Set<Page>
getApplicableParents(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, View view, Page page)
Gets all the parents of the given page that are not in missing books and are applicable to the given view.static String
getShortTitle(PageRef parentPageRef, Page page)
Determines the short title for a page and one of its parents.static boolean
hasChild(Page page)
static boolean
hasElement(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page, Class<? extends Element> elementType, boolean recursive)
static ReadableDateTime
toDateTime(Object o)
-
-
-
Method Detail
-
hasChild
public static boolean hasChild(Page page)
-
hasElement
public static boolean hasElement(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page, Class<? extends Element> elementType, boolean recursive) throws ServletException, IOException
- Throws:
ServletException
IOException
-
findAllowRobots
public static boolean findAllowRobots(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page) throws ServletException, IOException
Finds the allowRobots setting for the given page.
When no allowRobots provided, will use the allowRobots(s) of any parent page that is within the same book. If there are no parent pages in this same book, uses the book's allowRobots.
When inheriting allowRobots from multiple parent pages, the allowRobots must be in exact agreement. This means exactly the same order and all values matching precisely. Any mismatch in allowRobots will result in an exception.
- Throws:
ServletException
IOException
-
filterNotMissingBook
public static <R extends PageReferrer> Set<R> filterNotMissingBook(Set<R> pageReferrers)
Filters for all pageRefs that are present (not missing books).
-
getShortTitle
public static String getShortTitle(PageRef parentPageRef, Page page)
Determines the short title for a page and one of its parents.
-
getApplicableParents
public static Set<Page> getApplicableParents(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, View view, Page page) throws ServletException, IOException
Gets all the parents of the given page that are not in missing books and are applicable to the given view.- Returns:
- The filtered set of parents, in the order declared by the page.
- Throws:
ServletException
IOException
-
toDateTime
public static ReadableDateTime toDateTime(Object o) throws IOException
- Throws:
IOException
-
-