Top Description Methods
javax.portlet

public Interface PortletParameters

Known Direct Subinterfaces
javax.portlet.RenderParameters, javax.portlet.ResourceParameters, javax.portlet.ActionParameters, javax.portlet.MutablePortletParameters
Known Direct Implementers
javax.portlet.filter.PortletParametersWrapper
Imports
java.util.Set

The PortletParameters interface 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 PortletParameters object available from the portlet request. Portlet parameters can be set for subsequent or future portlet execution phases through the MutablePortletParameters object 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 PortletRequest#getRenderParameters(), StateAwareResponse#getRenderParameters(), and PortletURL#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() and ResourceURL#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() and ActionURL#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

Modifier and TypeMethod and Description
public MutablePortletParameters

Returns:

Mutable clone of PortletParameters object
clone
()

Returns a MutablePortletParameters object encapsulating a copy of the same parameters as the original object.
public Set<String>

Returns:

a Set of String objects, each String containing the name of a parameter; or an empty Set if the PortletParameters object has no parameters.
getNames
()

Returns a Set of String objects containing the names of the parameters contained in this object.
public String

Returns:

a String representing the single value of the parameter, or null.
getValue
(String
a String specifying the name of the parameter
name
)

Returns the value of a parameter as a String.
public String[]

Returns:

an array of String objects containing the parameter values, or null if the parameter does not exist.
getValues
(String
a String containing the name of the parameter the value of which is requested
name
)

Returns an array of String objects containing all of the values the given parameter, or null if the parameter does not exist.
public boolean

Returns:

true if the object contains no parameters. false otherwise
isEmpty
()

Returns a true if no parameters have been set.
public int

Returns:

the number of parameters in this object
size
()

Returns the number of parameters in this object.

Method Detail

cloneback to summary
public MutablePortletParameters clone()

Returns a MutablePortletParameters object encapsulating a copy of the same parameters as the original object. Changing a mutable copy will not influence the source object.
Returns:MutablePortletParameters

Mutable clone of PortletParameters object

getNamesback to summary
public Set<String> getNames()

Returns a Set of String objects containing the names of the parameters contained in this object. Changing the Set has no effect on the originating PortletParameters object.

Only parameter names targeted to the current portlet are returned.

Returns:Set<String>

a Set of String objects, each String containing the name of a parameter; or an empty Set if the PortletParameters object has no parameters.

getValueback to summary
public String getValue(String name)

Returns the value of a parameter as a String.

Note that null is a valid parameter value. To determine whether a parameter is present, use the java.util.Set#contains(Object) method on the set returned by getNames().

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.

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:String

a String specifying the name of the parameter

Returns:String

a String representing the single value of the parameter, or null.

Exceptions
IllegalArgumentException:
if name is null.
See Also
getValues, getNames
getValuesback to summary
public String[] getValues(String name)

Returns an array of String objects containing all of the values the given parameter, or null if 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:String

a String containing the name of the parameter the value of which is requested

Returns:String[]

an array of String objects containing the parameter values, or null if the parameter does not exist.

Exceptions
IllegalArgumentException:
if name is null.
See Also
getValue
isEmptyback to summary
public boolean isEmpty()

Returns a true if no parameters have been set.
Returns:boolean

true if the object contains no parameters. false otherwise

sizeback to summary
public int size()

Returns the number of parameters in this object.
Returns:int

the number of parameters in this object