Interface PortletParameters
-
- All Known Subinterfaces:
ActionParameters,MutableActionParameters,MutablePortletParameters,MutableRenderParameters,MutableResourceParameters,RenderParameters,ResourceParameters
- All Known Implementing Classes:
ActionParametersWrapper,MutableActionParametersWrapper,MutablePortletParametersWrapper,MutableRenderParametersWrapper,MutableResourceParametersWrapper,PortletParametersWrapper,RenderParametersWrapper,ResourceParametersWrapper
public interface PortletParametersThePortletParametersinterface defines the API for accessing the parameters that are set for the portlet or on a portlet URL.Portlet parameters store state information that the portlet needs to render itself, generate content by serving resources, or make decisions when executing portlet actions. Conceptually the portlet parameters correspond to query string parameters that are stored in the URL used to access the portlet, although they are not required to actually be present on the URL as visible parameters.
Private parameters parameters are available exclusively to a single portlet. Public parameters can be shared between portlets.
The portlet parameters governing the request can be read during all portlet execution phases through the
PortletParametersobject available from the portlet request. Portlet parameters can be set for subsequent or future portlet execution phases through theMutablePortletParametersobject available from the portlet response object or from the portlet URL.Different types of portlet parameters are distinguished according to their use.
- Render Parameters
-
Set on the response during the Action and Event phases to govern content
generation during the Render and Resource phases. Also set on render URLs
to move the portlet to a new render state when the URL is triggered.
Refer to
RenderState.getRenderParameters(),MutableRenderState.getRenderParameters(), andRenderState.getRenderParameters().Example: Render URLs with differing render parameters can be used to implement tabbed navigation within a portlet.
- Resource Parameters
-
Provide additional information about the content to be generated when
serving a resource for the governing render state.
Set on resource URLs and made available to the portlet through the
resource request when the URL is triggered.
Refer to
ResourceRequest.getResourceParameters()andResourceURL.getResourceParameters().Example: Portlets may require several different pieces of content to be served for the governing render state. Resource URLs with differing resource parameters can be used to determine which content is to be served for a specific request.
- Action Parameters
-
Provide additional information about the action to be executed
for the governing render state.
Set on action URLs and made available to the portlet through the
action request when the URL is triggered, or provided to the
portlet by the client (form parameters).
Refer to
ActionRequest.getActionParameters()andActionURL.getActionParameters().Example: Portlets may render a number of buttons or links for the governing render state. Action URLs with differing action parameters can be used to determine which action is to be executed for a specific request.
Example: Portlets may render forms that, when submitted, may cause parameters to be added to the portlet action request. During action request processing, these form parameters will be available as action parameters.
- Since:
- 3.0
- See Also:
MutablePortletParameters
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MutablePortletParametersclone()Returns aMutablePortletParametersobject encapsulating a copy of the same parameters as the original object.Set<String>getNames()Returns aSetofStringobjects containing the names of the parameters contained in this object.StringgetValue(String name)Returns the value of a parameter as aString.String[]getValues(String name)Returns an array ofStringobjects containing all of the values the given parameter, ornullif the parameter does not exist.booleanisEmpty()Returns atrueif no parameters have been set.intsize()Returns the number of parameters in this object.
-
-
-
Method Detail
-
getValue
String getValue(String name)
Returns the value of a parameter as aString.Note that
nullis a valid parameter value. To determine whether a parameter is present, use theSet.contains(Object)method on the set returned bygetNames().Only parameters targeted to the current portlet are accessible.
This method should only be used if the parameter has only one value. If the parameter might have more than one value, use
getValues(java.lang.String).If this method is used with a multivalued parameter, the value returned is equal to the first value in the array returned by
getValues.- Parameters:
name- aStringspecifying the name of the parameter- Returns:
- a
Stringrepresenting the single value of the parameter, ornull. - Throws:
IllegalArgumentException- if name isnull.- See Also:
getValues(java.lang.String),getNames()
-
getNames
Set<String> getNames()
Returns aSetofStringobjects containing the names of the parameters contained in this object. Changing theSethas no effect on the originating PortletParameters object.Only parameter names targeted to the current portlet are returned.
- Returns:
- a
SetofStringobjects, eachStringcontaining the name of a parameter; or an emptySetif the PortletParameters object has no parameters.
-
getValues
String[] getValues(String name)
Returns an array ofStringobjects containing all of the values the given parameter, ornullif the parameter does not exist.If the parameter has a single value, the array has a length of 1.
Note that individual parameter values in the returned array may be
null.- Parameters:
name- aStringcontaining the name of the parameter the value of which is requested- Returns:
- an array of
Stringobjects containing the parameter values, ornullif the parameter does not exist. - Throws:
IllegalArgumentException- if name isnull.- See Also:
getValue(java.lang.String)
-
isEmpty
boolean isEmpty()
Returns atrueif no parameters have been set.- Returns:
trueif the object contains no parameters.falseotherwise
-
size
int size()
Returns the number of parameters in this object.- Returns:
- the number of parameters in this object
-
clone
MutablePortletParameters clone()
Returns aMutablePortletParametersobject encapsulating a copy of the same parameters as the original object. Changing a mutable copy will not influence the source object.- Returns:
- Mutable clone of PortletParameters object
-
-