How to change the WPS URL


There might be situations when you want to change portal entry url.
After portal installation you will see portal url as 

http://hostname:10039/wps/portal     ( for Anonymous users) and  
http://hostname:10039/wps/myportal  ( for Authenticated users).

In the above url, 

wps is the WPSContextRoot
portal is the WpsDefaultHome
myportal is the WpsPersonalizedHome

Now, if you want to change the url and want to look like

http://hostname:10039/mynewcontextroot/mynewWpsDefaultHome
 ( for Anonymous users)

http://hostname:10039/mynewcontextroot/mynewWpsPersonalizedHome  
( for Authenticated users).

You would require to make changes in the 
wkplc.properties and wkplc_comp.properties files, located in the wp_profile_root/ConfigEngine/properties

For complete details, please go through the following documentation

http://publib.boulder.ibm.com/infocenter/wpdoc/v6r1/index.jsp?topic=/com.ibm.wp.ent.doc_v615/config/cfg_intr.html


Above changes are for wps 6.1.5. If you want to make change in some other wps version, please refer to respective WPS version info center.

All about XMLAccess

Recently, I came across to an article which tells everything about XMLAccess.

I would strongly recommend to go through this XMLAccess article to understand XML Access concepts in detail.

Many thanks to Fang and Joe for this wonderful article.

Web security concepts and considerations for WPS Administrators

Recently I read an article on Web Security concepts on WPS. 
The article covers various concepts like Authentication, Authorization, SSO, ESM, Sessions, Step Up Authentication and many more.
Thought as per article heading, it is specifically for WPS Admin but I would strongly recommend to go through complete article even if you are from portlet development. 

Please read article here at Web Security concepts on WPS


InterPortlet Communication - Best Practice Matrix

I published "InterPortlet Communication - Best Practice Matrix" on IBM portal wiki.
This IPC Matrix helps to choose best practice for various scenarios of IPC.


Persisting user navigational states in WPS 7

You might have come across to situations where you would want WPS to persist user navigational states like

Portlet states:

    Normal
    Minimized
    Maximized

Portlet modes:

    config
    edit_defaults
    edit
    view
    help

Page selection:

    The last page that was active before the user logged out.


With the persistent session state feature, portal users can resume and continue a previously interrupted working session at the same state where they left the session. When the user logs out or the session times out, the portal stores the current navigational state into the database.


Resuming the session state is only possible if either the portal theme login link or WebSphere Application Server TAI based authentication is used to login to the portal.

Please have a look at detail article at Configuring user session persistance

How to know what all objects are stored in session at any point of time


You might want to know at any point of time that how many objects are stored in session along with their size. This would be most useful when you are analyzing application performance or working on performance tuning area.
This would also be useful in debugging when your application is throwing java.io.NotSerializableException.


There is a servlet called com.ibm.ws.webcontainer.httpsession.SessionInspectServlet that ships with WAS located in com.ibm.ws.webcontainer.jar. This jar is placed under <WPS_ROOT>/AppServer/plugins/.   
SessionInspectorServlet  can be used to list down what all objects are stored in session along with size of the objects.



In order to use SessionInspectServlet, you would need to enable “Serving servlets by class name”, you can set this value in the ibm-web-ext.xmi
By default this value is true, you can see sample ibm-web-ext.xmi file below and can see that serveServletsByClassnameEnabled value is true.

<?xml version="1.0" encoding="UTF-8"?>
<webappext:WebAppExtension xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:webappext="webappext.xmi" xmi:id="WebAppExtension_1320397630802" reloadInterval="3" reloadingEnabled="true" additionalClassPath="" fileServingEnabled="true" directoryBrowsingEnabled="false" serveServletsByClassnameEnabled="true">
  <webApp href="WEB-INF/web.xml#WebApp_ID"/>
</webappext:WebAppExtension>


To list down session objects stored in session, you would required to hit below URL
 
http://localhost:10039/wps/<context-root>/SessionInspector/servlet/com.ibm.ws.webcontainer.httpsession.SessionInspectServlet

here, context root would be context root of your application. You can specify this while installing your WAR through portal admin console OR you can also find out this value inside application.xml located under <WPS_ROOT>/wp_profile/installedApps/<NODE>/<EAR NAME>/META-INF/
 
You would see list of your session objects and their size as shown in the screen shot.


How to get HttpServletRequest and HttpServletResponse from portlet request

There are some scenario when you want to get httpServletRequest or httpServletReponse from portletRequest.

IBM provides an utility class which gives you what you are looking for.

Yes, there is a PortletUtil class available in the com.ibm.ws.portletcontainer.portlet package, through which you can directly get httpServletRequest, httpServletResponse, ServletContext and many  more servlet object you want.


Code to get HttpServletRequest from  portletRequest/renderRequest/actionRequest.

HttpServletRequest httpServletRequest =  PortletUtils.getHttpServletRequest(renderRequest);

There are couple of utility methods available in PortletUtil which  gives you ServletContext, ServletConfig, PortletWindow, PortletApplicationDefinition etc.