站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.4 API 英文版文档

RenderResponseImpl - JBOSS Portal 2.4 API 英文版文档


org.jboss.portal.portlet.impl.jsr168
Class RenderResponseImpl

java.lang.Object
  extended byorg.jboss.portal.portlet.impl.jsr168.PortletResponseImpl
      extended byorg.jboss.portal.portlet.impl.jsr168.RenderResponseImpl
All Implemented Interfaces:
PortletResponse, RenderResponse
Direct Known Subclasses:
JBossRenderResponse

public class RenderResponseImpl
extends PortletResponseImpl
implements RenderResponse


Field Summary
protected  java.lang.String namespace
          The namespace.
protected  FragmentResult result
          The fragment result.
 
Fields inherited from class org.jboss.portal.portlet.impl.jsr168.PortletResponseImpl
invocation, preq
 
Fields inherited from interface javax.portlet.RenderResponse
EXPIRATION_CACHE
 
Constructor Summary
RenderResponseImpl(RenderInvocation invocation, PortletRequestImpl preq)
           
 
Method Summary
 void addProperty(java.lang.String name, java.lang.String value)
          Adds a String property to an existing key to be returned to the portal.
 PortletURL createActionURL()
          Creates a portlet URL targeting the portlet.
 PortletURL createRenderURL()
          Creates a portlet URL targeting the portlet.
 void flushBuffer()
          Forces any content in the buffer to be written to the client.
 int getBufferSize()
          Returns the actual buffer size used for the response.
 java.lang.String getCharacterEncoding()
          Returns the name of the charset used for the MIME body sent in this response.
 java.lang.String getContentType()
          Returns the MIME type that can be used to contribute markup to the render response.
 java.util.Locale getLocale()
          Returns the locale assigned to the 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.
 java.io.OutputStream getPortletOutputStream()
          Returns a OutputStream suitable for writing binary data in the response.
 Result getResult()
           
 java.io.PrintWriter getWriter()
          Returns a PrintWriter object that can send character text to the portal.
 boolean isCommitted()
          Returns a boolean indicating if the response has been committed.
 void reset()
          Clears any data that exists in the buffer as well as the properties set.
 void resetBuffer()
          Clears the content of the underlying buffer in the response without clearing properties set.
 void setBufferSize(int i)
          Sets the preferred buffer size for the body of the response.
 void setContentType(java.lang.String contentType)
          Sets the MIME type for the render response.
 void setProperty(java.lang.String name, java.lang.String value)
          Sets a String property to be returned to the portal.
 void setTitle(java.lang.String s)
          This method sets the title of the portlet.
 
Methods inherited from class org.jboss.portal.portlet.impl.jsr168.PortletResponseImpl
encodeURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.portlet.PortletResponse
encodeURL
 

Field Detail

result

protected FragmentResult result
The fragment result.


namespace

protected java.lang.String namespace
The namespace.

Constructor Detail

RenderResponseImpl

public RenderResponseImpl(RenderInvocation invocation,
                          PortletRequestImpl preq)
Method Detail

getResult

public Result getResult()

setTitle

public void setTitle(java.lang.String s)
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:
s - portlet title as text String or resource URI

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)

setContentType

public void setContentType(java.lang.String contentType)
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:
contentType - 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()

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()

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

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Description copied from interface: RenderResponse
Returns the name of the charset used for the MIME body sent in this response.

See RFC 2047 for more information about character encoding and MIME.

Specified by:
getCharacterEncoding in interface RenderResponse
Returns:
a String specifying the name of the charset, for example, ISO-8859-1

getLocale

public java.util.Locale getLocale()
Description copied from interface: RenderResponse
Returns the locale assigned to the response.

Specified by:
getLocale in interface RenderResponse
Returns:
Locale of this response

setBufferSize

public void setBufferSize(int i)
Description copied from interface: RenderResponse
Sets the preferred buffer size for the body of the response. The portlet container will use a buffer at least as large as the size requested.

This method must be called before any response body content is written; if content has been written, or the portlet container does not support buffering, this method may throw an IllegalStateException.

Specified by:
setBufferSize in interface RenderResponse
Parameters:
i - the preferred buffer size
See Also:
RenderResponse.getBufferSize(), RenderResponse.flushBuffer(), RenderResponse.isCommitted(), RenderResponse.reset()

getBufferSize

public int getBufferSize()
Description copied from interface: RenderResponse
Returns the actual buffer size used for the response. If no buffering is used, this method returns 0.

Specified by:
getBufferSize in interface RenderResponse
Returns:
the actual buffer size used
See Also:
RenderResponse.setBufferSize(int), RenderResponse.flushBuffer(), RenderResponse.isCommitted(), RenderResponse.reset()

flushBuffer

public void flushBuffer()
                 throws java.io.IOException
Description copied from interface: RenderResponse
Forces any content in the buffer to be written to the client. A call to this method automatically commits the response.

Specified by:
flushBuffer in interface RenderResponse
Throws:
java.io.IOException - if an error occured when writing the output
See Also:
RenderResponse.setBufferSize(int), RenderResponse.getBufferSize(), RenderResponse.isCommitted(), RenderResponse.reset()

resetBuffer

public void resetBuffer()
Description copied from interface: RenderResponse
Clears the content of the underlying buffer in the response without clearing properties set. If the response has been committed, this method throws an IllegalStateException.

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

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()

isCommitted

public boolean isCommitted()
Description copied from interface: RenderResponse
Returns a boolean indicating if the response has been committed.

Specified by:
isCommitted in interface RenderResponse
Returns:
a boolean indicating if the response has been committed
See Also:
RenderResponse.setBufferSize(int), RenderResponse.getBufferSize(), RenderResponse.flushBuffer(), RenderResponse.reset()

addProperty

public void addProperty(java.lang.String name,
                        java.lang.String value)
Description copied from interface: PortletResponse
Adds a String property to an existing key to be returned to the portal.

This method allows response properties to have multiple values.

Properties can be used by portlets to provide vendor specific information to the portal.

Specified by:
addProperty in interface PortletResponse
Parameters:
name - the key of the property to be returned to the portal
value - the value of the property to be returned to the portal

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Description copied from interface: PortletResponse
Sets a String property to be returned to the portal.

Properties can be used by portlets to provide vendor specific information to the portal.

This method resets all properties previously added with the same key.

Specified by:
setProperty in interface PortletResponse
Parameters:
name - the key of the property to be returned to the portal
value - the value of the property to be returned to the portal