且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在从XPage调用的Java Bean中使用SessionAsSigner?

更新时间:2022-05-15 17:30:20

我知道有两种方法可以在Java bean中使用 sessionAsSigner 对象:

There are 2 ways that I know of to use the sessionAsSigner object in Java beans:

1通过解决sessionAsSigner对象:

1 By resolving the sessionAsSigner object:

FacesContext context = FacesContext.getCurrentInstance();
Session sessionAsSigner = context.getApplication().getVariableResolver().
        resolveVariable(context, "sessionAsSigner");

2通过使用扩展库中 com.ibm.xsp.extlib.util.ExtLibUtil 类中的 getCurrentSessionAsSigner()函数.

2 By using the getCurrentSessionAsSigner() function from the com.ibm.xsp.extlib.util.ExtLibUtil class in the Extension Library.

要能够使用它(在Java中像SSJS一样),您需要确保所有设计元素均由相同的用户ID签名.如果不是这种情况,sessionAsSigner对象将不可用(未定义").

To be able to use it (in Java as wel as SSJS) you'll want to make sure that all design elements were signed by the same user ID. If that's not the case, the sessionAsSigner object will not be available ('undefined').