/** Notify user that not logged in. */
  public void writeNotLoggedInPageHtml(
      RenderRequest request, RenderResponse response, Window window) throws IOException {
    response.setContentType("text/html");
    final BufferedWriter page =
        new BufferedWriter(new OutputStreamWriter(response.getPortletOutputStream(), "UTF-8"));

    page.write("<div class=\"portlet-msg-error\">Please login to use the mail portlet.</div>");

    page.close();
  }
 public void flushContentToWrappedResponse() throws IOException {
   if (caw != null) {
     pw.flush();
     caw.writeTo(response.getWriter());
     caw.reset();
   } else if (bawos != null) {
     try {
       bawos.writeTo(response.getWriter(), response.getCharacterEncoding());
     } catch (IllegalStateException ise) {
       bawos.writeTo(response.getPortletOutputStream());
     }
     bawos.resetByteArray();
   }
 }