com.caucho.portal.generic
Interface Renderer

All Known Implementing Classes:
AbstractRenderer, HtmlRenderer

public interface Renderer

Classes can implement AbstractRenderer to protect from API changes.


Method Summary
 void finish(java.io.OutputStream outputStream, RenderRequest renderRequest, java.lang.String namespace, boolean isDiscarded)
          Finish with an OutputStream produced by this factory.
 void finish(java.io.PrintWriter writer, RenderRequest request, java.lang.String namespace, boolean isDiscarded)
          Finish with a Writer produced by this factory.
 int getBufferSize()
           
 java.lang.String getDefaultContentType()
          If isAlwaysWrite() or isAlwaysStream() is true, then a Writer or OutputStream might be obtained before the content type of the response has been set.
 java.io.OutputStream getOutputStream(java.io.OutputStream out, RenderRequest renderRequest, java.lang.String namespace)
          Return an OutputStream that wraps the passed OutputStream, or null if there is no specialized writer for this request.
 java.io.PrintWriter getWriter(java.io.PrintWriter out, RenderRequest request, java.lang.String namespace)
          Return a Writer that wraps the passed PrintWriter, or null if there is no specialized writer for this request.
 boolean isAlwaysStream()
          If true the portal will always call getOutputStream(), even if the portlet does not call getOutputStream(), unless getWriter() has been called.
 boolean isAlwaysWrite()
          If true the portal will always call getWriter(), even if the portlet does not call getWriter(), unless getOutputStream() has been called.
 boolean isPortletModeAllowed(PortletRequest request, PortletMode portletMode)
          Return true if the PortletMode is allowed.
 boolean isWindowStateAllowed(PortletRequest request, WindowState windowState)
          Return true if the WindowState is allowed.
 

Method Detail

isWindowStateAllowed

boolean isWindowStateAllowed(PortletRequest request,
                             WindowState windowState)
Return true if the WindowState is allowed. portletRequest.getResponseContentType() can be used if the allowed portlet modes depends on the mime type of the response.


isPortletModeAllowed

boolean isPortletModeAllowed(PortletRequest request,
                             PortletMode portletMode)
Return true if the PortletMode is allowed. portletRequest.getResponseContentType() can be used if the allowed portlet modes depends on the mime type of the response.


isAlwaysWrite

boolean isAlwaysWrite()
If true the portal will always call getWriter(), even if the portlet does not call getWriter(), unless getOutputStream() has been called.


isAlwaysStream

boolean isAlwaysStream()
If true the portal will always call getOutputStream(), even if the portlet does not call getOutputStream(), unless getWriter() has been called.


getDefaultContentType

java.lang.String getDefaultContentType()
If isAlwaysWrite() or isAlwaysStream() is true, then a Writer or OutputStream might be obtained before the content type of the response has been set. IF that is the case, then this method is called to detrmine a default content type.


getBufferSize

int getBufferSize()

getWriter

java.io.PrintWriter getWriter(java.io.PrintWriter out,
                              RenderRequest request,
                              java.lang.String namespace)
                              throws java.io.IOException
Return a Writer that wraps the passed PrintWriter, or null if there is no specialized writer for this request. renderRequest.getResponseContentType() can be used if the Renderer needs to know the content type. renderRequest.getAttribute("javax.portlet.title") may contain a title for the Window, if the portlet has set one.

Throws:
java.io.IOException

finish

void finish(java.io.PrintWriter writer,
            RenderRequest request,
            java.lang.String namespace,
            boolean isDiscarded)
            throws java.io.IOException
Finish with a Writer produced by this factory. This may be called even if the writer threw an Exception.

Parameters:
isDiscarded - true if the portal discarded the output. Output is discarded when the portal wishes to discard any output that has been made for the window, with the intention that the window should not be rendered at all.
Throws:
java.io.IOException

getOutputStream

java.io.OutputStream getOutputStream(java.io.OutputStream out,
                                     RenderRequest renderRequest,
                                     java.lang.String namespace)
                                     throws java.io.IOException
Return an OutputStream that wraps the passed OutputStream, or null if there is no specialized writer for this request. renderRequest.getResponseContentType() can be used if the Renderer needs to know the content type. renderRequest.getAttribute("javax.portlet.title") may contain a title for the Window, if the portlet has set one.

Throws:
java.io.IOException

finish

void finish(java.io.OutputStream outputStream,
            RenderRequest renderRequest,
            java.lang.String namespace,
            boolean isDiscarded)
            throws java.io.IOException
Finish with an OutputStream produced by this factory. This may be called even if the outputStream threw an Exception.

Parameters:
discarded - true if the portal discarded the output, may occur Output is discarded when the portal wishes to discard any output that has been made for the window, with the intention that the window should not be rendered at all.
Throws:
java.io.IOException