Custom session timeout popup message in ADF/ Webcenter portal

Hi All,

In ADF and webcenter applications sometimes we have a requirement to show custom session time-out message.I have tried A team article approach as mentioned but this is not working for me in webcenter 11.1.1.8 not even in portal framework or run time portal. So I have tried something to handle this. In ADF application normally we have a popup before session time out and one after the session is expired.

So I need to disable standard warning message for expiry. I did that like below.

To disable to warning for session time out –

Add these entries in web.xml as

<context-param>
  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  <param-value>client</param-value>
</context-param>

<context-param>
  <param-name>
     oracle.adf.view.rich.sessionHandling.WARNING_BEFORE_TIMEOUT
  </param-name>
    <param-value>0</param-value>
</context-param>

Fair enough. Now you will not see any ootb warning before session time out.But I need a customized session time out popup.Following is the solution for that.
Add this code in the your page template for ADF and webcenter application.

 <af:resource type="javascript">
     var timeoutID;
    resetTimeout();
    function resetTimeout(){
        if( timeoutID ) clearTimeout( timeoutID );
        timeoutID = setTimeout( ShowTimeoutWarning, 1500000 ); // this is popup will come if user is idle for 25 minutes(25*6000)
    }
    function ShowTimeoutWarning() {
       var popup = AdfPage.PAGE.findComponentByAbsoluteId('pt_p1');
       popup.show();
    }

    document.onkeyup   = resetTimeout;
    document.onkeydown = resetTimeout;
    document.onclick   = resetTimeout;

    </af:resource>

and in the page template add a popup.You can also skin your popup as you like through normal skinning.

 <af:popup id="pt_p1" animate="default">
           <af:dialog id="tod" title="Warning" closeIconVisible="false" type="ok">
              <af:outputText value="You session will expire in next 5 Minute." id="pt_ot1"/>
           </af:dialog>
         </af:popup>

Thats it. You can try this in ADF , webcenter portal framework and or runtime portal too.

Happy learning with Vinay in techartifact.

Get context root or URL of ADF / Webcenter application

Hi,

I have requirement to get the context root in javascript on page load.Not on any event.If you need on java you can try my previous solution like get the current viewId or url in ADF using ControllerContext. Following solution will work in any application

Try this

window.location.protocol = “http:” // gives you protocol
window.location.host = “techartifact.com”
window.location.pathname = “blogs/2015/08/building-taskflow-for-reuse.html”

var pathArray = window.location.pathname.split(‘/’);
var secondLevelLocation = pathArray[1]; // this will give you the context root of application

Similarly you can get the current page number or param etc in javascript.

Similarly if you need this context root on some button event you can try like passing it using a af:clientAttribute and EL as *#{facesContext.externalContext.request.contextPath}*

<af:document id=”d1”>
<af:resource type="javascript">
        function onLoad(evt){
            var path=evt.getSource().getProperty("pagePath");
            window.location.replace(path);// here we were trying a redirect , just an example
        }
        </af:resource>
        <af:clientListener method="onLoad" type="load"/>
        <af:clientAttribute name="pagePath"
                            value="#{facesContext.externalContext.request.contextPath}/faces/<pagePath>"/>
….
</af:document>

 

Happy coding in techartifact

Building ADF Taskflow for reuse

Hi All,

If you making taskflow for reuse either as jar or in portal and so on.Always make sure one property that Library Internal
This property makes an entry in task-flow-registry.xml and enable/disable taskflow to reuse.

Library Internal: This property controls the visibility of a task flow when packaged in an ADF library.
This helps developers to expose only those task flows that are indented for reuse.

taskflowProperties

if you check this property you will have task-flow-registry.xml as below

<?xml version = '1.0' encoding = 'UTF-8'?>
<task-flow-registry xmlns="http://xmlns.oracle.com/adf/controller/rc">
 <task-flow-descriptor path="../../main/public_html/WEB-INF/testTaskFlow.xml" id="" type="" uses-page-fragments="false" library-internal="true" remote-invocable="false" train="false"/>
</task-flow-registry>

 

So always make sure you never check this property if you want to reuse.Or if you have parent taskflow and 5 sub taskflow which is called by parent taskflow then you can have 5 sub taskflow as
internal library but parent should be as internal library false.

Happy reusing with Vinay in techartifact