MCPcopy Create free account
hub / github.com/apache/tomcat / getSession

Method getSession

java/org/apache/catalina/session/ManagerBase.java:1156–1177  ·  view source on GitHub ↗

Returns information about the session with the given session id. The session information is organized as a HashMap, mapping session attribute names to the String representation of their values. @param sessionId Session id @return HashMap mapping session attribute names to the String representa

(String sessionId)

Source from the content-addressed store, hash-verified

1154 * session with the specified id exists, or if the session does not have any attributes
1155 */
1156 public HashMap<String,String> getSession(String sessionId) {
1157 Session s = sessions.get(sessionId);
1158 if (s == null) {
1159 if (log.isInfoEnabled()) {
1160 log.info(sm.getString("managerBase.sessionNotFound", sessionId));
1161 }
1162 return null;
1163 }
1164
1165 Enumeration<String> ee = s.getSession().getAttributeNames();
1166 if (ee == null || !ee.hasMoreElements()) {
1167 return null;
1168 }
1169
1170 HashMap<String,String> map = new HashMap<>();
1171 while (ee.hasMoreElements()) {
1172 String attrName = ee.nextElement();
1173 map.put(attrName, getSessionAttribute(sessionId, attrName));
1174 }
1175
1176 return map;
1177 }
1178
1179
1180 /**

Callers

nothing calls this directly

Calls 10

getSessionMethod · 0.95
getSessionAttributeMethod · 0.95
getMethod · 0.65
isInfoEnabledMethod · 0.65
infoMethod · 0.65
getStringMethod · 0.65
getAttributeNamesMethod · 0.65
putMethod · 0.65
hasMoreElementsMethod · 0.45
nextElementMethod · 0.45

Tested by

no test coverage detected