org.apache.jetspeed.portlet
Interface PortletResponse

All Known Subinterfaces:
SaxPortletResponse

public interface PortletResponse

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

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

Author:
Thomas F. Boehme
See Also:
PortletRequest

Method Summary
 PortletURI createURI(Portlet.Mode mode)
          Creates a portlet URI for the given portlet mode.
 PortletURI createURI(Portlet.Mode mode, PortletWindow.State state)
          Creates a portlet URI for the given portlet mode and given portlet window state.
 java.lang.String encodeNamespace(java.lang.String aValue)
          Maps the given string value into this portlet's namespace.
 java.lang.String encodeURI(java.lang.String path)
           Returns the encoded URI of the resource at the given path.
 java.io.PrintWriter getWriter()
          Returns the writer object that can be used to contribute markup to the portlet response.
 

Method Detail

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 either a full document or just a fragment of the markup. A corresponding setting in the deployment descriptor has to be made.

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

createURI

public PortletURI createURI(Portlet.Mode mode)
Creates a portlet URI for the given portlet mode. The returned URI can be further extended by adding portlet-specific parameters and by attaching actions. Also, the portlet window will stay in the same state as before.

Parameters:
mode - the portlet mode
Returns:
a portlet URI

createURI

public PortletURI createURI(Portlet.Mode mode,
                            PortletWindow.State state)
Creates a portlet URI for the given portlet mode and given portlet window state. The returned URI can be further extended by adding portlet-specific parameters and by attaching actions.

Parameters:
mode - the portlet mode
state - the portlet window state
Returns:
a portlet URI

encodeURI

public java.lang.String encodeURI(java.lang.String path)

Returns the encoded URI of the resource at the given path. Encoding may include prefixing, conversion to absolute URL, etc.

To generate unprotected URI's like an image use the direct path inside of you portlet (e.g. /myportlet/myimage.gif). Otherwise, to generate protected URI's like an property file use the path inside of your portlet prefixed with /portlet-inf/ (e.g. /portlet-inf/myportlet/myportlet.jsp)

Parameters:
path - the path to the resource
Returns:
the resource URI as string

encodeNamespace

public java.lang.String encodeNamespace(java.lang.String aValue)
Maps the given string value into this portlet's namespace. Should be applied to every variable or name used in the output stream. For example, an parameter used in forms, a function name in javascript.

Parameters:
aValue - the name to be mapped
Returns:
the mapped name


Copyright © 2002 Apache Software Foundation. All Rights Reserved.