Class Content2HTMLPage

java.lang.Object
com.opensymphony.sitemesh.compatability.Content2HTMLPage
All Implemented Interfaces:
HTMLPage, Page

public class Content2HTMLPage extends Object implements HTMLPage
Adapts a SiteMesh 3 Content to a SiteMesh 2 HTMLPage.
Since:
SiteMesh 3
Author:
Joe Walnes
  • Field Details

    • content

      private final Content content
    • request

      private javax.servlet.http.HttpServletRequest request
  • Constructor Details

    • Content2HTMLPage

      public Content2HTMLPage(Content content)
    • Content2HTMLPage

      public Content2HTMLPage(Content content, javax.servlet.http.HttpServletRequest request)
  • Method Details

    • writePage

      public void writePage(Writer out) throws IOException
      Description copied from interface: Page
      Write the entire contents of the Page, in the format before it was parsed, to the Writer.
      Specified by:
      writePage in interface Page
      Parameters:
      out - Writer to write to.
      Throws:
      IOException - Rethrown if cannot write to writer.
    • getPage

      public String getPage()
      Description copied from interface: Page
      Convenience method to return the contents of the Page in its original format.
      Specified by:
      getPage in interface Page
      See Also:
    • writeBody

      public void writeBody(Writer out) throws IOException
      Description copied from interface: Page
      Write the contents of the <body> tag.
      Specified by:
      writeBody in interface Page
      Throws:
      IOException
    • getBody

      public String getBody()
      Description copied from interface: Page
      Convenience method to return the contents of the <body> tag.
      Specified by:
      getBody in interface Page
      See Also:
    • writeHead

      public void writeHead(Writer out) throws IOException
      Description copied from interface: HTMLPage
      Write the contents of the <head> tag.
      Specified by:
      writeHead in interface HTMLPage
      Throws:
      IOException
    • getHead

      public String getHead()
      Description copied from interface: HTMLPage
      Convenience method to return the contents of the <head> tag as a String.
      Specified by:
      getHead in interface HTMLPage
      See Also:
    • getTitle

      public String getTitle()
      Description copied from interface: Page
      Get the Title of the document
      Specified by:
      getTitle in interface Page
    • getContentLength

      public int getContentLength()
      Description copied from interface: Page
      Length of the Page, in the format before it was parsed.
      Specified by:
      getContentLength in interface Page
      Returns:
      Length of page data (in number of bytes).
    • getProperty

      public String getProperty(String name)
      Description copied from interface: Page
      Get a property embedded into the Page as a String.
      Specified by:
      getProperty in interface Page
      Parameters:
      name - Name of property
      Returns:
      Property value
    • getIntProperty

      public int getIntProperty(String name)
      Description copied from interface: Page
      Get a property embedded into the Page as an int. Returns 0 if property not specified or not valid number.
      Specified by:
      getIntProperty in interface Page
      Parameters:
      name - Name of property
      Returns:
      Property value
    • getLongProperty

      public long getLongProperty(String name)
      Description copied from interface: Page
      Get a property embedded into the Page as a long. Returns 0L if property not specified or not valid number.
      Specified by:
      getLongProperty in interface Page
      Parameters:
      name - Name of property
      Returns:
      Property value
    • noNull

      private String noNull(String property)
    • getBooleanProperty

      public boolean getBooleanProperty(String name)
      Description copied from interface: Page
      Get a property embedded into the Page as a boolean. Returns true if value starts with '1', 't' or 'y' (case-insensitive) - otherwise returns false.
      Specified by:
      getBooleanProperty in interface Page
      Parameters:
      name - Name of property
      Returns:
      Property value
    • isPropertySet

      public boolean isPropertySet(String name)
      Description copied from interface: Page
      Determine whether a property embedded into the Page has been set.
      Specified by:
      isPropertySet in interface Page
      Parameters:
      name - Name of property
      Returns:
      Whether it has been set
    • getPropertyKeys

      public String[] getPropertyKeys()
      Description copied from interface: Page
      Get all available property keys for the Page.
      Specified by:
      getPropertyKeys in interface Page
      Returns:
      Property keys
    • getProperties

      public Map getProperties()
      Description copied from interface: Page
      Get a Map representing all the properties in the Page.
      Specified by:
      getProperties in interface Page
      Returns:
      Properties map
    • isFrameSet

      public boolean isFrameSet()
      Description copied from interface: HTMLPage
      Check to see if this page contains an HTML frameset.
      Specified by:
      isFrameSet in interface HTMLPage
    • setFrameSet

      public void setFrameSet(boolean frameset)
      Description copied from interface: HTMLPage
      Marks this page as a frameset.
      Specified by:
      setFrameSet in interface HTMLPage
      See Also:
    • getRequest

      public javax.servlet.http.HttpServletRequest getRequest()
      Description copied from interface: Page
      Return the request of the original page.
      Specified by:
      getRequest in interface Page
      See Also:
    • setRequest

      public void setRequest(javax.servlet.http.HttpServletRequest request)
      Create snapshot of Request.
      Specified by:
      setRequest in interface Page
      See Also:
    • addProperty

      public void addProperty(String name, String value)
      Description copied from interface: Page
      Manually add a property to page.
      Specified by:
      addProperty in interface Page