org.apache.jetspeed.portal
Interface PortletResponse


public interface PortletResponse

The PortletResponse interface represents the response sent to the client device.

It is up the portlet container to enhance, extends, or modify the response as required before it is actually sent to the client.

See Also:
PortletRequest

Method Summary
 void addCookie(javax.servlet.http.Cookie aCookie)
          Adds the given cookie to the response.
 PortletURI createURI(PortletRequest.Type aRequestType)
          Create a portlet URI for the given request type.
 java.lang.String getCharacterEncoding()
          Returns the name of the charset used for the MIME body sent in this response.
 java.util.Locale getLocale()
          Returns the locale assigned to this response.
 org.apache.jetspeed.portal.ServletRequest getServletResponse()
          Returns the original servlet request as sent by the client device.
 java.io.PrintWriter getWriter()
          Returns the writer object that can be used to contribute markup to the portlet response.
 

Method Detail

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Returns the name of the charset used for the MIME body sent in this response. Not sure whether this methods is really required
Returns:
a string specifying the name of the charset, for example, ISO-8859-1

getLocale

public java.util.Locale getLocale()
Returns the locale assigned to this response.
Returns:
the locale

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
Returns the writer object that can be used to contribute markup to the portlet response.

It is important to note that the markup generated by the portlet is just a fragment of the overall markup generated by the portal itself. Therefore, there are limits as to what a portlet is allowed to generate in terms of markup. Please see the Portlet Development Guide (tbd).

Returns:
the print writer
Throws:
java.io.IOException - if the I/O operation fails

addCookie

public void addCookie(javax.servlet.http.Cookie aCookie)
Adds the given cookie to the response. This methods can be called multiple times to set more than one cookie. The cookie is not really stored in the response but rather in the portal. The portal (inter)acts on behalf of the user. The content providers "see" the portal, not the user.

Alternatively, it is possible to have the behaviour as a user-defineable setting. Then the user can decide whether

  • cookies should not be stored at all
  • cookies are stored by the portlet
  • cookies are passed-thru to the client device (hoping that it can store cookies)
On top of that, it is possible to imagine these settings being configurable per portlet.
Parameters:
aCookie - the cookie

createURI

public PortletURI createURI(PortletRequest.Type aRequestType)
Create a portlet URI for the given request type. The returned URI can be further extended by adding portlet-specific parameters.
Parameters:
aRequestType - the request type
Returns:
a portlet URI

getServletResponse

public org.apache.jetspeed.portal.ServletRequest getServletResponse()
Returns the original servlet request as sent by the client device. We have two schools of thought here: one that wants to hide anything "dangerous" or "internal", another that wants to have an "expert" mode. This method (along with its counterpart in PortletResponse) really needs to be carefully considered and voted on.
Returns:
the underlying servlet request
See Also:
PortletRequest.getServletRequest()