javax.portlet
Interface PortletURL

All Superinterfaces:
BaseURL

public interface PortletURL
extends BaseURL

The PortletURL interface represents a URL that reference the portlet itself.

A PortletURL is created through the RenderResponse or ResourceResponse. Parameters, a portlet mode, a window state and a security level can be added to PortletURL objects.

There are two types of PortletURLs:

The string representation of a PortletURL does not need to be a valid URL at the time the portlet is generating its content. It may contain special tokens that will be converted to a valid URL, by the portal, before the content is returned to the client.


Method Summary
 PortletMode getPortletMode()
          Returns the currently set portlet mode on this PortletURL.
 WindowState getWindowState()
          Returns the currently set window state on this PortletURL.
 void removePublicRenderParameter(java.lang.String name)
          Removes the specified public render parameter.
 void setPortletMode(PortletMode portletMode)
          Indicates the portlet mode the portlet must be in, if this portlet URL triggers a request.
 void setWindowState(WindowState windowState)
          Indicates the window state the portlet should be in, if this portlet URL triggers a request.
 
Methods inherited from interface javax.portlet.BaseURL
addProperty, getParameterMap, setParameter, setParameter, setParameters, setProperty, setSecure, toString, write, write
 

Method Detail

setWindowState

void setWindowState(WindowState windowState)
                    throws WindowStateException
Indicates the window state the portlet should be in, if this portlet URL triggers a request.

A URL can not have more than one window state attached to it. If more than one window state is set only the last one set is attached to the URL.

Parameters:
windowState - the portlet window state
Throws:
WindowStateException - if the portlet cannot switch to this state, because the portal does not support this state, the portlet has not declared in its deployment descriptor that it supports this state, or the current user is not allowed to switch to this state. The PortletRequest.isWindowStateAllowed() method can be used to check if the portlet can set a given window state.
See Also:
PortletRequest.isWindowStateAllowed(javax.portlet.WindowState)

setPortletMode

void setPortletMode(PortletMode portletMode)
                    throws PortletModeException
Indicates the portlet mode the portlet must be in, if this portlet URL triggers a request.

A URL can not have more than one portlet mode attached to it. If more than one portlet mode is set only the last one set is attached to the URL.

Parameters:
portletMode - the portlet mode
Throws:
PortletModeException - if the portlet cannot switch to this mode, because the portal does not support this mode, the portlet has not declared in its deployment descriptor that it supports this mode for the current markup, or the current user is not allowed to switch to this mode. The PortletRequest.isPortletModeAllowed() method can be used to check if the portlet can set a given portlet mode.
See Also:
PortletRequest.isPortletModeAllowed(javax.portlet.PortletMode)

getPortletMode

PortletMode getPortletMode()
Returns the currently set portlet mode on this PortletURL.

Returns:
the portlet mode, or null if none is set
Since:
2.0

getWindowState

WindowState getWindowState()
Returns the currently set window state on this PortletURL.

Returns:
the window state, or null if none is set
Since:
2.0

removePublicRenderParameter

void removePublicRenderParameter(java.lang.String name)
Removes the specified public render parameter. The name must reference a public render parameter defined in the portlet deployment descriptor under the public-render-parameter element with the identifier mapping to the parameter name.

Note that calling this method on a PortletURL of type Action URL does not have any effect.

Parameters:
name - a String specifying the name of the public render parameter to be removed
Throws:
java.lang.IllegalArgumentException - if name is null.
Since:
2.0