Interface PortletURL
-
- All Superinterfaces:
BaseURL
public interface PortletURL extends BaseURL
ThePortletURL
interface represents a URL that reference the portlet itself.A PortletURL is created through the
RenderResponse
orResourceResponse
. Parameters, a portlet mode, a window state and a security level can be added toPortletURL
objects.There are two types of PortletURLs:
- Action URLs, they are created with
createActionURL
, and trigger an action request followed by a render request. - Render URLs, they are created with
createRenderURL
, and trigger a render request.
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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. ThePortletRequest.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. ThePortletRequest.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 thepublic-render-parameter
element with theidentifier
mapping to the parameter name.Note that calling this method on a PortletURL of type Action URL does not have any effect.
- Parameters:
name
- aString
specifying the name of the public render parameter to be removed- Throws:
java.lang.IllegalArgumentException
- if name isnull
.- Since:
- 2.0
-
-