java.lang.Object
com.semanticcms.core.model.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 Details

  • Method Details

    • getPageRef

      public PageRef getPageRef()
      A PageRef is its own referrer.
      Specified by:
      getPageRef in interface PageReferrer
    • 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.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

      public int compareTo(PageRef o)
      Orders by servletPath.
      See Also:
    • compareTo

      public int compareTo(PageReferrer o)
      Description copied from interface: PageReferrer
      Specified by:
      compareTo in interface Comparable<PageReferrer>
      Specified by:
      compareTo in interface PageReferrer
      See Also:
    • getServletPath

      public String getServletPath()
      Gets the combination of the book and the path that refers to the page resource within the web application.
      See Also:
    • 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:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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