// Copyright (c) 2001 Oracle Corporation
package oracle.portal.provider.v2.render;

import oracle.portal.provider.v2.PortletException;

/**
 * A ManagedRenderer is a controller used, in conjunction with {@link
 * RenderManager}, to construct a correctly ordered response to a {@link
 * PortletRenderRequest}. Such a response must do any protocol specific
 * preparation before rendering the portlet's contents.<p>
 *
 * Unless rendering for the <i>default page</i>, a ManagedRenderer's response
 * corresponds to a single render mode.
 */
public abstract class ManagedRenderer
{
    /**
     *  Gets the MIME type to be used as the content type for this renderer's
     *  pages.
     *
     *  @return MIME type to be used as the content type for this renderer's
     *  pages.
     */
    public abstract String getContentType();

    /**
     * Performs any protocol specific preparation that is needed before the
     * render modes's contents are rendered.
     *
     * @param pr a {@link PortletRenderRequest}
     * @return boolean flag indicating whether or not to render the portlet's
     * contents (e.g. is the cached version still valid)
     */
    public abstract boolean prepareResponse(PortletRenderRequest pr)
        throws PortletException;

    /**
     * Performs the steps necessary to render the portlet's contents for this
     * specific {@link PortletRenderRequest}. If this ManagedRenderer is
     * rendering for the <i>default page</i>, this method should be able to
     * render contents for all remaining supported modes.
     *
     * @param pr a {@link PortletRenderRequest}
     */
    public abstract void renderBody(PortletRenderRequest pr)
        throws PortletException;
}
