Package org.dspace.services.model
Interface Session
-
- All Superinterfaces:
javax.servlet.http.HttpSession
public interface Session extends javax.servlet.http.HttpSession
Represents a user's session (login session) in the system. Can hold some additional attributes as needed, but the underlying implementation may limit the number and size of attributes to ensure session replication is not impacted negatively.- Author:
- Aaron Zeckoski (azeckoski @ gmail.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Purges all data from this session and effectively resets it to an anonymous session.String
getAttribute(String key)
Get an attribute from the session if one exists.Map<String,String>
getAttributes()
Get all attributes of this session.String
getOriginatingHostIP()
String
getOriginatingHostName()
String
getServerId()
String
getSessionId()
String
getUserEID()
Get the external/enterprise user ID for this session.String
getUserId()
Return the internal user ID for this session.boolean
isActive()
void
setAttribute(String key, String value)
Set an attribute on a session.-
Methods inherited from interface javax.servlet.http.HttpSession
getAttributeNames, getCreationTime, getId, getLastAccessedTime, getMaxInactiveInterval, getServletContext, getSessionContext, getValue, getValueNames, invalidate, isNew, putValue, removeAttribute, removeValue, setAttribute, setMaxInactiveInterval
-
-
-
-
Method Detail
-
getSessionId
String getSessionId()
- Returns:
- the session identifier. This is not the
HttpSession.getId()
from HttpSession unless no session id was specified when the session was bound.
-
getUserId
String getUserId()
Return the internal user ID for this session.- Returns:
- internal user ID for the user using this session. This is null if the session is anonymous.
-
getUserEID
String getUserEID()
Get the external/enterprise user ID for this session.- Returns:
- the external/enterprise user id of the user associated with this session
-
isActive
boolean isActive()
- Returns:
- true if this session is active OR false if the session has timed out or been invalidated
-
getServerId
String getServerId()
- Returns:
- id of the server with which this session is associated.
-
getOriginatingHostIP
String getOriginatingHostIP()
- Returns:
- the IP Address from which this session originated
-
getOriginatingHostName
String getOriginatingHostName()
- Returns:
- the hostname from which this session originated
-
getAttribute
String getAttribute(String key)
Get an attribute from the session if one exists.- Specified by:
getAttribute
in interfacejavax.servlet.http.HttpSession
- Parameters:
key
- the key for the attribute- Returns:
- the value if one exists OR null if none
-
setAttribute
void setAttribute(String key, String value)
Set an attribute on a session.- Parameters:
key
- the key for the attributevalue
- the value (if this is null then the attribute is removed)
-
getAttributes
Map<String,String> getAttributes()
Get all attributes of this session.- Returns:
- a copy of the attributes in this session. Modifying it has no effect on the session attributes.
-
clear
void clear()
Purges all data from this session and effectively resets it to an anonymous session. Does not invalidate the session, though.
-
-