| java.lang.Object com.caucho.portal.generic.AbstractRenderer
All known Subclasses: com.caucho.portal.alpharenderer.HtmlRenderer,
AbstractRenderer | abstract public class AbstractRenderer implements Renderer(Code) | | Template
To implement a renderer that adds decoration to content
rendered with the PrintWriter, the following are overridden:
protected void beginPage( PrintWriter out, RenderRequest request, String namespace )
throws IOException
{
...
}
protected void beginWindow( PrintWriter out, RenderRequest request, String namespace )
throws IOException
{
...
}
protected void endWindow( PrintWriter out, RenderRequest request, String namespace )
throws IOException
{
...
}
protected void endPage( PrintWriter out, RenderRequest request, String namespace )
throws IOException
{
...
}
Helper methods
|
Method Summary | |
protected void | beginPage(PrintWriter out, RenderRequest request, String namespace) Derived classes override to insert header content for a page,
called only when beginPage() has not been called on some instance of
AbstractRenderer for this request. | protected void | beginPage(OutputStream out, RenderRequest request, String namespace) Derived classes override to insert header content for a page,
called only when beginPage() has not been called on some instance of
AbstractRenderer for this request.
request.getResponseContentType() can be used
to determine the content type.
request.getAttribute("javax.portlet.title") may contain a title
for the Window, if the portlet has set one. | protected void | beginWindow(PrintWriter out, RenderRequest request, String namespace) Derived classes override to insert header content before a portlet
has been rendered. | protected void | beginWindow(OutputStream out, RenderRequest request, String namespace) Derived classes override to insert header content before a portlet
has been rendered.
request.getResponseContentType() is used
to determine the content type.
request.getAttribute("javax.portlet.title") may contain a title
for the Window, if the portlet has set one. | protected PortletURL | createControlURL(RenderRequest request) Create a PortletURL for a control, such as a link to change the window
state or portlet mode. | protected void | endPage(PrintWriter out, RenderRequest request, String namespace) Derived classes override to insert footer content for a page,
called from only when beginPage() has been called for the Window. | protected void | endPage(OutputStream out, RenderRequest request, String namespace) Derived classes override to insert footer content for a page,
called from only when beginPage() has been called for the Window. | protected void | endWindow(PrintWriter out, RenderRequest request, String namespace) Derived classes override to append footer content after a portlet
has been rendered. | protected void | endWindow(OutputStream out, RenderRequest request, String namespace) Derived classes override to append footer content after a portlet
has been rendered. | public void | finish(PrintWriter out, RenderRequest request, String namespace, boolean isDiscarded) Finish with a Writer produced by this factory.
This may be called even if the writer threw an Exception.
This implementation calls endWindow() and endPage() if needed. | public void | finish(OutputStream out, RenderRequest request, String namespace, boolean isDiscarded) Finish with an OutputStream produced by this factory. | public int | getBufferSize() | protected String | getContentType(RenderRequest request) Return the content type to use for the response. | public String | getDefaultContentType() | protected Locale | getLocale(RenderRequest request) Return the locale to use for the response. | public OutputStream | getOutputStream(OutputStream out, RenderRequest request, String namespace) Return an OutputStream that wraps the passed OutputStream, or null
if there is no specialized writer for this request. | protected PortletConfig | getPortletConfig(RenderRequest request) Get the PortletConfig for the portlet being rendered. | protected Set<PortletMode> | getPortletModes(RenderRequest request) Return an Set of the possible portlet modes that the window can
have. | protected RenderResponse | getRenderResponse(RenderRequest request) Get the RenderResponse for the portlet being rendered. | protected ResourceBundle | getResourceBundle(RenderRequest request) Get a resource bundle for the portlet being rendered. | protected String | getShortTitle(RenderRequest request) Return the short title for the window, or null if a title is not
available. | protected String | getTitle(RenderRequest request) Return the title for the window, or null if it has not been set. | protected Set<WindowState> | getWindowStates(RenderRequest request) Return an Set of the possible window states that the window can
have. | public PrintWriter | getWriter(PrintWriter out, RenderRequest request, String namespace) Return a Writer that wraps the passed PrintWriter, or null
if there is no specialized writer for this request.
This implementation calls beginPage() if needed and beginWindow()
before returning the writer. | public boolean | isAlwaysStream() | public boolean | isAlwaysWrite() | public boolean | isPortletModeAllowed(PortletRequest request, PortletMode portletMode) Return true if the WindowState is allowed.
portletRequest.getResponseContentType() can be used
if the allowed portlet modes is dependent on the mime type of the
response.
The default is to return true. | public boolean | isWindowStateAllowed(PortletRequest request, WindowState windowState) Return true if the WindowState is allowed.
portletRequest.getResponseContentType() can be used
if the allowed window states is dependent on the mime type of the
response.
The default is to return true. | protected PrintWriter | printEscaped(PrintWriter out, CharSequence string) Print a string with appropriate escaping for XML, for example '<'
becomes '<'. | public void | setAlwaysStream(boolean isAlwaysStream) If true the portal will always call getOutputStream(), even if the portlet
does not call getOutputStream(), unless getWriter() has been called.
The default is false. | public void | setAlwaysWrite(boolean isAlwaysWrite) If true the portal will always call getWriter(), even if the portlet does
not call getWriter(), unless getOutputStream() has been called.
The default is true. | public void | setBufferSize(int bufferSize) The default is -1, which allows the portal to choose a buffer size.
0 disables buffering of the renderer output. | public void | setDecorateWindow(boolean isDecorateWindow) If true beginWindow() and endWindow() are always called, if false never
called, the default is to call beginWindow() and endWindow() unless
beginPage() and endPage() are called. | public void | setDefaultContentType(String defaultContentType) The default content type used if
AbstractRenderer.isAlwaysWrite() or
AbstractRenderer.isAlwaysStream() is true and a
Writer or OutputStream is obtained before the content type of the
response has been set, default is "text/html". |
PAGE_HEADER_RENDERED | final public static String PAGE_HEADER_RENDERED(Code) | | |
beginPage | protected void beginPage(PrintWriter out, RenderRequest request, String namespace) throws IOException(Code) | | Derived classes override to insert header content for a page,
called only when beginPage() has not been called on some instance of
AbstractRenderer for this request.
|
beginPage | protected void beginPage(OutputStream out, RenderRequest request, String namespace) throws IOException(Code) | | Derived classes override to insert header content for a page,
called only when beginPage() has not been called on some instance of
AbstractRenderer for this request.
request.getResponseContentType() can be used
to determine the content type.
request.getAttribute("javax.portlet.title") may contain a title
for the Window, if the portlet has set one.
|
beginWindow | protected void beginWindow(PrintWriter out, RenderRequest request, String namespace) throws IOException(Code) | | Derived classes override to insert header content before a portlet
has been rendered.
|
beginWindow | protected void beginWindow(OutputStream out, RenderRequest request, String namespace) throws IOException(Code) | | Derived classes override to insert header content before a portlet
has been rendered.
request.getResponseContentType() is used
to determine the content type.
request.getAttribute("javax.portlet.title") may contain a title
for the Window, if the portlet has set one.
|
createControlURL | protected PortletURL createControlURL(RenderRequest request)(Code) | | Create a PortletURL for a control, such as a link to change the window
state or portlet mode. Control URLs are render urls that maintain
existing render parameters.
|
endPage | protected void endPage(PrintWriter out, RenderRequest request, String namespace) throws IOException(Code) | | Derived classes override to insert footer content for a page,
called from only when beginPage() has been called for the Window.
|
endPage | protected void endPage(OutputStream out, RenderRequest request, String namespace) throws IOException(Code) | | Derived classes override to insert footer content for a page,
called from only when beginPage() has been called for the Window.
request.getResponseContentType() can be used
to determine the content type.
|
endWindow | protected void endWindow(PrintWriter out, RenderRequest request, String namespace) throws IOException(Code) | | Derived classes override to append footer content after a portlet
has been rendered.
|
endWindow | protected void endWindow(OutputStream out, RenderRequest request, String namespace) throws IOException(Code) | | Derived classes override to append footer content after a portlet
has been rendered.
request.getResponseContentType() can be used
to determine the content type.
|
finish | public void finish(PrintWriter out, RenderRequest request, String namespace, boolean isDiscarded) throws IOException(Code) | | Finish with a Writer produced by this factory.
This may be called even if the writer threw an Exception.
This implementation calls endWindow() and endPage() if needed.
|
finish | public void finish(OutputStream out, RenderRequest request, String namespace, boolean isDiscarded) throws IOException(Code) | | Finish with an OutputStream produced by this factory.
This may be called even if the outputStream threw an Exception.
This implementation calls endWindow() and endPage() if needed.
|
getBufferSize | public int getBufferSize()(Code) | | |
getContentType | protected String getContentType(RenderRequest request)(Code) | | Return the content type to use for the response.
|
getDefaultContentType | public String getDefaultContentType()(Code) | | |
getLocale | protected Locale getLocale(RenderRequest request)(Code) | | Return the locale to use for the response.
|
getOutputStream | public OutputStream getOutputStream(OutputStream out, RenderRequest request, String namespace) throws IOException(Code) | | Return an OutputStream that wraps the passed OutputStream, or null
if there is no specialized writer for this request.
|
getPortletConfig | protected PortletConfig getPortletConfig(RenderRequest request)(Code) | | Get the PortletConfig for the portlet being rendered.
|
getPortletModes | protected Set<PortletMode> getPortletModes(RenderRequest request)(Code) | | Return an Set of the possible portlet modes that the window can
have. The list of all possibilities is first obtained from
javax.portlet.PortalContext.getSupportedPortletModesa PortalContext.getSupportedPortletModes() .
Each one is checked with
javax.portlet.PortletRequest.isPortletModeAllowed(javax.portlet.PortletMode) request.isPortletModeAllowed() ,
if it is allowed then it is included in the returned Set.
|
getRenderResponse | protected RenderResponse getRenderResponse(RenderRequest request)(Code) | | Get the RenderResponse for the portlet being rendered.
|
getResourceBundle | protected ResourceBundle getResourceBundle(RenderRequest request)(Code) | | Get a resource bundle for the portlet being rendered.
|
getShortTitle | protected String getShortTitle(RenderRequest request)(Code) | | Return the short title for the window, or null if a title is not
available.
- A title set by the portlet using
request.setAttribute("javax.portlet.short-title");
- A title set by the portlet using response.setTitle()
or request.setAttribute("javax.portlet.title");
- The value of a lookup in the windows resource bundle for
"javax.portlet.short-title" using the locale determined by
AbstractRenderer.getLocale(javax.portlet.RenderRequest) getLocale(request) .
- The value of a lookup in the windows resource bundle for
"javax.portlet.title" using the locale determined by
AbstractRenderer.getLocale(javax.portlet.RenderRequest) getLocale(request) .
|
getTitle | protected String getTitle(RenderRequest request)(Code) | | Return the title for the window, or null if it has not been set.
The title is the first of:
- A title set by the portlet using response.setTitle()
or request.setAttribute("javax.portlet.title");
- The value of a lookup in the windows resource bundle for
"javax.portlet.title" using the locale dertmined by
AbstractRenderer.getLocale(javax.portlet.RenderRequest) getLocale(request) .
|
getWindowStates | protected Set<WindowState> getWindowStates(RenderRequest request)(Code) | | Return an Set of the possible window states that the window can
have. The list of all possibilities is first obtained from
javax.portlet.PortalContext.getSupportedWindowStates PortalContext.getSupportedWindowStates() .
Each one is checked with
javax.portlet.PortletRequest.isWindowStateAllowed(javax.portlet.WindowState) request.isWindowStateAllowed() ,
if it is allowed then it is included in the returned Set.
|
getWriter | public PrintWriter getWriter(PrintWriter out, RenderRequest request, String namespace) throws IOException(Code) | | Return a Writer that wraps the passed PrintWriter, or null
if there is no specialized writer for this request.
This implementation calls beginPage() if needed and beginWindow()
before returning the writer.
|
isAlwaysStream | public boolean isAlwaysStream()(Code) | | |
isAlwaysWrite | public boolean isAlwaysWrite()(Code) | | |
isPortletModeAllowed | public boolean isPortletModeAllowed(PortletRequest request, PortletMode portletMode)(Code) | | Return true if the WindowState is allowed.
portletRequest.getResponseContentType() can be used
if the allowed portlet modes is dependent on the mime type of the
response.
The default is to return true.
|
isWindowStateAllowed | public boolean isWindowStateAllowed(PortletRequest request, WindowState windowState)(Code) | | Return true if the WindowState is allowed.
portletRequest.getResponseContentType() can be used
if the allowed window states is dependent on the mime type of the
response.
The default is to return true.
|
setAlwaysStream | public void setAlwaysStream(boolean isAlwaysStream)(Code) | | If true the portal will always call getOutputStream(), even if the portlet
does not call getOutputStream(), unless getWriter() has been called.
The default is false.
|
setAlwaysWrite | public void setAlwaysWrite(boolean isAlwaysWrite)(Code) | | If true the portal will always call getWriter(), even if the portlet does
not call getWriter(), unless getOutputStream() has been called.
The default is true.
|
setBufferSize | public void setBufferSize(int bufferSize)(Code) | | The default is -1, which allows the portal to choose a buffer size.
0 disables buffering of the renderer output.
|
setDecorateWindow | public void setDecorateWindow(boolean isDecorateWindow)(Code) | | If true beginWindow() and endWindow() are always called, if false never
called, the default is to call beginWindow() and endWindow() unless
beginPage() and endPage() are called.
|
|
|