Manually Set the Session Expiration
To find the active credential object, get a list of all Credentials available to the user, and iterate over them until one with type="pervasiveSession" is found, having a sessionId matching our current sessionId.
//get a list of credentials available to the session User
List listCredentials = port.listCredentials(0, Integer.MAX_VALUE, sessionId);
Credential currentCredential = null;
//Iterate over entire list
Iterator it1 = listCredentials.iterator();
while (currentCredential == null && it1.hasNext()) {
Credential credential = it1.next();
//Pervasive username/password credentials will have a type of "pervasiveSession"
if (credential.getType().equals("pervasiveSession")) {
//iterate through parameters -- the session id will be stored in a credential parameter
Iterator it2 = credential.getParameters().getParameter().iterator();
while (currentCredential == null && it2.hasNext()) {
CredentialParameter cp = it2.next();
//If the parameter key is sessionId and the value matches our
//actual session Id then we've found our credential
if ("sessionId".equals(cp.getKey()) && sessionId.equals(cp.getValue())) {
currentCredential = credential;
}
}
}
}
if (currentCredential == null) {
throw new Exception("Failed to retrieve current credential");
}
Last modified date: 12/17/2021