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 PortletParameters
    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 RenderState.getRenderParameters(), MutableRenderState.getRenderParameters(), and RenderState.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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      MutablePortletParameters clone()
      Returns a MutablePortletParameters object encapsulating a copy of the same parameters as the original object.
      Set<String> getNames()
      Returns a Set of String objects containing the names of the parameters contained in this object.
      String getValue​(String name)
      Returns the value of a parameter as a String.
      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.
      boolean isEmpty()
      Returns a true if no parameters have been set.
      int size()
      Returns the number of parameters in this object.
    • Method Detail

      • getValue

        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 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(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 - a String specifying the name of the parameter
        Returns:
        a String representing the single value of the parameter, or null.
        Throws:
        IllegalArgumentException - if name is null.
        See Also:
        getValues(java.lang.String), getNames()
      • getNames

        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:
        a Set of String objects, each String containing the name of a parameter; or an empty Set if the PortletParameters object has no parameters.
      • getValues

        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 - a String containing the name of the parameter the value of which is requested
        Returns:
        an array of String objects containing the parameter values, or null if the parameter does not exist.
        Throws:
        IllegalArgumentException - if name is null.
        See Also:
        getValue(java.lang.String)
      • isEmpty

        boolean isEmpty()
        Returns a true if no parameters have been set.
        Returns:
        true if the object contains no parameters. false otherwise
      • size

        int size()
        Returns the number of parameters in this object.
        Returns:
        the number of parameters in this object
      • clone

        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:
        Mutable clone of PortletParameters object