exceptions management in servlet. Class StatisticalManagerException created in order to manage exceptions generated from the statistical.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@100260 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-09-29 16:07:58 +00:00
parent 6a96111918
commit 1176464f8a
4 changed files with 957 additions and 790 deletions

View File

@ -53,13 +53,16 @@ public class SessionUtil {
public static boolean isSessionExpired(HttpSession httpSession) throws Exception {
logger.info("session validating...");
//READING USERNAME FROM ASL SESSION
//reading username from asl session
String userUsername = getAslSession(httpSession).getUsername();
/*COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
if(userUsername.compareToIgnoreCase(USER)==0){
logger.error("session is expired! username is: "+SessionUtil.USER);
return true; //is USER, session is expired
}
if(userUsername.compareToIgnoreCase(TEST_USER)==0){
logger.error("session is expired! username is: "+SessionUtil.TEST_USER);
return true; //is TEST_USER, session is expired

View File

@ -1,7 +1,9 @@
package org.gcube.portlets.user.databasesmanager.shared;
public class SessionExpiredException extends Exception{
public class SessionExpiredException extends Exception {
private static final long serialVersionUID = 1L;
public SessionExpiredException() {
super("Session expired");
}

View File

@ -0,0 +1,15 @@
package org.gcube.portlets.user.databasesmanager.shared;
public class StatisticalManagerException extends Exception{
private static final long serialVersionUID = 1L;
public StatisticalManagerException(){
super();
}
public StatisticalManagerException(String message){
super(message);
}
}