com.mf.roundhouse.portal.util
Class RenderResponseImpl

java.lang.Object
  extended byHttpServletResponseWrapper
      extended bycom.mf.roundhouse.portal.util.PortletResponseImpl
          extended bycom.mf.roundhouse.portal.util.RenderResponseImpl
All Implemented Interfaces:
PortletResponse, RenderResponse

public class RenderResponseImpl
extends PortletResponseImpl
implements RenderResponse

Author:
Jeffrey Payne
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.mf.roundhouse.portal.util.PortletResponseImpl
_currentPage, _portletRequest, _properties, _windowInstance
 
Fields inherited from interface javax.portlet.RenderResponse
EXPIRATION_CACHE
 
Constructor Summary
RenderResponseImpl(HttpServletResponse response, PortletWindowInstance windowInstance, PortletRequestImpl request, PortalPageLayout currentPage)
           
 
Method Summary
 PortletURL createActionURL()
          Creates a portlet URL targeting the portlet.
 PortletURL createRenderURL()
          Creates a portlet URL targeting the portlet.
 java.lang.String getContentType()
          Returns the MIME type that can be used to contribute markup to the render response.
 java.lang.String getNamespace()
          The value returned by this method should be prefixed or appended to elements, such as JavaScript variables or function names, to ensure they are unique in the context of the portal page.
 ServletOutputStream getOutputStream()
           
 java.io.OutputStream getPortletOutputStream()
          Returns a OutputStream suitable for writing binary data in the response.
 byte[] getRenderedBytes()
           
 java.lang.String getTitle()
           
 java.io.PrintWriter getWriter()
          Returns a PrintWriter object that can send character text to the portal.
 void reset()
          Clears any data that exists in the buffer as well as the properties set.
 void setContentType(java.lang.String type)
          Sets the MIME type for the render response.
 void setTitle(java.lang.String title)
          This method sets the title of the portlet.
 
Methods inherited from class com.mf.roundhouse.portal.util.PortletResponseImpl
addProperty, encodeURL, getHttpResponse, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.portlet.RenderResponse
flushBuffer, getBufferSize, getCharacterEncoding, getLocale, isCommitted, resetBuffer, setBufferSize
 
Methods inherited from interface javax.portlet.PortletResponse
addProperty, encodeURL, setProperty
 

Constructor Detail

RenderResponseImpl

public RenderResponseImpl(HttpServletResponse response,
                          PortletWindowInstance windowInstance,
                          PortletRequestImpl request,
                          PortalPageLayout currentPage)
Parameters:
response -
request -
Method Detail

getContentType

public java.lang.String getContentType()
Description copied from interface: RenderResponse
Returns the MIME type that can be used to contribute markup to the render response.

If no content type was set previously using the RenderResponse.setContentType(java.lang.String) method this method retuns null.

Specified by:
getContentType in interface RenderResponse
Returns:
the MIME type of the response, or null if no content type is set
See Also:
RenderResponse.setContentType(java.lang.String)

getTitle

public java.lang.String getTitle()

createRenderURL

public PortletURL createRenderURL()
Description copied from interface: RenderResponse
Creates a portlet URL targeting the portlet. If no portlet mode, window state or security modifier is set in the PortletURL the current values are preserved. If a request is triggered by the PortletURL, it results in a render request.

The returned URL can be further extended by adding portlet-specific parameters and portlet modes and window states.

The created URL will per default not contain any parameters of the current render request.

Specified by:
createRenderURL in interface RenderResponse
Returns:
a portlet render URL

createActionURL

public PortletURL createActionURL()
Description copied from interface: RenderResponse
Creates a portlet URL targeting the portlet. If no portlet mode, window state or security modifier is set in the PortletURL the current values are preserved. If a request is triggered by the PortletURL, it results in an action request.

The returned URL can be further extended by adding portlet-specific parameters and portlet modes and window states.

The created URL will per default not contain any parameters of the current render request.

Specified by:
createActionURL in interface RenderResponse
Returns:
a portlet action URL

getNamespace

public java.lang.String getNamespace()
Description copied from interface: RenderResponse
The value returned by this method should be prefixed or appended to elements, such as JavaScript variables or function names, to ensure they are unique in the context of the portal page.

Specified by:
getNamespace in interface RenderResponse
Returns:
the namespace

setTitle

public void setTitle(java.lang.String title)
Description copied from interface: RenderResponse
This method sets the title of the portlet.

The value can be a text String

Specified by:
setTitle in interface RenderResponse
Parameters:
title - portlet title as text String or resource URI

setContentType

public void setContentType(java.lang.String type)
Description copied from interface: RenderResponse
Sets the MIME type for the render response. The portlet must set the content type before calling RenderResponse.getWriter() or RenderResponse.getPortletOutputStream().

Calling setContentType after getWriter or getOutputStream does not change the content type.

Specified by:
setContentType in interface RenderResponse
Parameters:
type - the content MIME type
See Also:
PortletRequest.getResponseContentTypes(), RenderResponse.getContentType()

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
Description copied from interface: RenderResponse
Returns a PrintWriter object that can send character text to the portal.

Before calling this method the content type of the render response must be set using the RenderResponse.setContentType(java.lang.String) method.

Either this method or RenderResponse.getPortletOutputStream() may be called to write the body, not both.

Specified by:
getWriter in interface RenderResponse
Returns:
a PrintWriter object that can return character data to the portal
Throws:
java.io.IOException - if an input or output exception occurred
See Also:
RenderResponse.setContentType(java.lang.String), RenderResponse.getPortletOutputStream()

reset

public void reset()
Description copied from interface: RenderResponse
Clears any data that exists in the buffer as well as the properties set. If the response has been committed, this method throws an IllegalStateException.

Specified by:
reset in interface RenderResponse
See Also:
RenderResponse.setBufferSize(int), RenderResponse.getBufferSize(), RenderResponse.flushBuffer(), RenderResponse.isCommitted()

getPortletOutputStream

public java.io.OutputStream getPortletOutputStream()
                                            throws java.io.IOException
Description copied from interface: RenderResponse
Returns a OutputStream suitable for writing binary data in the response. The portlet container does not encode the binary data.

Before calling this method the content type of the render response must be set using the RenderResponse.setContentType(java.lang.String) method.

Calling flush() on the OutputStream commits the response.

Either this method or RenderResponse.getWriter() may be called to write the body, not both.

Specified by:
getPortletOutputStream in interface RenderResponse
Returns:
a OutputStream for writing binary data
Throws:
java.io.IOException - if an input or output exception occurred
See Also:
RenderResponse.setContentType(java.lang.String), RenderResponse.getWriter()

getRenderedBytes

public byte[] getRenderedBytes()

getOutputStream

public ServletOutputStream getOutputStream()
                                    throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2004 Media Fortress, LLC. Licensed for commercial use under the Apache 2.0 License.