Access Global Custom Attributes

112-617x244.png

Global Attributes can be declared to share variables and information between all the Portals.

Link to download the Portal Extension Application with the sample

Out of the box one of the attributes is the wcSessionTimeoutPeriod responsible of the session timeout.

The access to those attributes can be done using following:

  • EL Expression
  • Java.

How can be accessed using EL Expressions?

 

#{WCAppContext.application.applicationConfig.customAttributes['wcSessionTimeoutPeriod']}

 

How can be access from Java? from a Java Servlet deployed to WebCenter Portal (formerly Spaces)?

In this case the EL Expression can be invoked using Java. However, how can be accessed from a Servlet deployed to WebCenter Portal?.

Using following snippet of Java code allow to access all Global Custom Attributes Java:

...
import oracle.webcenter.webcenterapp.WebCenterException;
import oracle.webcenter.webcenterapp.internal.model.WebCenterUtils;
...
try {
  String timeout = WebCenterUtils.getAppCustomAttributeValue("wcSessionTimeoutPeriod");
  System.out.println("Timeout: "   timeout);
} catch (WebCenterException e) {
  e.printStackTrace();
}
...

In order to use it add following Libraries as dependencies:

  • WebCenter Spaces Model
  • WebCenter Spaces Client

Subscribe to email updates

Recent Posts