How to Create a Custom Session Timeout Page for WebCenter Spaces

Introduction

In version 11.1.1.7.0 of WebCenter Portal Spaces, there are two options for handling how the browser displays session timeout behavior.  The two options are: Display a Timeout Page, or Display a Timeout Popup. These options can be set from the within the Spaces Administration console in the Configuration settings section.

The timeout popup are actually a set of two popups.  One popup displays two minutes before the actual timeout value and the second popup displays when the timeout has already happened.  In addition, the session timeout value (in minutes) can also be set in this location.

When choosing the Display Timeout Page option, upon timeout the browser is redirected to a page, which is essentially content served up by a custom (wcsessioninvalidation) servlet.  This default page is good as it allows the user to navigate back to Spaces.  However, since this page is not a system page, which would then enable you to directly customize it through the Spaces Composer based user interface (UI), how can this default session timeout page be customized?  Unfortunately, the short answer is that it is not possible to customize the default page.  The good news is that you can create your own custom timeout page and configure Spaces to use that page instead of the default page.  This post will details the steps necessary to make this happen.

Main Article

As I mentioned before in the Introduction section, the two options for setting the timeout behavior can be set from the within the Spaces Administration console in the Configuration settings section:

customSessionTOpage_3

The default option is to display popup.

For this example, the Display Timeout Page will be chosen. The next requirement for enabling the custom session timeout page to display, is to create the custom page.  The recommended (and easiest) way to set this up is to first create a PUBLIC group space in WebCenter Spaces.

customSessionTOpage_4

Once the group space is created and depending on what type (e.g. Blogger, Portal Site, .etc) of group space was selected at the time, there will be a set of already created pages.  Any one of these pages can be customized to be used as the session timeout page.  For this example, the default HOME page will be customized with the following iems: text field and a link.  The (Click Here) link is configured with ” \ ” as its destination.

customSessionTOpage_5

The Home page was selected as it is the first page that will be viewed upon navigation to the group space.  For the redirect to work correctly, the navigation model based pretty URL will need to be recorded.  To find this URL, navigate to the Space Options in the General Settings for the group space:

customSessionTOpage_6

In this example, the Space URL is http://localh…/webcenter/spaces/SessionTimeOutSpace. The important part of the URL for the redirect is /spaces/SessionTimeoutSpace.

You can modify this URL by selecting the change the URL link below the Space URL.

There are other items that can be done to compete the customization of the page, such as modifying the page template to remove some of the chrome: navigation bar menu, default spaces links .etc.  However, these operations are beyond the scope of this post.

Now, that the required parts for the custom page have been done, which are: a public group space, a page within this group space, and the URL to the group space.  The next set of steps will detail how to configure Spaces to use the customized page.

Currently, the only way to configure Spaces to change the default behavior is to modify the webcenter-config.xml in the Metadata Services Repository (MDS).  The recommended process for doing this is either through using the WebLogic Scripting Tool (WLST) commands or though the MBean operations from within Enterprise Manager.  For example on the test system, the following WLST command exports the current configuration of the webcenter-config.xml:

exportMetadata(‘webcenter’,'WC_Spaces’,'/home/oracle/mds_files’,'/oracle/**/webcenter-config*’)

The resultant of the export produces 2 files: webcenter-config.xml and webcenter-config.xml.xml.

If only one file is produced (webcenter-config.xml), then Spaces has not been modified.  For example, changing the default session timeout value will produce an update (customization) and will be stored in the (created) webcenter-config.xml.xml.

The webcenter-config.xml.xml is actually the customizations for the (base) webcenter-config.xml.  At a high level, at runtime MDS merges all of the customizations into the base document.  For more information about MDS, please refer to the documentation here.

From within the 2 exported files, the important sections are highlighted below:

webcenter-config.xml:

<webcenter:post-invalidation-option>DISPLAY_BLANK_PAGE</webcenter:post-invalidation-option>
<webcenter:post-invalidation-url>/wcsessioninvalidation</webcenter:post-invalidation-url>

webcenter-config.xml.xml:

<mds:replace node="webcenter(xmlns(webcenter=http://xmlns.oracle.com/webcenter/webcenterapp))/webcenter:post-invalidation-option"/>
<mds:insert after="webcenter(xmlns(webcenter=http://xmlns.oracle.com/webcenter/webcenterapp))/webcenter:uploadedFileMaxMemory" parent="webcenter">
<post-invalidation-option xmlns="http://xmlns.oracle.com/webcenter/webcenterapp">DISPLAY_BLANK_PAGE</post-invalidation-option>
</mds:insert>

In both files, for the post-invalidation-option, change the DISPLAY_BLANK_PAGE to NAVIGATE_AWAY.  In the webcenter-config.xml, in the post-invalidation-url, change the wcsessioninvalidation to the group space URL (recorded earlier in this post).  For example, /spaces/SessionTimeoutSpace. The following displays an example with the 2 modifications:

webcenter-config.xml:

<webcenter:post-invalidation-option>NAVIGATE_AWAY</webcenter:post-invalidation-option>
<webcenter:post-invalidation-url>/spaces/SessionTimeoutSpace</webcenter:post-invalidation-url>

webcenter-config.xml.xml:

<mds:replace node="webcenter(xmlns(webcenter=http://xmlns.oracle.com/webcenter/webcenterapp))/webcenter:post-invalidation-option"/>
<mds:insert after="webcenter(xmlns(webcenter=http://xmlns.oracle.com/webcenter/webcenterapp))/webcenter:uploadedFileMaxMemory" parent="webcenter">
<post-invalidation-option xmlns="http://xmlns.oracle.com/webcenter/webcenterapp">NAVIGATE_AWAY</post-invalidation-option>
</mds:insert>

Once the changes have been made to the files, import the 2 files back into the Spaces MDS.  For example, using WLST:

importMetadata(application=’webcenter’,server=’WC_Spaces’,fromLocation=’/home/oracle/mds_files’,docs=’/oracle/**/webcenter-config*’)

During the importation process, WLST will report the status:

wls:/wc_domain/serverConfig> importMetadata(application=’webcenter’,server=’WC_Spaces’,fromLocation=’/home/oracle/mds_files’,docs=’/oracle/**/webcenter-config*’)

Executing operation: importMetadata.

Operation “importMetadata” completed. Summary of “importMetadata” operation is:
List of documents successfully transferred:

/oracle/webcenter/webcenterapp/metadata/mdssys/cust/site/webcenter/webcenter-config.xml.xml
/oracle/webcenter/webcenterapp/metadata/webcenter-config.xml

2 documents successfully transferred.
wls:/wc_domain/serverConfig> exportMetadata(‘webcenter’,'WC_Spaces’,'/home/oracle/mds_files’,'/oracle/**/webcenter-config*’)

Executing operation: exportMetadata.

Operation “exportMetadata” completed. Summary of “exportMetadata” operation is:
List of documents successfully transferred:

/oracle/webcenter/webcenterapp/metadata/mdssys/cust/site/webcenter/webcenter-config.xml.xml
/oracle/webcenter/webcenterapp/metadata/webcenter-config.xml

2 documents successfully transferred.

Restart the Spaces managed server.  Upon timeout, the custom session timeout page will now appear:

customSessionTOpage_2

This example uses a modified page template to remove most of the default chrome.  In addition, since \ was chosen as the link’s destination, note the actual URL below in the browsers status bar.

Once the customization has been performed, the radio buttons for the type of timeout (popup or page), will both become non-selected.  This must not be modified.  Otherwise, the webcenter.config.xml.xml will update back to the DISPLAY_BLANK_PAGE, which will then override the (base) webcenter-config,xml setting as well.

 

Add Your Comment