Wednesday, 14 March 2012

Working with portlet container in websphere application server 7.0-Part1

The portlet container is the runtime environment for portlets using the JSR 286 Portlet specification, in which portlets are instantiated, used, and finally destroyed. The JSR 286 Portlet application programming interface (API) provides standard interfaces for portlets and backwards compatibility for JSR 168 portlets. Portlets that are based on this JSR 286 Portlet Specification are referred to as standard portlets.

The PortletServingServlet servlet provides a simple portal framework, which builds on top of the portlet container. This servlet registers itself with each Web application that contains portlets. You can use the PortletServingServlet servlet to directly render a portlet into a full browser page by a URL request and invoke each portlet by its context root and name.T his concept is called Portlet Uniform Resource Locator (URL) addressability. Also, you can use the URL addressability feature to include remote portlet content using the remote request dispatcher (RRD).

Portlet Uniform Resource Locator (URL) addressability

You can request a portlet directly through a Uniform Resource Locator (URL) to display its content without portal aggregation. The PortletServingServlet servlet registers each Web application that contains portlets. It is similar to the FileServingServlet servlet of the Web container that serves resources. The PortletServingServlet servlet supports direct rendering of portlets into a full browser page by a URL request.

You can invoke each portlet by its context root and name with the URL mapping /<portlet-name> that is created for each portlet. The context root and name has the following format:
http://<host>:<port>/<context-root>/<portlet-name> For example, 
The context root identifies the Web archive (WAR) file that contains the portlet. The portlet name uniquely identifies the portlet with a portlet application of a WAR file. The

Portlet URL syntax

You can add additional portal context such as portlet mode or window state. You can access the PortletServingServlet servlet by using a URL mapping that has the following structure: 

http://host:port/context/portlet-name [/portletwindow[/ver [/action | 
 /resource[/id=custom-id][/cacheability]] [/mode] [/state] [rparam][/?name]]]
Any differing URL structure results in a exception. Empty strings are not permitted as parameter values and creates an InvalidURLException exception. 

The following is a list of valid parameters: 

http:// host:port/context/portlet-name
This is the minimum URL required to access a portlet. A default portlet window called ‘default’ is created. The portlet-name variable is case-sensitive.
This parameter identifies the portlet window. You must set this parameter if you choose to add more portal context information to the URL.
This optional parameter is used to define the version of the portlet API that is used. You must set this parameter if you choose to add more portal context information to the URL. Only versions '1.0’ and '2.0' are supported. Any other version creates an InvalidURLException exception.
This is a required parameter if you call the action method of the portlet. The action parameter causes the action process of the portlet to be called. After the action has been completed, a redirect is automatically issued to call the render process. To control the subsequent render process, a document servlet filter can set a request attribute with name '' and value 'redirect' to specify that the portlet serving servlet directly returns after action without calling the render process.
/mode=view | edit | help | custom-mode
This optional parameter defines the portlet mode that is used to render the portlet. The default mode is ‘view’. The value is not case-sensitive. For example, ‘View’, ‘view’ or ‘VIEW’ results in the same mode.
/state=normal | maximized | minimized | custom-state
This optional parameter defines the window state that is used to render the portlet. The default state is ‘normal’. The value is not case-sensitive, for example, ‘Normal’, ‘normal’, or ‘NORMAL’ results in the same state.
* [ /rparam=name *[=value] ]
This optional parameter specifies render parameters for the portlet. Repeat this parameter chain to provide more than one render parameter. For example, /rparam=invitation/rparam=days=Monday=Tuesday.
Query parameters may follow optionally. They are not explicitly supported by the portlet container, but they do not invalidate the URL format.
/action | /resource
This parameter defines the methods of the portlet that is called. Valid values are no, action or resource parameter. No specific method defined calls the render method. The resource parameter is only supported for JSR 286 portlets.
/resource [/id=custom-id] [/cacheability=cacheLevelFull | cacheLevelPortlet | cacheLevelPage]
Set this parameter to define the method of the portlet to be called. No redirection occurs. No other method of the portlet is called. To control the resource parameter, you can add an additional ID parameter to provide a resource serving identifier that is passed through to the portlet. The cacheability parameter defines the cache level of this resource URL. This parameter is only supported with JSR 286 portlets .

No comments:

Post a Comment