Monday, June 13, 2016

How to set Ephox Edit Live editor as default WCM editor?

Below are the simple steps to changes the WCM editor from default rich text to Ephox edit Live. First of all you have to download Ephox edit live from https://greenhouse.lotus.com/ and install the same application on to your portal server if not already installed.
  • Login to WAS Console.
  • Navigate to Applications->Application Types -> WebSphere enterprise applications.
  • Click on Install and select the .ear file you downloaded and click Next. Keep the default options keep going to next pages.
  • Make sure you select websphere_portal as the server not server1 while installing the .ear and finish the installation and save the configuration.
  • Start the application if its not already started.
  • Login to portal as administrator and navigate to WCM Authoring portlet -> Preferences > Configure.
  • Expand the Rich Text Options section , select Custom Editor in the drop down and enter the following in the text box "/wps/ephox/;jsp/html/EditLiveJavaEditor.jsp"and click OK.
  • Now navigate to WCM Authoring portlet -> Preferences > Edit Shared Settings.
  • Expand the RichTextOptions section , select Custom Editor in the drop down and enter the following in the text box "/wps/ephox/;jsp/html/EditLiveJavaEditor.jsp"and click OK.
  • Now go to any content item that uses rich text and you can see its using ephox edit live edit instead of IBM's default RTE.
  •  You can easily toggle between the design view and code view in the bottom left corner.
 Ephox edit Live is a Java Editor and Java Runtime is required on wcm author's machine to be able to use this applet in a browser.

Ephox has also released a javascript based rich text editor that you can apply on WebSphere Portal 8.5.0.0 with CF06 or higher.
Here is some more info on this: https://greenhouse.lotus.com/plugins/plugincatalog.nsf/assetDetails.xsp?action=editDocument&documentId=86189C1DAC5B1D3B85257E4500199F1B

About Rich Text editor options on WCM: https://www.ibm.com/support/knowledgecenter/SS3JLV_8.0.0/wcm/wcm_config_authoringportlet_richtext.html

Thursday, February 4, 2016

OptimizeCacheIdIncrements custom property

Problem statement:
cacheid (first 4char of jsessionid) in cluster env was getting update after 2hours of session inactivity however we had 24hrs of session inactivity set in application server. Due to this some of the applications which were dependent on session was throwing unexpected exception. Users were required to clear their cookies to resolve the issue.
We wanted to know why it was getting updated and if there is a way to stop this activity from occurring?

Solution:
set custom property OptimizeCacheIdIncrements parameter to true

Set the OptimizeCacheIdIncrements custom property to true to make the session manager assess whether the in-memory session for a web module is older than the copy in persistent store. Setting this property resolves the continually increasing cache ID.
If HTTP session management is configured to use session persistence and the user's browser session is moving back and forth across multiple web applications you might see extra persistent store activity as the in-memory sessions for a web module are refreshed from the persistent store. As a result, the cache IDs are continually increasing and the in-memory session attributes are overwritten by those of the persistent copy. Set this property to true if you want to prevent the cache IDs from continually increasing.
If the configuration is a cluster, ensure that the system times of each cluster member is identical as possible.

Reference link: http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.0.0/com.ibm.websphere.nd.doc/info/ae/ae/rprs_custom_properties.html%23OptimizeCacheIdIncrements?lang=en


Using Application Server>URL resources to manage J2EE property files and external service url

Use following code to retrieve url resource using jndi
InitialContext initCtx = new InitialContext();
URL url = (java.net.URL) initCtx.lookup(jndi);
URLConnection conn = url.openConnection();
InputStream is = conn.getInputStream();

With this method you can either enter web service url in resource field or properties file path.

Note: You need to restart the server to lookup the url resource from code.

Reference link: http://www.ibm.com/developerworks/websphere/library/techarticles/0502_botzum/0502_botzum.html

How to access authentication alias from WebSphere Application Server> J2C

You can use the following code to obtain credentials from J2C authentication data entry:

import com.ibm.wsspi.security.auth.callback.Constants;
import com.ibm.wsspi.security.auth.callback.WSMappingCallbackHandlerFactory;
import javax.resource.spi.security.PasswordCredential;
import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginContext;

Map map = new HashMap();
map.put(Constants.MAPPING_ALIAS, "YOUR_J2C_DATA_ALIAS");
CallbackHandler callbackHandler = WSMappingCallbackHandlerFactory.getInstance().getCallbackHandler(map, null);

LoginContext loginContext = new LoginContext("DefaultPrincipalMapping", callbackHandler);
loginContext.login();

Subject subject = loginContext.getSubject();
Set credentials = subject.getPrivateCredentials();

PasswordCredential passwordCredential = (PasswordCredential) credentials.iterator().next();

String user = passwordCredential.getUserName();
String password = new String(passwordCredential.getPassword());

Reference link: http://stackoverflow.com/questions/4663534/how-to-access-authentication-alias-from-ejb-deployed-to-websphere-6-1/6355992#6355992

Wednesday, July 8, 2015

Translate portal to myportal when user is logged in

The Problem

Suppose you have a public-facing site for anonymous portal users. But suppose also that the same site also has some private resources requiring users to authenticate for access.
  • In this scenario, an authenticated user will be logged out if they try to access a public resource that has the anonymous context in the URL (i.e. /wps/portal/... instead of /wps/myportal/...).
  • BUT, we cannot just make all of our links contain /wps/myportal to get around the issue because then anonymous users will be prompted to login even if the resource is public.
  • What we need is a way to let links to public resources contain the anonymous context (/wps/portal/...), but we need to automatically transform that into (/wps/myportal) if the user happens to be logged in.

The Solution

There is a configuration option that does exactly this! Here's how you enable it on WPS 7 or greater.
  • In the Deployment Manager or WAS console, navigate to Resource environment providers > WP ConfigService > Custom properties</li>
  • Look for the property 'uri.home.substitution'. If it's not already in the list, add the property (as type java.lang.String) and set the value to 'true'. If it's already in the list, just set the value to true.</li>
  • Apply and save your changes to the master configuration. In a stand-alone environment, you then need to restart your server. In a clustered environment, you need to synchronize the nodes and then restart the cluster.</li>

Summary

The uri.home.substitution option determines whether a public URL should be translated to a protected URL if a user session exists. It is false by default and can be set to <em>true</em>.


Reference Link: https://wiki.base22.com/display/btg/Translate+portal+to+myportal+when+user+is+logged+in

Sunday, February 22, 2015

POC: Piece of Content URL

Passing query parameters to JSR-286 portlets using existing IBM WebSphere Portal capabilities at http://www.lotus.com/ldd/portalwiki.nsf/page.xsp?documentId=0971A3B3CE4F3AEA852578800051E2C7&action=openDocument

Sample Code for PortletPocService in Websphere Portal Server  at
 http://ourwebsphereportal.blogspot.com/2011/10/sample-code-for-portletpocservice-in.html

To pass render or action parameter you need to create DeeplinkResolver project.