org.jpublish
Class Page

java.lang.Object
  |
  +--org.jpublish.Page
All Implemented Interfaces:
XMLConstants

public class Page
extends java.lang.Object
implements XMLConstants

A representation of a single web page. A page is defined by an XML document in the pages directory. Each page has a template associated with the page and can have 0 or more actions attached to the page.

Actions attached to a page will be triggered each time the page is requested. Actions will be triggered in the order that they are listed within the Page's configuration.

Author:
Anthony Eden

Fields inherited from interface org.jpublish.XMLConstants
NS, NS_PREFIX, NS_URL
 
Constructor Summary
Page(SiteContext siteContext, java.lang.String path, java.lang.String pageName, java.lang.String pageType)
          Construct a new Page for the given path.
 
Method Summary
 java.lang.String executeActions(org.apache.velocity.VelocityContext context)
          Execute the page actions using the given VelocityContext.
 java.util.Map getEJBs()
          Get a Map of EJBHome interfaces.
 java.util.Map getExposedEJBs()
          Get a Map of EJB Session beans which are exposed on the page directly.
 java.lang.String getFullTemplateName()
          Get the full template file name, with the .suffix attached.
 java.util.List getPageActions()
          Get a List of page actions.
 java.lang.String getPageName()
          Get the page name.
 java.lang.String getPageType()
          Get the page type.
 java.lang.String getPath()
          Get the request path.
 java.lang.String getTemplateName()
          Get the template name.
 java.lang.String getTitle()
          Return the page title.
 void load(java.io.InputStream in)
          Load the page configuration from the page's XML stream.
 void setTemplateName(java.lang.String templateName)
          Set the template name.
 void setTitle(java.lang.String title)
          Set the title.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Page

public Page(SiteContext siteContext,
            java.lang.String path,
            java.lang.String pageName,
            java.lang.String pageType)
Construct a new Page for the given path. The name of the page is the last part of the path (i.e. the file component) without the dot ending. The page type is the dot-ending.
Parameters:
siteContext - The SiteContext
path - The request path
pageName - The name of the page
pageType - The page type
Method Detail

getPath

public java.lang.String getPath()
Get the request path.
Returns:
The request path

getPageName

public java.lang.String getPageName()
Get the page name.
Returns:
The page name

getPageType

public java.lang.String getPageType()
Get the page type.
Returns:
The page type

getTitle

public java.lang.String getTitle()
Return the page title. Initially the page title is extracted from the page's definition document, however it can be set programtically at runtime.
Returns:
The page title

setTitle

public void setTitle(java.lang.String title)
Set the title. This will temporarily alter the page's title.
Parameters:
title - The page title

getFullTemplateName

public java.lang.String getFullTemplateName()
Get the full template file name, with the .suffix attached.
Returns:
The full template name

getTemplateName

public java.lang.String getTemplateName()
Get the template name. If the template name is not specified in the page configuration then the default template as specified in the SiteContext will be used.
Returns:
The template name

setTemplateName

public void setTemplateName(java.lang.String templateName)
Set the template name. Invoking this method with a null value will reset the template to the default template as specified in the SiteContext.
Parameters:
templateName - The new template name or null to reset

getPageActions

public java.util.List getPageActions()
Get a List of page actions. To add an action to the page just add the action to this List. Page actions are triggered each time the page is requested.
Returns:
A List of page actions

getEJBs

public java.util.Map getEJBs()
Get a Map of EJBHome interfaces.
Returns:
A Map of name/EJBHome pairs

getExposedEJBs

public java.util.Map getExposedEJBs()
Get a Map of EJB Session beans which are exposed on the page directly.
Returns:
A Map of name/session bean pairs

executeActions

public java.lang.String executeActions(org.apache.velocity.VelocityContext context)
                                throws java.lang.Exception
Execute the page actions using the given VelocityContext.
Parameters:
context - The VelocityContext
Returns:
A redirection value or null if there is no redirection
Throws:
java.lang.Exception - Any Exception which occurs while executing the action

load

public void load(java.io.InputStream in)
          throws java.lang.Exception
Load the page configuration from the page's XML stream.
Parameters:
in - The InputStream
Throws:
java.lang.Exception - Any exception


Copyright (C) 2001 Anthony Eden. All Rights Reserved.