endSession
endSession(String sessionID)
endSession 方法标记运行时会话的结束。在运行时服务器收到此方法时,运行时服务器将记录到历史记录,清除内存等等。
*
sessionID - 用于标识会话的唯一字符串。
如果未调用 endSession 方法,那么运行时会话将超时。可以通过 sessionTimeout 属性来配置超时周期。
返回值
运行时服务器通过填充了以下属性的 Response 对象来响应 endSession 方法:
*
*
*
*
示例
以下示例显示了 endSession 方法以及您能够如何解析响应。sessionId 是相同字符串,用于标识启动此会话的 startSession 调用所使用的会话。
response = api.endSession(sessionId);
// check if response is successful or not
if(response.getStatusCode() == Response.STATUS_SUCCESS)
{
System.out.println("endSession call processed with no warnings or errors");
}
else if(response.getStatusCode() == Response.STATUS_WARNING)
{
System.out.println("endSession call processed with a warning");
}
else
{
System.out.println("endSession call processed with an error");
}
// For any non-successes, there should be advisory messages explaining why
if(response.getStatusCode() != Response.STATUS_SUCCESS)
printDetailMessageOfWarningOrError("endSession",
response.getAdvisoryMessages());