使用挂钩来检测 Web 会话

编写挂钩时,您可以使用 Rational® ClearQuest® API 来检测某个用户是否正在使用 Web 客户机。

如果您还未将模式调整为匹配可用于 Web 的功能,那么该信息使您可以采取相应的操作。

例如,如果检测到用于创建消息框或新窗口的函数中存在 Web 会话,那么可以调用针对该 Web 环境修改的代码或退出该函数。以下代码示例可用于检测 Web 会话。

VBScript

dim currDBSession ' Current Db session
set currDBSession = GetSession

' Test for existence of the web session variable.
if currDBSession.HasValue ("_CQ_WEB_SESSION") then
' Either exit or do something else
end if

Perl

my $currDBSession; # Current Db session
$currDBSession = $entity->GetSession();
# Test for existence of the web session variable
if ( $currDBSession->HasValue ("_CQ_WEB_SESSION") {
# Either exit or do something else
}

反馈