Friday, February 21, 2014

Some useful question and article for WebSphere Portal


Some Useful Question For WebSphere Portal

1.What is portal?
Portal is nothing but a web/J2EE application installed on an application server. Portal provides content aggregation, personalization, authorization and authentication

2.What are portlets?
Portlets are applications managed by portal container which generate fragment of portal page rather than complete page as generated by servlet.

3. Differences between a portlet and servlet?
·         Portlets generate only fragment of the portal page rather than entire page
·         Portlets have more refined request cycle than servlet
·         Portlets have predefined modes and window states
·         Portlets are can be only invoked using portlet URLs

4.What are different phases of portlet life cycle?
Portlet life cycle has following phases
·         Initialization(init method)
·         Process action
·         Process event
·         Resource serving
·         Render
·         Destroy

5.Different Portlet URLs and their use?

There are three types of portlet URLs
·         Action URL- used for submitting forms
·         Render  URL- used for links
·         Resource URL – used for ajax calls and serving documents (pdf files).

6. Difference between JSR 168 and JSR 286 specifications?
The major changes in JSR 286 are events, public render parameters, resource serving and portlet filter.

7.How is the inter portlet communication carried out in JSR 168 portlet?
The inter portlet communication for JSR 168 in websphere portal can be done using dyna cache or shared library. We can create a hash map or any data structure, where we can store an object that need to be transported with unique key and retrieve it from the receiving portlet

8. Can you create a DB connection in render phase? Explain reason?
Yes we can create DB connection in render phase of portlet. But it is not suggested to create one in render phase because it will called every time any other portlet on the page is changed and may result in stale DB connections.

9.What are different modes supported by JSR 286?
Different modes supported by JSR 286 are view, edit and help. A portlet should define its supported mode is portlet.xml file.

10. What are different States supported by JSR 286?
Different  portlet states supported are normal, maximized and minimized.

11.  What are public render parameters?
Public render parameters are used to share the information(mostly a string) between different portlets.

12. How can we transport objects using public render parameters?
Public render parameters are typically used to just share the parameters between portlets. But we can work around by creating a map in the shared library and use the key as public render parameters and store objects correspondingly.

13. What is Web DAV? What are theme components stored in it ?
Web DAV (web based distributed authoring and versioning) is nothing but a extra set of methods using HTTP for managing documents. In WebSphere portal all the static components of the theme are stored in Web DAV. This is one of the options of storing the theme. We can also load theme as .war file.

14. What are different entry points to Web DAV?
The three different entry points to web DAV are
http://<server name>:<port>/wps/mycontenthandler/dav/fs-type1
http://<server name>:<port>/wps/mycontenthandler/dav/themelist
http://<server name>:<port>/wps/mycontenthandler/dav/skinlist

15. What are Credential Vaults?
In WebSphere portal, credential vault is the repository to store the user id and password. We can use credential vault service API to store and retrieve them programmatically.

16.What are different types of credential vault segments?
Vault segment is the partition of the vault. There are two types of segments
Administration managed
User managed

17.Different types of slots?
Private slot- private- only one portlet instance
Shared slot- shared- any of the users portlets
Administrator slot-private-any of the users portlets
System slot- shared- all users and all portlets

18.What are virtual portals?
Virtual portal is same as base portal which can run on same JVM. We can have as many as 150 virtual portals in single installation. It will be separate in all respects but share the same system resource of the server.

19.What is Dynacache?
Dynacache is disturbed map used to store and retrieve objects from memory. IBM provides API to create, store retrieve the objects.

20. What is CSA?
Client-side aggregation (CSA) is a new method of rendering a WebSphere Portal page that moves the rendering workload from the server to the client. It is made possible by the Representational State Transfer (REST) services introduced in WebSphere Portal 6.1.
In the traditional server-side aggregation (SSA) rendering, the page and each of the portlets is completely rendered on the server, using JSPs, and returned to the client in one big response. In contrast, in CSA, we request only the pieces of information from the server that are required to update the page as a result of the user’s interactions with the page.
For example, if a page contains four portlets and the user clicks a link in one of the portlets, only that portlet is updated. This means the server must render only one portlet, instead of four portlets plus the theme for an interaction with a single portlet.
The REST services also take greater advantage of caching. Since each individual artifact can be independently cache-able, the client ends up retrieving a greater number of responses directly out of cache, further reducing the server workload.

21.What are different modes available in Websphere Portal?
A part for standard modes ( view, edit, help) it provides edit_ defaults and configure mode.

22. What can you do with XML access scripts?
Xml access is command line utility used for exporting and importing portal configurations. . It can be used for backing up the configuration of certain environments, for loading new configurations (for new portlets or pages, for example), or for updating existing portlets when a new WAR file is provided by development. There are few samples C:\IBM\WebSphere\PortalServer\doc\xml-sample

23.What is model spi and what is it used for?
Web sphere uses different model for providing content aggregation and navigation
The available models are
Content model, navigation model , navigation selection model and layout model.
These models are provided using model spi.

24.What is Navigation model? How to navigate through the pages using navigation model? What is the main package which is used for model spi?
Navigation model is used to get topology of the navigation available to a user.

25.How did you solve problems related to themes and skins?
We can debug theme and skin problems by client side logging and using firebug for javascript problems
Hope you are liking this series, Please do leave you comments below. Stayed tuned for more, there are lot questions coming your way.

26.What is Web Content Management System (WCMS)?
Web Content management system is a software system that helps build and manage a Web entities (html pages, documents etc.) Once setup is complete it provides templates for authoring, workflow management to the content.  It is easy to use for non technical user.

27.What is syndication?Syndication, (Web syndication in particular) is a ability to provide users updates of the content from the site. The most popular formats of web syndication are RSS and ATOM feeds.

28. What is local rendering and remote rendering?
The web content management portlets can be rendered local or remotely. A local rendering portlet displays content on the same portal as the instance where the web content manager is installed. A remote rendering portlet displays Web content on a different portal server than the instance where Web Content Manager is installed.
29. What are different steps in creating content for WebSphere portal WCM ?
The following are different steps involved in creating the content for the WebSphere portal WCM
1.       Create Library
2.       Create Workflow
3.       Create Site area (Sites are removed in WebSphere Portal 7.0)
4.       Create Authoring templates
5.       Create Presentation templates
6.       Map authoring and presentation templates

30.What are work flows?
A workflow is a sequence of steps that are followed in creating approved content. In WebSphere portal, A workflow contains one or more stages. Every stage contains one or more actions, the following are different Workflow actions available in WebSphere Publish, Expire, Email, Scheduled Move, Custom Actions.

31. What are Authoring and Presentation Templates?
Authoring Template- This template is defined using authoring portlet, where we define the access information,  form properties and default content. It does not contain any information for presentation and The elements in this form are linked to presentation template.
Presentation Template- This allow to change the look of a page without having to update what is being displayed on a page. It will allow to define Page style, Page layout and map element to the authoring templates.
32. What is the difference between personalization and customization ?
Personalization-   It means to serve the user or consumer with user specific data depending on his interests collected over a time. A real world example would be google serving ads basing on the recent search you made.
Customization-  It is ability provided to the user to change the layout, styling of the page and save it.


Different ways to deploy a portlet using RAD and WebSphere portal 7

During development there are situations where we need to know multiple ways to deploy. This will be very helpful when you want to check whether the problem is due to portlet code rather than deployment method (In case of corrupt RAD). we may need to deploy the portlet in upper environments where any development tool is not available. As far as now we know four different ways to deploy a portlet
1. The old school way (through WAS admin console)
The first and probably the most generic way of deploying any application is through WAS admin console.
·         Log to WAS administration console
·         Navigate to Application –> New Application –> New Enterprise Application
·         Select an EAR, WAR or JAR file either from the local or remote file system
·         Choose “Fast path” and click next
·         Leave everything as is in “select installation options” and click next
·         Select the deploy server  from “Clusters and servers” for portal select the one ending in websphere_portal(standalone installation)
·         Select the module you want to deploy and click apply
·         Enter the context root for the application and click next
·         Check the summary and click finish
·         it will display the “deploy successful” message and click “save”
Now, Modify the DeployPortlet.xml located at C:\IBM\WebSphere\PortalServer\doc\xml-samples to the portlet you need and then run it through “Portal Admin UI”
Administration –> Portal Settings –> import xml
This will install the portlet successfully and male available to a page. You can use the same way for installing theme as WAR and then run the DeployTheme.xml.
2. Using Portlet Admin UI
We can deploy portlets in WAR module through the Portal Admin UI.
Administration –> Portlet management –> Web Modules
Click the “Install” and select the WAR file from the local drive and click next. This will install the portlet makes it available to portal. we need to add it to the required page. In this way, portal in background generates a xml and runs it for you.
3. Using RAD, deploy portlet option
The most easy and simplest way of deploying a portlet is through Deploy portlet option in the RAD. When we create a portlet project in the RAD, when you right click you will see a option “Deploy Portlet”. By Selecting it RAD will generate a xml script for portlet and deploys it on the server configured in the RAD.
4. Using RAD, RUN AS
The last option, no the cleanest way to do deployment is through “Run As” option in RAD. By right clicking the project select


Run As –> Run on server will install the portlet on the portal home under “Rational Components” page. This way it will create multiple sub pages under this page for each portlet.



Reduce Startup time for WebSphere portal

Did you ever felt frustrating about startup and reboot time during WebSphere portal development? Almost every one who has experience working(developing) with WebSphere products might have seen this reverse snowball effect. The more WAR and EAR files it takes, more slower it becomes. On an average it takes 2- 6mins to startup. Lets try reduce it now.
Here we list few ways to reduce startup time for the portal. No guarantee that these will reduce time drastically but worth a try. So try them and leave your responses below which will be useful to others.
Enable Development Mode
Go to Administration Console –> Application Servers –>  WebSphere_Portal  
and check the development mode. For more detailed instructions check this article. Make sure you have the generic JVM arguments set properly. The two generic JVM arguments that need to present are –Xverify and –Xquickstart. For setting the generic JVM arguments please check the Info Center.
we can also enable Start components as needed and see if it makes any difference. It is located below the development mode enable option.
Uninstall Default portlets
we can remove the default portlets with causing minimum impact to the portal system. we can remove all the administration portlets and run everything through XML access. But this is not advisable for the beginners. For more details about the uninstalling the portlets check this article.
we can also remove the unnecessary portlets from serverindex.xml Which is located at
C:\IBM\WebSphere\wp_profile\config\cells\node1\nodes\node1\serverindex.xml
Increase the initial Heap size
we can increase the initial heap size to match the default. we can set the initial heap size by navigating to
Administration console –> Servers –> Server Types –> WebSphere Application Servers –> WebSphere Portal-> Process Definition-> Java Virtual Machine and set the initial heap size and restart the server.
Hoping above mentioned ways will save you some time.
Useful Links
1.    Check the administration console help.


LTPA Token Vs LTPA Token 2
Light weight third party authentication token is used to enable communication between multiple WebSphere servers on behalf of the authentication users, in simple words allows enabling Single Sign On (SSO).
Until up to WebSphere version 5.1 used “LTPA token”(version 1). From next versions of WebSphere maintains backward compatibility and can generate both versions of LTPA token. You can follow the steps mentioned in the Info Center. These steps and options available slightly change for different installations. Please check the info center for more information. When we want to strictly restrict ourself to “LTPA Token 2” , we need to set the values in the CSEnvironment.properties file. This file is located in local installation at
C:\IBM\WebSphere\wp_profile\PortalServer\config\config
or Check corresponding installation folders. For further details please check this article.
If you want know more about LTPA token and retrieving them from portlet, Please check our previous article here.



LTPA token and accessing from portlet

LTPA token (Light weight Third Party Authentication)
To keep it simple, In WebSphere world LTPA token is used to give authenticated users access to all the servers in the same domain automatically.
·         a cookie is sent to client (browser) upon authentication, which contain LTPA token
·         all others servers extract it from cookie and use it for authentication
·         cookie is valid for one browsing session
·         LTPA token is nothing more than a encrypted format of the authenticated user details
Enabling LTPA token
LTPA authentication can configured from WebSphere admin console. IBM has clearly defined steps to enable LTPA token. It will be repetitive if we write them here for details please look here (Enabling LTPA token)
Reading LTPA token from portlet
The portlet API provides a method getCookies() to retrieve the cookies in the portlet. The following code snippet is useful for getting LTPA token in portlet
private String getLtpaToken(PortletRequest request){
    Cookie cookie = request.getCookie();
    for(Cookie element : cookie){
      System.out.println(“Cookie Name” + element.getName());
      if( element.getName().contains(“LtpaToken”))
        return element.getValue();
    }
return “LTPA token not found”;
}
If you want to retrieve LTPA token using the WebSphere security API please check here (How to read the LTPA Token using API).
The reason we are checking for the cookie name containing “LtpaToken” rather than exact name is because it may varied across different version. For WebSphere portal is “LtpaToken2”. We hope this article was useful to you. Keep watching…


How to create virtual portal ?

Virtual portal
WebSphere portal gives us ability to create multiple portals with single installation.  Virtual portal is same as base portal which can run on same JVM. We can have as many as 150 virtual portals in single installation. It will be separate in all respects but share the same system resources of the server. We can create shared or scoped resources for virtual portals.
Creating a virtual portal
The following are the steps for creating the virtual portal, the steps are pretty straight forward
1. Logon to Portal administration console
2. Navigate to Virtual Portals –> Mange Virtual Portals

3. Click New Virtual portal and fill out the following information
Virtual portal title: Shan ecommerce portal
Virtual portal description: Ecommerce website
URL Context : shan
Virtual portal hostname : If you some specific hostname enter it or leave it blank for default
User realm: Leave it default or choose specific one you need
Initial admin user group: Click search button besides it and click search on the next screen
and select one you need or select the default one.
Default theme: Select the default or leave it to page builder
and click OK
4. You will see a screen saying “Creating virtual portal” and virtual portal in now created
5. Click the portal created “Shan portal”. you will see the the URL now changed with context we mentioned before
Here we go, you now have created the virtual portal. we have some more articles related to creating and managing the  virtual portal resources. Keep watching.




Did you ever wonder how can we change the default portal URL? It always better to hide your underlying implementation technology for any web application. Most enterprises do it and some odd one leaves it out. For security purposes, it always good to hide it. There is little bit of work involved in changing it but worth your enterprise time to get cleaner look in their URL’s
This might be administrative related task, but it always helps to know there is an option to change the portal default URL. Here we will summarize the steps involved, for further details please check out the links below.
1. By default, all the apps are installed under /wps/portal. we need to make a copy of the installed apps and use it for redeployment after the URL change. The installed apps are located at
C:\IBM\WebSphere\wp_profile\installedApps\node1
2. Open wkplc.properties
C:\IBM\WebSphere\wp_profile\ConfigEngine\properties
search for the “WpsContextRoot” change default “wps” to desired and save it.
3. Open wkplc _comp.properties  located in same directory and change “WpsDefaultHome” and “WpsPersonalizedHome” to desired.
4. For windows, open command prompt and run
ConfigEngine.bat modify-servlet-path –DPortalAdminPwd=password – DWasPassword=password
5.Restart the server and we are good to go
Check out the link for the detailed instructions.


Page Builder 2–Architecture

What is Page Builder 2 theme ?
Over the time ,WebSphere portal has designed different themes namely, Portal, PortalWeb 2 and Page Bulider themes. Page Builder 2 theme is the second iteration after its inception in WebSphere portal 6.1.5.
·         Page builder themes provides both server side and client side aggregation.
·         It makes use of latest web technologies like HTML 5 and CSS 3.
·         It provides in-page administrative tasks like creation of pages, adding tags, adding portlets to pages and changing styles and skins instead of using administrative portlets from the administrative pane.
·         Uses WebDAV to store static files of theme.
Process Flow
The following is the process flow of the Page builder 2 theme describing different files involved in the process. The few important components which builds the theme are
·         Default.jsp
·         bootstrap.jspf
·         bootstrapPortal.jspf
·         Theme.html
·         Dynamic content spot mappings
Default.jsp
File Location:C:\IBM\WebSphere\PortalServer\theme\wp.mashup.cc.theme\installedApps\wp.mashup.cc.theme.ear\PageBuilder2.war\themes\html\Default.jsp
Default.jsp is the starting point for the page builder theme. The three main functions of this page are
·         Initialize values using jspf files
·         Determine the theme template
·         Forward control to render tag for final markup.
The following is the code snippet from Default.jsp highlighting its functionalities.




This jsp page includes the jsp fragments (.jspf) which complies into a servlet. The two jspf files included in the page are
·         bootstrap.jspf
·         bootstrapPortal.jspf
These files are used to initialize the values for the theme, bootstrap.jspf is used to initialize the context and set different URI components. bootstrapPortal.jspf is used to set different variables like portalRoot, isUserLoggedIn, isPageRenderModeCSA and many others. For full list of the variables look into the files (file location mentioned above).
Once the values are initialized, the next important thing it does is to determine the template for the theme. By default in absence of any template it will point to the template in WEB DAV. If nothing is changed it will be set the themeTemplateURI to theme.html
Then control is passed to <r:datasource> where it takes the themeTemplateURI and mine type. It is responsible to parse and resolve all the dynamic content spots.
Theme.html
By default all the static files are stored in the WEB DAV for portal 7. We need to connect and get those for doing any modifications or looking at it. Luckily we have a copy of theme.html stored in JCRFileStore in local (we are not sure whether the changes made to these files is equivalent to the changes made to WEB DAV files, But both appears to be same).
File Location: C:\IBM\WebSphere\wp_profile\temp\node1\WebSphere_Portal\JCRFileStore\filestore\fs-type1\themes\PageBuilder2\theme.html
(Do not make any changes to files in JCRFileStore, these are only for only debugging purposes)
Theme.html contains the Dynamic Content Spot mappings for different of the page. The following are few of them.
·         Banner Navigation
·         Search
·         Banner common actions
·         Tab navigation
·         Page Toolbar
·         Layout
The following figure highlights different features of the theme

And many others related to ASA (active server analytics), for further details check ASA.
Every Dynamic content spot has relation as “dynamic Content” in its tag.
We can find the all the defined dynamic content spots in portal administration console under
Resources -> Resource environment -> Resource Environment providers -> WP_DynamicContentSpotMappings -> Custom properties.
These dynamic content spot will aggregate to generate the complete html for the theme. The following diagram consolidates the theme process flow.




Site Analytics – Options in websphere in portal 7

Every website irrespective of whether it is a portal or simple few pages site needs to know what pages the customer is hitting the most ? Does he is getting info he searching easily? On which pages does server failed? To answer all these questions we need site analytics options in websphere. For further details please look into references provided.
The two options available in the websphere portal 7 are server side analytics and Active site analytics
Server side site analytics
Server side analytics properly configured (link), will log the details to the log file. Typically it is called sa.log located at “C:\IBM\WebSphere7\wp_profile\logs|Websphere_Portal”. we can set the parameters to create back up files at regular intervals, like few minutes, hours or days basing the traffic to this site. we can then use a log file analyzer like “AWStats” to read those files and generate visual graphs and tables.
we can measure several parameters like Users browsers, User details, search engine key words, page URLs and many others.


Active site analytics
Active site analytics works more like any other third party web analytics software based on java script injection.  Websphere provides support for integration with Webtrends, Ominiture and core meterics. To make the data available to third party software, we need to  add the detailed tags to theme or skin, like asa.page.title and add a aggregator to the page. The following diagram summarizes the workflow of ASA, ASA is preferred over SSA




No comments:

Post a Comment