Portlet URL addressibility

As per portlet specification 1.0 the portlets are not directly URL addressable. If you want to address a portlet, then you will have to put it on a page and then access that page. But WAS provides a mechanism to access your portlet directly

You can access any portlet installed in WAS using this URL

http://<host>:<port>/<context>/<portlet-name>[/portletwindow[/ver [/action] [/mode] [/state] [rparam]]]

Following is the meaning of each of the URL parameters

  • context: Context is the context root that you set while installing the portlet war file.

  • portlet-name: is the value of the portlet-name element defined in the portlet.xml like this

  • portletwindow: You can provide a portletwindow identifier which becomes useful as soon as multiple portlets are displayed on one page. The portletwindow can contain any arbitrary string.

  • version: The version is always 1 (ver=1.0) because the only version currently supported is 1.0.

  • The action flag defines whether the portlet action should be triggered. It appears in the URL with no additional parameter, for example: http://localhost:9080/helloworldportlet/helloworldportlet/window/ver=1.0/action?action=view., would invoke the portlet in action phase and it will send request parameter as action=view

  • The mode and state define the portlet mode and window state of the addressed portlet. Both parameters have the format mode=<mode> or state=&;lt;state>.

  • Render parameters (rparam) are represented in the URL as rparam=<name>=<value>.
    You can code as many rparams as required (/rparam=hello=world/rparam=hello2=world2).
    The order of the parameters is defined through the url pattern as shown above and cannot be mixed.

No comments: