oracle.portal.provider.v1.http
Class BaseManagedRenderer

java.lang.Object
  |
  +--oracle.portal.provider.v1.http.BaseManagedRenderer
Direct Known Subclasses:
JavaRenderer, Page, Servlet20Renderer

public abstract class BaseManagedRenderer
extends java.lang.Object
implements ManagedRenderer, InitializableXMLObject

BaseManagedRenderer is the JPDK's base implementation of the ManagedRenderer interface. BaseManagedRenderer maintains information about the page's content type (MIME type) and cache expiry time. These may be set via calls to the appropriate methods or declared at page level in provider.xml using the <contentType> and <pageExpires> tags.

BaseManagedRenderer also maintains a reference to its parent RenderManager object so that page level attributes can be defaulted at RenderManager level. Implementations needing to set HTTP headers other than content type and page expiry should subclass BaseManagedRenderer and override the prepareResponse(PortletRenderRequest) method, taking care to call super.prepareResponse(pr) as a first step.


Constructor Summary
BaseManagedRenderer()
           
 
Method Summary
 java.lang.String getCharSet()
          Gets the Default IANA character encoding to be used for this renderer's pages.
 java.lang.String getContentType()
          Gets the default MIME type to be used as the content type for this renderer's pages.
 int getPageExpires()
          Gets the page expriation (in minutes).
 void postInitialize()
          Performs the extra steps required to initialize and validate a BaseManagedRenderer object once its properties have been set with the appropriate accessor methods.
 void preInitialize(java.lang.Object o)
          Performs the steps required to initialize a BaseManagedRenderer object after it has been constructed.
 boolean prepareResponse(PortletRenderRequest pr)
          Sets default HTTP headers for the response.
 void setCharSet(java.lang.String encoding)
          Sets the Default IANA character encoding to be used for this renderer's pages.
 void setContentType(java.lang.String contentType)
          Sets the default MIME type to be used as the content type for this renderer's pages.
 void setPageExpires(int expires)
          Sets the expiration time (in minutes) of the page cache.
 void setPageExpires(java.lang.String expires)
          Sets the expiration time (in minutes) of the page cache.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseManagedRenderer

public BaseManagedRenderer()
Method Detail

preInitialize

public void preInitialize(java.lang.Object o)
                   throws NodeHandlerException
Performs the steps required to initialize a BaseManagedRenderer object after it has been constructed.
Specified by:
preInitialize in interface InitializableXMLObject
Parameters:
o - the object that will become this object's parent
Throws:
NodeHandlerException - if an error occurs while initializing this object

postInitialize

public void postInitialize()
                    throws NodeHandlerException
Performs the extra steps required to initialize and validate a BaseManagedRenderer object once its properties have been set with the appropriate accessor methods.
Specified by:
postInitialize in interface InitializableXMLObject
Throws:
NodeHandlerException - if not all properties have been set correctly

setContentType

public void setContentType(java.lang.String contentType)
Sets the default MIME type to be used as the content type for this renderer's pages.
Parameters:
contentType - MIME type to be used as the content type for this renderer's pages.

getContentType

public java.lang.String getContentType()
Gets the default MIME type to be used as the content type for this renderer's pages. If a content type hasn't been set explicitly on this BaseManagedRenderer, then the value returned by calling the PortletPageLocator.getContentType() method on the parent PortletPageLocator is returned.
Specified by:
getContentType in interface ManagedRenderer
Returns:
MIME type to be used as the content type for this renderer's pages.

setCharSet

public void setCharSet(java.lang.String encoding)
Sets the Default IANA character encoding to be used for this renderer's pages.
Parameters:
charSet - IANA character encoding to be used for this renderer's pages

getCharSet

public java.lang.String getCharSet()
Gets the Default IANA character encoding to be used for this renderer's pages. If a character encoding hasn't been set explicitly on this BaseManagedRenderer, then the value returned by calling the PortletPageLocator.getCharSet() method on the parent PortletPageLocator is returned.
Returns:
IANA character encoding to be used for this renderer's pages

setPageExpires

public void setPageExpires(int expires)
Sets the expiration time (in minutes) of the page cache.
Parameters:
expires - the number of minutes a page should be cached by the Portal.

setPageExpires

public void setPageExpires(java.lang.String expires)
Sets the expiration time (in minutes) of the page cache.
Parameters:
expires - String representation of the integer number of minutes a page should be cached by the Portal.

getPageExpires

public int getPageExpires()
Gets the page expriation (in minutes). If a page expiration hasn't been set explicitly on this BaseManagedRenderer, then the value returned by calling the PortletPageLocator.getPageExpires() method on the parent PortletPageLocator is returned.
Returns:
page expiration in minutes. If non-zero it indicates the number of minutes the page should be cached by the Portal.

prepareResponse

public boolean prepareResponse(PortletRenderRequest pr)
                        throws PortletException,
                               PortletNotFoundException
Sets default HTTP headers for the response. This consists of content type and page expiry time, both of which may be set programatically via calls to setContentType(String) and setPageExpires(String) or declaritivley in provider.xml with the <contentType> and <pageExpires> tags.
Specified by:
prepareResponse in interface ManagedRenderer
Parameters:
pr - a PortletRenderRequest
Returns:
boolean flag indicating whether or not to render the portlet's contents (e.g. is the cached version still valid)