ibm websphere portal blog,websphere portal, portal blog, ibm blog,websphere blog,websphere tips and tricks, websphere interview questions, portal interview questions, portal faqs

October 2016 | IBM WebSphere Portal Blog

Pages

Sunday, October 30, 2016

Set WCM Configuration details for Specific Virtual Portal


From WCM 8.x onwards we can scope the WCM libraries to specific virtual portal , there may be a lot of situations where we need to configure different WCM Config Service settings specific to each virtual portal we create.
Navigate to below path for  WCM Config Service settings.
Resources > Resource Environment > Resource Environment Providers >WCM WCMConfigService > Custom properties.

1.     Setting unique configuration for each virtual portal

You can set this for either host name or context path
Host name:
vp.uniquename.hostname=ExistingVPHost
Context path:
vp.uniquename.context=ExistingVPContext
E.g: vp.hrportal.context=hrportal   (for hr virtual portal like /wps/myportal/hrportal/welcome)

2.     Defining virtual portal scoped configuration

propertykey.vp.uniquename= override_value
E.g:
a. For customizing the link generated in email for the specific virtual portal(hrportal)
wcm.authoringui.url.vp.hrportal= http://${WCM_HOST}:${WCM_PORT}/${WCM_WPS_CONTEXT_ROOT}/${WCM_WPS_PERSONALIZED_HOME}/hrportal/wcmAuthoring
b. Configuring subscriber only setting for virtual portal (hrportal)  
deployment.subscriberOnly.vp.hrportal = true
NOTE: default subscriber only value = false for all other portals(Base and virtual portals) except hrportal

3.     Settings specific to base portal

You can specify configuration specific to base portal only like below
E.g
wcm.authoringui.url.base = http://${WCM_HOST}:${WCM_PORT}/${WCM_WPS_CONTEXT_ROOT}/${WCM_WPS_PERSONALIZED_HOME}/wcmAuthoring

4.     Settings those are global

If you specify any setting without (.vp.uniquename) or  (.base) are applied across all portals (base and virtual portals).
If the base configuration for a setting is different from all the virtual portals, it is more efficient to use a base override setting. To do this, add this setting:enable.base.portal.overrides=true
Other References to refer for :
http://www-01.ibm.com/support/knowledgecenter/SSHRKX_8.5.0/mp/wcm/wcm_config_scoped_vp.dita?lang=en


Access WCM compnnt from outside your Application i.e Jsp, using WCM Tags


Include following WCM tags in your external JSP (Click Here  other technique to follow)

<wcm:initworkspace username="<%=userId%>" password="<%=password%>" >Cannot get Workspace</wcm:initworkspace>
<wcm:setExplicitContext wcmWebAppPath="<%= baseURL %>" wcmServletPath="/connect" path="library/Site/sitearea/sitearea" >Can't Set Context Information</wcm:setExplicitContext>

<wcm:libraryComponent name="Component Name without Libraryname" >

 Can't display seedlist information</wcm:libraryComponent >

How to acceass Users profile Info in Portlets i.e.PUMA API


Two ways you can access the user info in portlets,

1. Using PUMA API provided by websphere portal
2. By stetting the user attributes in portlet.xml

UseCase1:
a  Sample code to access the PUMA through portlet service
import com.ibm.portal.portlet.service.PortletServiceHome;
import com.ibm.portal.um.*;
import com.ibm.portal.um.exceptions.PumaException;
import com.ibm.portal.puma.User;
Context ctx=null;
Object homeObj=null;
User user=null;
try {
ctx = new InitialContext();
homeObj=ctx.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");
PortletServiceHome serviceHome=(PortletServiceHome)homeObj;
PumaHome pHome =(PumaHome) serviceHome.getPortletService(PumaHome.class);
PumaProfile pProf=pHome.getProfile();
user=(User)pProf.getCurrentUser();
} catch (NamingException e) {
} catch (PumaException e) {
}

request.setAttribute("user", user.getObjectID());


b Accessing user attributes

//after you got the pumaHome like above
List attributeList=new ArrayList();
attributeList.add(“sn”);
attributeList.add(“givenName”);
attributeList.add(“uid”);
attributeList.add(“preferredLanguage”);

UserProfile profile=pumaHome.getProfile(portletRequest);
User user=profile.getCurrentUser();
Map attributesMap=profile.getAttributes(user,attributeList);

PrintWriter out=response.getWriter();
out.write(“Distinguished name is”+profile.getUserIdentifier(user));

for(Iterator itr=attributesMap.getKeySet().Iterator(); itr.hasNext();){
String attributeName=(String)itr.next();
String attributeValue=(String)attributesMap.get(attributeName);
}


c Using PUMA Locator
i To find user by attributes

PumaLocator locator= pumaHome.getLocator(portletRequest);
PumaProfile profile= pumaHome.getProfile(portletRequest);
List userList=locator.findUserByAttribute(“uid”, “sivavaka”);

User user=(User)userList[0];
Map attributesMap=profile.getAttributes(user,attributeList);//use above attributeList

ii To find user by distinguished name
PumaLocator locator= pumaHome.getLocator(portletRequest);
PumaProfile profile= pumaHome.getProfile(portletRequest);
List userList=locator.findUserByIdentifier(“uid=wasadmin,o=default”);


UseCase 2:
Portal can access USER INFO in jsr168 portlet
a Add following elements in the portlet.xml
<user-attribute>
<description xml:lang="en">User Given Name</description>
<name>user.name.given</name>
</user-attribute>
<user-attribute>
<description xml:lang="en">User Last name</description>
<name>user.name.family</name>
</user-attribute>


b Write the following in portlet

Map userInfo=(Map)request.getAttribute(PortletRequest.USER_INFO);
if(userInfo != null){
String givenName = (String)userInfo.get("user.name.given");
String lastName =(String)userInfo.get("user.name.family");
response.getWriter().println("Hello " + givenName +" " + lastName);
}

To implement Session Timeout


Place below code in Theme default.JSP if you want implement session timeout using this approach in WebSphere Portal Applicaiton.


SessExpire_Test.JSP


<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<meta http-equiv="refresh" content="<%= session.getMaxInactiveInterval() %>;url=dummy_login.jsp">
</head>
<body>

<h1>Hi, !</h1>
Your session will expire in <%= session.getMaxInactiveInterval() %> seconds at which time your browser will be redirected to the login page and all  your unsaved changes will be lost.
<br>Test Information!
</body>
</html>



dummy_login.jsp
<%@page contentType="text/html"%><%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"   "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title>
</head>
<body>
<h1>You have reached this page because your session has timed out.</h1>
</body>
</html>

How to Write Custom Portlet Mode in WebSphere Portal


Steps

a.  Override generic portlet Dispatch method

private static final PortletMode CUSTOM_CONFIG_MODE = new PortletMode("yourConfig");
private static final PortletMode CUSTOM_EDIT_DEFAULTS_MODE = new PortletMode("edit_defaults");

protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException {
              if (!WindowState.MINIMIZED.equals(request.getWindowState())){
                     PortletMode mode = request.getPortletMode();                 
                     if (CUSTOM_CONFIG_MODE.equals(mode)) {
                           doCustomConfigure(request, response);
                           return;
                     }
                     else if (CUSTOM_EDIT_DEFAULTS_MODE.equals(mode)) {
                           doCustomEditDefaults(request, response);
                           return;
                     }
              }
              super.doDispatch(request, response);
       }

b. Add following in the portlet.xml

<custom-portlet-mode>
            <portlet-mode>config</portlet-mode>
      </custom-portlet-mode>
      <custom-portlet-mode>
            <portlet-mode>edit_defaults</portlet-mode>
</custom-portlet-mode>

Add following entries under the portlet tag
<supports>
      <portlet-mode>config</portlet-mode>
      <portlet-mode>edit_defaults</portlet-mode>
</supports>


Approach to Customize WCM (Lotus WCM)


Best way to customize the Lotus WCM (Lotus web content management) is to create separate webApplication (EAR) file deployed on Portal server.

Keep all your custom JSP files in that web applicaiton and let your WCM JSP components or any customization access them as below

/YourWebApplicationContext;/jsp/youcustomefile.jsp

this way you no need to place your JSP file under multiple place like under the render portlet , authoring portlet.
 

Iterating on Content Items with in a particular site area


<wcm:initworkspace user="<%= request.getUserPrincipal() %>" />
<%
String libraryName="lib_name";
String stConfigSiteArea = "siteArea_name";

HashMap contentItemsMap = new HashMap();
ArrayList contentItemsList = new ArrayList();

try{
wcmWorkspace.setCurrentDocumentLibrary(wcmWorkspace.getDocumentLibrary(libraryName));


DocumentIdIterator docIds=wcmWorkspace.findByName(DocumentTypes.SiteArea,stConfigSiteArea);


if(docIds.hasNext()){


DocumentId siteAreaID = (DocumentId)docIds.nextId();
SiteArea configSiteArea = (SiteArea)wcmWorkspace.getById(siteAreaID);
DocumentIdIterator contentItemIds = configSiteArea.getAllDirectChildren();
while(contentItemIds.hasNext()) {
DocumentId contentItemId = (DocumentId)contentItemIds.nextId();
if(contentItemId.getType().toString().equalsIgnoreCase(DocumentTypes.Content.toString())){
Content childContent = (Content)wcmWorkspace.getById(contentItemId);
contentItemsList.add(childContent.getName());
contentItemsMap.put(childContent.getName(),childContent);


}
}
}Catch(Exception e){
out.println("Error while retrieving contnet Items");
}
%>

How to Send Query Parameter to Menu Component


<% RenderingContext context = (RenderingCon text)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);

String currentPath = context.getPath();
String currentLibrary = context.getLibrary().getName();
Map myparams = new HashMap();
myparams.put("SiteAreas", currentLibrary+"/mySite/mySiteArea1,"+currentLibrary+"/mySite/mySiteArea2"); %>


Another technique is

<%
RenderingContext context = (RenderingContext)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY); %>

<% String currentPath = context.getPath(); //Getting the library relative path(Ex : /Library/Site/Sitearea/Content)
String lrp=context.getLibraryRelativePath();
String sublrp=lrp.substring(0,lrp.lastIndexOf("/"));
String currentLibrary =context.getLibrary().getName();
Map myparams=context.getRequestParameters();
myparams.put("sitearea", currentLibrary+sublrp); context.setRequestParameters(myparams); %>

Render the content in menu using below statment:
            <wcm:libraryComponent name="menu" library=currrentLibrary />

WP7 - Taglib URI reference problems.


In Portal 7 version, taglib description files (.tld) files are not available under the wps.ear/wps.war/WEB-INF/tld. (Ha vent find anywhere directly under installed folder).

<%@ taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v7.0/portal-fmt" prefix="portal-fmt" %>
<%@ taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v7.0/portal-core" prefix="portal-core" %>

Unable to find taglibs & this problem with the WP7 taglib uri references when I was developing the Custom Theme ,but solved this by exporting theme as war using the EARExpander tool and import into RAD and update the custom code and deploy that WAR file. It will resolve the taglib references problem.
But actual solution to resolve the taglib references problem in the WP7 is to copy  the empty decorations.xml file under the WEB-INF folder of web application(custom theme).This will make sure to get the all tagLib references at runtime.

More information at link

New Features included in IBM WebSphere Portal 8.0 Beta Version


  1. Web Analytics
  2. Social Business in Context
  3.  Search Optimization
  4.  CMIS support for federated documents
  5.  Content templating enhancements
  6.  Web Content Manager Authoring Homepage
  7.  Web Content Manager RESTful Service
  8.  Site Area Templates
  9.  New Menu and Navigator options
  10. Hightlights of WCM features


Web Analytics
  • More flexible options to tag pages, portlets or web content and measure their usefulness through campaign and custom tags.
  • New user-friendly overlay statistics provide an in-line view to track effectiveness of a web property.
Social Business in Context
  • New Community Page support lets you more readily scope and place IBM Connections portlets in the right Portal and Web Content Manager context.
  • A consistent tagging and rating experience between WebSphere Portal, Web Content Manager, and IBM Connections.
  • OpenID Authentication lets portal users authenticate with public social network credentials, such as a Google, Yahoo or Facebook ID.
  • For your convenience, the current image has OpenID Authentication enabled for Yahoo and Google providers.
Search Optimization
  • Optimize external search for web content rendered through WebSphere Portal.
CMIS support for federated documents
  • The federated documents feature of Web Content Manager enables you to insert links to content that resides in a remote content repository. You can now insert links to documents from repositories that support Content Management Interoperability Services 1.0 (CMIS 1.0).
Content templating enhancements
  • The content templating features of Web Content Manager have been expanded to make creating and delivering web content faster and easier. Web content viewers, web content page templates, and content mappings work together to provide a flexible framework that you can use to quickly assemble pages containing web content. To illustrate how these building blocks work together, Web Content Manager includes preinstalled web content libraries with sample web content.
Web Content Manager Authoring Homepage
  • The new homepage provides a customized entry point for different types of users. Essentially providing a role-based and a simple, single-page user interface,that allows casual authors to easily create and submit content; frequent contributors to create and work with their items; and power users to easily see what is going on across the site and to quickly create or edit any of the items they are responsible for.
Web Content Manager RESTful Service
  • The new REST service makes all of the information in the repository easily accessible without compromising security. A simple URL interface allows developers to create queries and to utilize this information to extend the authoring user interface easily or within the site itself (for example, to extend in-line editing or build custom applications).
Site Area Templates
  • Site areas are now treated as content allowing services such as workflow, versioning and metadata profiling to be taken advantage of.
  • Site administrators can restrict what type of items can be created within the site providing more granular control.
  • Site areas can also now be rendered directly (mapping presentation templates to site areas types).

    These enhancements provide authors with the ability to create 'compound' documents; with site areas acting as a parent and containing content items (within sub-site areas if desired too) such as guides and multi-page content items.
New Menu and Navigator options
  • Enhancements to the menu and navigator components provide new configuration options including scoping menu queries to a library and defining the starting point for navigators based on the page context or via a query string. This enables the reuse of the same components within different parts of the site, instead of cloning the same component multiple times with different queries/staring points, cutting development and maintenance time significantly. Additionally navigators now support producing hierarchical markup (for example, unordered or ordered lists) making it possible to follow modern web patterns and also produce accessible page navigation.

Hightlights of WCM features
  • WCM Customizable Authoring home page for different type of users.
  • WCM RESTFull service
  • Site areas are now treated as content (can map presentation template directly to siteareas)

IBM WebSphere Portal 8.0 Beta version


Follow below links for IBM WebSphere Portal 8.0 Beta version

For details & to download IBM WebSphere Portal 8.0 Beta version ClickHere

For details & to download of IBM Web Content Manager 8.0 Beta ClickHere

Video about beta preview of WCM authoring home page  ClickHere

How to Fix browser URL length problems in Portal 7.0


Default WebSphere Portal includes navigational state information along with other information in browser URL will be in encoded form. Sometimes length of URL’s will exceed browser URL max chars limit. This might happen because of navigating from many pages and portlets on to these pages and this even can apply if long render parameters are swapped to the session..

With latest fix (WP 7.0.0.1 CF002) , we can resolve this issue with following configurations. 
These can be set in the resource environment provider "WP StateManagerService":

1 - Go to the WebSphere App Server admin console.
2 - Resources > Resource Environment > Resource Environment Providers
3 - Click on "WP StateManagerService" and "Custom properties"
4 - Add properties which are needed as per requirement / task.
5 - Save changes to the master configuration
6 - Restart portal server

The following properties are available:
historymanager.enabled
The HistoryManager allows to cleanup state for pages visited some time ago.
Allowed values are "true" or "false".
Default value is "true".
Example: historymanager.enabled = true
hstorymanager.threshold
The threshold meaning the number of pages whose portlets and shared state should be kept. Must be a positive integer.
Default value is "10"
Example: historymanager.threshold = 10
historymanager.prp.removalstrategy
Defines a strategy how the shared state is cleaned up.
Possible values are
a). no_removal : public render parameters will not be removed, i. e. only portlet specific state will be removed.

b). wcm_id  :  Public render parameters will be removed if the expired page has an explicit shared state bucket assigned that starts with the String "ibm.wcm."

c). explicit_bucket_assignment : Public render parameters will be removed if the expired page has an explicit shared state bucket assigned  regardless
of a prefix. This is a more general strategy than "wcm_id"

Default value is "explicit_bucket_assignment"
Example: historymanager.prp.removalstrategy = explicit_bucket_assignment

WebDAV & Its Introduction


WebDAV  its full form is Web Distributed Authoring and Versioning or simply DAV is a protocol.

WebDAV is not a API or an application. It is a specification, a protocol, a set of extension to existing HTTP protocol.

WebDAV is defined by RFC2518 as an HTTP extension framework with a plug point for the access and management of hierarchical data , for example, in content management systems. WebDAV stores the data in collections. A folder represents a WebDAV collection.

Apart from distributed authoring it is i.e.WebDAV is also targeted for other benefits like below:
1.      Network file system suitable for internet
2.      Supporting remote software development teams
3.      Common interface to a wide range of repositories, such as databases, file systems, document management, configuration management, etc
4.      WebDAV has no restrictions on the type of documents which can be authored
5.      Concurrency control
6.      Meta-data or Properties
7.      name space management (ability to copy and move Web pages within a server's namespace)
8.      collections (creation, removal, and listing of resources)

This protocol consists of a set of new methods and headers for use in HTTP. The added methods include:
  • PROPFIND — used to retrieve properties, stored as xml, from a resource. It is also overloaded to allow one to retrieve the collection structure (a.k.a. directory hierarchy) of a remote system.
  • PROPPATCH — used to change and delete multiple properties on a resource in a single atomic act
  • MKCOL — used to create collections (a.k.a. a directory)
  • COPY — used to copy a resource from one URI to another
  • MOVE — used to move a resource from one URI to another
  • LOCK — used to put a Lock on a resource. WebDAV supports both shared and exclusive locks.
  • UNLOCK — to remove a lock from a resource

WebDAV-Clients

Webdav clients few are listed below,
  1. Microsoft WebFolders(Inbuild in O.S),
 To connect to WebDAV for WebSphere Portal by using WebFolders, proceed as follows:
  • Open “my network places” .
  • Add Network place , NextĆ  Select “choose another network location” and next
  • Enter the WebDAV url to access.
http://localhost:10039/wps/mycontenthandler/dav/contentmodel/wps.content.root/
  • Enter your user ID and password for the portal.
  • Type a name for the network place and click Next.
  • Click Finish.
You can also use MS-Office product to open the webDAV files.

  1. AnyClient, (Freeware)
  1. BitKinex (Freeware)
  1. WebDrive (WebDrive is supported by WebSphere Portal)

Portal Dynacache Replication in Cluster


You need to setup dynacache feature replication domain when you have some sort of configurations information needed to be shared across the clusters in dynacache objects.

Follow below steps which explains setting up replicated dynacache in cluster node environment

  1. Login to the WebSphere Administrative console of your server.
  2. Go to Resources > Cache Instances > Object cache instances .
  3. Click the "Browse Clusters" button and choose cluster so that for which you want to create the cache for i.e. Target.
  4. Click "Apply" save your inputs.
  5. Click "New" to create new cache.
  6. Enter missedabspath in the "Name" field and services/cache/iwk/missed in the JNDI name field. These values are used to lookup the cache and use it. Leave all other fields set to their default values.
  7. Select "Enable Cache Replication"
  8. Go to the Full group replication domain drop-down box and select the name of the cluster which you want to get it cache.
  9. Select Choose Push-Only from the Replication type drop down box.
  10. Enter 1 in "Push Frequency" field. 
  11. Leave all other fields as is i.e. to their default values.
  12. Click OK then click Save > Save > OK.

WebSphere Portal 7.0 portal


Administering WebSphere Portal 7.0 features :

Various administration and configuration tools r offered by IBM WebSphere Portal 7.0. 
 
Learn about each & every tool to use for which task & about the newest capabilities of WebSphere 7.0, and understand differences from previous versions of WebSphere Portal. 
 
Walk through of exercises for each tool so you we can learn how to use each os those features.

Topics:

• Introduction
• What is WebSphere Portal?
• WebSphere Portal installation
• WebSphere Portal file system structure
• Command line tools
• Administration user interface: Admin portlets
• WebSphere Application Server Admin user interface
• Conclusion
• Resources
• About the authors

Log Off redirection in Portal


Configuration:

The portal Configuration Service is responsible for collecting the most essential configuration data.
In the navigation click Resources > Resources Environment > Resource Environment Providers.

(1)   Configuring logoff redirection

1. Specify the following values in the WP ConfigService:
redirect.logout=true
redirect.logout.ssl=false or true, depending on your environment
redirect.logout.url=protocol://host_name/logout_page
where
protocol
is the protocol of the ESM machine: http or https,
host_name
is the fully qualified host name of the ESM machine, and
logout_page
is the ESM page that users will be directed to when they log out

Resource environment providers > WP ConfigService > Custom properties



Database jndi creation:
Application Server:
https://localhost:10032/ibm/console/logon.jsp