Revision 4780
Added by daigle about 15 years ago
MetaCatServlet.java | ||
---|---|---|
1117 | 1117 |
try { |
1118 | 1118 |
sess = new AuthSession(); |
1119 | 1119 |
} catch (Exception e) { |
1120 |
System.out.println("error in MetacatServlet.handleLoginAction: " |
|
1121 |
+ e.getMessage()); |
|
1122 |
out.println(e.getMessage()); |
|
1120 |
String errorMsg = "Problem in MetacatServlet.handleLoginAction() authenicating session: " |
|
1121 |
+ e.getMessage(); |
|
1122 |
logMetacat.error(errorMsg); |
|
1123 |
out.println(errorMsg); |
|
1123 | 1124 |
return; |
1124 | 1125 |
} |
1125 | 1126 |
boolean isValid = sess.authenticate(request, un, pw); |
... | ... | |
1128 | 1129 |
if (isValid) { |
1129 | 1130 |
HttpSession session = sess.getSessions(); |
1130 | 1131 |
String id = session.getId(); |
1131 |
logMetacat.info("Store session id " + id
|
|
1132 |
logMetacat.debug("Store session id " + id
|
|
1132 | 1133 |
+ " which has username" + session.getAttribute("username") |
1133 | 1134 |
+ " into hash in login method"); |
1134 |
SessionService.registerSession(id, |
|
1135 |
(String) session.getAttribute("username"), |
|
1136 |
(String[]) session.getAttribute("groupnames"), |
|
1137 |
(String) session.getAttribute("password")); |
|
1135 |
try { |
|
1136 |
SessionService.registerSession(id, (String) session |
|
1137 |
.getAttribute("username"), (String[]) session |
|
1138 |
.getAttribute("groupnames"), (String) session |
|
1139 |
.getAttribute("password")); |
|
1140 |
} catch (ServiceException se) { |
|
1141 |
String errorMsg = "Problem in MetacatServlet.handleLoginAction() registering session: " |
|
1142 |
+ se.getMessage(); |
|
1143 |
logMetacat.error(errorMsg); |
|
1144 |
out.println(errorMsg); |
|
1145 |
return; |
|
1146 |
} |
|
1138 | 1147 |
} |
1139 | 1148 |
|
1140 | 1149 |
// format and transform the output |
... | ... | |
1148 | 1157 |
trans.transformXMLDocument(sess.getMessage(), |
1149 | 1158 |
"-//NCEAS//login//EN", "-//W3C//HTML//EN", qformat, |
1150 | 1159 |
out, null); |
1151 |
} catch (Exception e) { |
|
1152 |
|
|
1153 |
logMetacat.error( |
|
1154 |
"Error in MetaCatServlet.handleLoginAction: " |
|
1160 |
} catch (Exception e) { |
|
1161 |
logMetacat.error("Error in MetaCatServlet.handleLoginAction: " |
|
1155 | 1162 |
+ e.getMessage()); |
1156 | 1163 |
} |
1157 | 1164 |
} |
Also available in: Unified diff
Handle sessions with null ids gracefully.