Class PageRef

  • All Implemented Interfaces:
    PageReferrer, Comparable<PageReferrer>

    public class PageRef
    extends Object
    implements PageReferrer
    A page reference contains both a book and a path to a page or directory. Any path to a directory must end with a slash (/).

    TODO: Support parameters to a page, child, link, ... Parameters provided in path/page?, param.* attributes, and nested tags - matching/extending AO taglib.

    • Constructor Detail

      • PageRef

        public PageRef​(String bookName,
                       String path)
      • PageRef

        public PageRef​(Book book,
                       String path)
    • Method Detail

      • getBookName

        public String getBookName()
        The name of the book the page is part of. This will always begin with a slash (/).
      • getBookPrefix

        public String getBookPrefix()
        The prefix of the book the page is part of. This will be "" for the root book "/".
      • getPath

        public String getPath()
        The book-relative path to the page, always starting with a slash (/).
      • setPath

        public PageRef setPath​(String newPath)
        Sets the path.
        Returns:
        this object if path unchanged or a new object representing the new path
      • getBook

        public Book getBook()
        the book itself, only available when have access to the referenced book.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • appendServletPath

        public void appendServletPath​(Appendable out)
                               throws IOException
        Appends the combination of the book and the path that refers to the page resource within the web application.
        Throws:
        IOException
        See Also:
        getServletPath()
      • getResourceFile

        public File getResourceFile​(boolean requireBook,
                                    boolean requireFile)
                             throws IOException
        the underlying file, only available when have access to the referenced book.
        Parameters:
        requireBook - when true, will always get a File object back
        requireFile - when true, any File object returned will exist on the filesystem
        Returns:
        null if not access to book or File of resource path.
        Throws:
        IOException