Changed the session invalidation
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerCore@81464 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8ac030e295
commit
ab09ca9721
|
@ -96,7 +96,7 @@ public class ASLSession{
|
||||||
public long getSessionTimeoutMillis() throws IOException, ParserConfigurationException {
|
public long getSessionTimeoutMillis() throws IOException, ParserConfigurationException {
|
||||||
if(sessionTimeout > 0) //means that is already set to a value !
|
if(sessionTimeout > 0) //means that is already set to a value !
|
||||||
return sessionTimeout;
|
return sessionTimeout;
|
||||||
int timeoutSecs;
|
int timeoutMins;
|
||||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder dBuilder = null;
|
DocumentBuilder dBuilder = null;
|
||||||
try {
|
try {
|
||||||
|
@ -113,10 +113,10 @@ public class ASLSession{
|
||||||
String timeoutString = sessionTimeouts.item(0).getTextContent(); //timeout now contains the timeout value in string. eg "400"
|
String timeoutString = sessionTimeouts.item(0).getTextContent(); //timeout now contains the timeout value in string. eg "400"
|
||||||
if( (timeoutString==null) || (timeoutString=="")){
|
if( (timeoutString==null) || (timeoutString=="")){
|
||||||
logger.debug("No property session-timeout in file, setting it to default");
|
logger.debug("No property session-timeout in file, setting it to default");
|
||||||
timeoutSecs = 1800; //30 minutes
|
timeoutMins = 30;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
timeoutSecs = Integer.parseInt(timeoutString);
|
timeoutMins = Integer.parseInt(timeoutString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) { //case tomcat properties file could not be found
|
catch (Exception e) { //case tomcat properties file could not be found
|
||||||
|
@ -130,20 +130,20 @@ public class ASLSession{
|
||||||
String timeoutString = sessionTimeouts.item(0).getTextContent();
|
String timeoutString = sessionTimeouts.item(0).getTextContent();
|
||||||
if( (timeoutString==null) || (timeoutString=="")){
|
if( (timeoutString==null) || (timeoutString=="")){
|
||||||
logger.debug("No property session-timeout in local file, setting it to default");
|
logger.debug("No property session-timeout in local file, setting it to default");
|
||||||
timeoutSecs = 1800; //30 minutes
|
timeoutMins = 30;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
timeoutSecs = Integer.parseInt(timeoutString);
|
timeoutMins = Integer.parseInt(timeoutString);
|
||||||
}
|
}
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
logger.debug("Could not parse file properties.xml for property. Setting it to default.");
|
logger.debug("Could not parse file properties.xml for property. Setting it to default.");
|
||||||
timeoutSecs = 1800; //30 minutes
|
timeoutMins = 30;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//At this point, in all cases "timeoutSecs" will have a valid timeout value. If not from the two xml files, then a default one
|
//At this point, in all cases "timeoutSecs" will have a valid timeout value. If not from the two xml files, then a default one
|
||||||
logger.info("Session Timeout is: " + timeoutSecs*1000);
|
sessionTimeout = timeoutMins * 60000; //in milliseconds
|
||||||
sessionTimeout = timeoutSecs * 1000;
|
logger.info("Session Timeout is: " + sessionTimeout);
|
||||||
return timeoutSecs * 1000;
|
return sessionTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ public class ASLSession{
|
||||||
maxTime = getSessionTimeoutMillis();
|
maxTime = getSessionTimeoutMillis();
|
||||||
} catch (Exception e) { e.printStackTrace();}
|
} catch (Exception e) { e.printStackTrace();}
|
||||||
|
|
||||||
lastUsedTime = System.currentTimeMillis() - maxTime+120000; // 2 minutes excessive
|
lastUsedTime = System.currentTimeMillis() - maxTime - 120000; // 2 minutes excessive
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<properties>
|
<properties>
|
||||||
<session-config>
|
<session-config>
|
||||||
<session-timeout>400</session-timeout>
|
<!-- session timout in minutes -->
|
||||||
|
<session-timeout>30</session-timeout>
|
||||||
</session-config>
|
</session-config>
|
||||||
</properties>
|
</properties>
|
Loading…
Reference in New Issue