/*
 * FlightRenderer.java 1.00 27-Feb-2001
 *
 * Copyright 2000-2001 by Oracle Corporation
 * 500 Oracle Parkway, Redwood Shores, California, 94065, U.S.A.
 * All rights reserved.
 */
package oracle.portal.sample.v1.devguide.externalApp;

import oracle.portal.provider.v1.*;
import java.io.*;

/**
 * This class is used by the Fligths provider to render the
 * portlet content
 *
 */
public class FlightRenderer implements PortletRenderer {

   /**
    * Constructor
    */
    public FlightRenderer() {
    }

 /**
  *  Call the Header, Footer, and FlightDispatch to render a portlet.
  *
  *  This routine does very little.  It simply calls the needed class / method to display
  *  a preexistant screen in the Flights of Fancy application.  The renderPortletHeader
  *  and renderPortletFooter are part of the JPDK utilities, and render the proper
  *  header and footer for a portlet in the Oracle Portal system respectively.
  *
  *  @param  pr Is a PortletRenderRequest object which can be seen in the
  *  JPDK API documentation.
  *
  *  @exception  throws any exception which may occure.
  */
  public void render(PortletRenderRequest pr) throws PortletException, AccessControlException
  {
    try
    {
      PrintWriter out = pr.getWriter("text/html");
      // Writes container -- handles rendering the border if necessary
      PortletRendererUtil.renderPortletHeader(pr, out, null);
      new FlightDispatch().process(pr);
      PortletRendererUtil.renderPortletFooter(pr,out);
    }
    catch (IllegalArgumentException ie)
    {
      throw new PortletException(ie);
    }
    catch (java.io.IOException ioe)
    {
      throw new PortletException(ioe);
    }
    catch (Exception e)
    {
      throw new PortletException(e);
    }
  }
}

