Wednesday 21 September 2011

how do i pass data from action phase ( processAction ( ) ) to render phase ( render ( ) ) ?

javax.portlet.actionScopedRequestAttributes which is set to false by default, but if you set its value to true then you can set request attribute in the processAction (  ) method and you should be able to access those request attributes in the render (  ) method.

One drawback of this approach is the request attributes are stored in PortletSession under the hood and it has performance implications of storing data in portlet session,

but positive side this approach is better than storing and removing objects in session by yourself.
Source code

What is PortletSession interface?

User identification across many requests and transient information storage about the user is processed by PortletSession interace. One PortletSession is created per portlet application per client. The PortletSession interface provides a way to identify a user across more than one request and to store transient information about that user. The storing of information is defined in two scopes- APPLICATION_SCOPE and PORTLET_SCOPE.

APPLICATION_SCOPE: All the objects in the session are available to all portlets,servlets, JSPs of the same portlet application, by using APPLICATION_SCOPE.

PORTLET_SCOPE: All the objects in the session are available to the portlet during the requests for the same portlet window. The attributes persisted in the PORTLET_SCOPE are not protected from other web components.

authoring template

An authoring template determines the design of a content form, defines what fields and elements appear on a content form and specifies default values for fields and elements.

An authoring template is used to define the default authoring settings for site areas and content items. 

Enabling automatic JSP reloading?

To view changes to your theme and skins JSPs without restarting the portal server, you can force the application server to automatically check for new versions of JSPs.

1. Open the file was_profile_root/config/cells/cell_name/applications/wps.ear/deployments/wps/wps.war /WEB-INF/ibm-web-ext.xmi

2. Change the value for reloadingEnabled from false to true.

3. Save the file.

4. Restart the portal server

What is Portlet Skin ?

The term skin refers to the visual appearance of the area surrounding an individual portlet. Each portlet can have its own skin. The skins that are available for use with a portlet are defined by the portal theme that is associated with the page. The portal administrator or the designer determines the theme for pages and the available skins for the theme. The administrator can permit specified users to change the skins to reflect individual preferences.

How do I Improve Portal Page Rendering Performance?

1. in cmd, goto  wp_profile \ ConfigEngine

2. ConfigEngine.bat precompile-jsp DWasUser=wpsadmin DWasPassword=wpsadmin

Redirect to login page after session timeout?

In the WAS Admin Console:
1. Go to "Resources > Resource Environment Providers > WPproperties" and add the following two new custom prope

a. name :redirect.logout.url
    value: /wps/portal
b. name :redirect.logout
    value: true type java.lang.String

2. Then apply and save the changes, and restart portal.

JSR-286 Key features?

1. Resource serving:
Invoking a Portlet directly  ( but still through the Portal ) API: MimeResponse.createResourceURL (  ) ResourceServingPortlet.serveResource ( ResourceRequest, ResourceResponse ) Extends the render phase, NOT a new life-cycle phase POST, PUT, DELETE supported Should not change shared portlet state Additional URL parameters are specific for the request Full control over request and response headers Can be used for binary data or “readonly” AJAX  ( cannot change navigational state )

2.Extended Cache
Allow public cached content for multiple users
<portlet> ... <expirationcache> <expirationtime>300</expirationtime> <scope>public</scope> </expirationcache> </portlet>
Support validation based caching using ETag API:         response.getCacheControl (  )                .getExpirationTime (  ) , .setExpirationTime (  ) .isPublicScope (  ) , .setPublicScope ( boolean )                .getETag (  ) , .setETag ( String ) .useCachedContent (  ) , .setUseCachedContent ( boolean )
Better Web Platform support Allow servlet dispatching, including using forwards, from: processAction processEvent render serveResource Optionally providing a PORTLET_SCOPEd session to Servlets Extended JSP tag library using new taglib uri "http://java.sun.com/portlet_2_0" Bridging and native integration underway for JSF  ( JSR-301 ) and Apache Wicket  ( 1.3+ )


3.Portlet Coordination – Portlet Events
Events must be defined in portlet.xml After event definition, each portlet must declare what events it will publish or receive Portal-defined events do not have to be defined in portlet.xml Event naming: Must use the W3C QName standard Receiving events can end with a * wildcard Can declare default-event-namespace in portlet.xml and just use local names A portlet declares the events it wants to receive or send in portlet.xml using Qnames or by using a default namespace: <defaultnamespace> http://acme.com/events</defaultnamespace> <eventdefinition> <name>foo</name> <javaclass> java.lang.String</javaclass> </eventdefinition> <portlet> <portletname> PortletA</ portletname> ... <supportedprocessingevent> <qname xmlns:x=”http://acme.com/events”>x:foo</qname> </supportedprocessingevent> <supportedpublishingevent> <name>foo</name> </supportedpublishingevent>

</portlet>
Sending non-declared events at runtime is allowed too Allows wiring of portlets at runtime The portal / portlet container will act as broker The portal or portlet container can also send events Formally not 100% reliable, i.e. no guarantee of delivery  ( mainly for WSRP, “local” portals are less limited ) New 3rd life cycle phase: before rendering API: EventPortlet.processEvent ( EventRequest req, EventResponse res ) StateAwareResponse.setEvent ( QName name, Serializable value ) StateAwareResponse.setEvent ( String name, Serializable value )

4.Portlet Filters -
Modeled after Servlet Filters Modify request data by wrapping request Modify response data by wrapping response Intercept invocation of a portlet before and after it is called Filters may be chained Defined in portlet.xml  <filter> <filter-name>Event Filter</filter-name> <filter-class>com.acme.EventFilter</filter-class> </filter> <filter-mapping> <filter-name>Event Filter</filter-name> <portlet-name>SamplePortlet</portlet-name> <lifecycle>EVENT</lifecycle> </filter-mapping> Must implement javax.portlet.Filter interface Must provide a public no-arg constructor init (  ) method will be called on all Filters before being called on any Portlets destroy (  ) will be called if Filter is removed from service doFilter (  ) method called if processAction (  ) , processEvent (  ) , render (  ) , or serveResource (  ) would be called on Filtered Portlet
Redirect to login page after session timeout?


Installing the Remote Rendering Portlet (Remote Web Content Viewer)

The Remote Rendering Portlet (Remote Web Content Viewer) can be used to display Web Content Management content within a portlet located on a different WebSphere Portal server than the instance of WebSphere Portal that Web Content Management is installed with.

The Remote Rendering Portlet is installed just like any other portlet:
Login to WebSphere Portal as an administrator.
Go to the Administration view and then Portlet Management.
Select Web Modules.
Click Install
Click Browse.
Select the file called ilwwcm-remoterendering-portlet.war from the
\PortalServer\installableApps folder
of your Web Content Management server.
Click Open.
Click Next.
Click Finish.
You will then need to add the Remote Rendering Portlet (Remote Web Content Viewer) to a WebSphere Portal page

Portlet Life Cycle

The Life Cycle Methods Called by the container are:

1) init(PortletConfig config)
2) processAction(ActionRequest request,ActionResponse response)
3) render(RenderRequest request,RenderResponse response)
4) destroy()

Init(PortletConfig config):
Called when the portlet is instantiated by the container. This method is called only once, immediately after the portlet instance is created.

PortletConfig represents the read-only configuration data , specified in protlet’s configuration file (portlet.xml).
This init method behaves similar to the servlet’s init method.

processAction(ActionRequest request,ActionResponse):
Called after user submitted changes to the portlet. Intended to process input from a user action.
ProcessAction method is called in response to a user action such as clicking a hyperlink or submitting a form.
ProcessAction notifies the portlet about the user’s request for an action.

render(RenderRequest request ,RenderResponse response):
render notifies the portlet to generate the markup fragment.
Render follows the ProcessAction in the chain of lifecycle methods.

destroy:
destroy will be called just before the portlet is garbage collected and provides last chance to freeup portlet resources.

Sunday 18 September 2011

Change URI of Websphere Portal server


Change URI
1. open the wkplc.properties(6.1)--C:\IBM\WebSphere\wp_profile\ConfigEngine\properties.
2. change the value of WpsContextRoot as you display in URI
WpsContextRoot=web  //wps
      Note: file name in websphere portal 6.0 :wpconfig.properties.
3. Open a command prompt and change to the C:\IBM\WebSphere\wp_profile\ConfigEngine directory
WPSconfig.bat modify-servlet-path -DPortalAdminPwd=wpsadmin -DWasPassword=wpsadmin
WPSconfig.bat action-update-portlets -DPortalAdminPwd=wpsadmin -DWasPassword=wpsadmin