Package com.oorian
Interface OorianHttpSession
- All Known Implementing Classes:
JakartaHttpSession,MockOorianHttpSession,TestHttpSession
public interface OorianHttpSession
Abstraction layer for HTTP session access, decoupling framework code from servlet API specifics.
This interface wraps the subset of HTTP session methods used by the Oorian framework.
- Since:
- 2.1
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Returns the session attribute with the specified name.Returns an enumeration of all attribute names in this session.longReturns the time the session was created.getId()Returns the unique session identifier.longReturns the time of last client access.intReturns the maximum inactive interval for this session.voidInvalidates this session.booleanisNew()Checks if the session was newly created.voidremoveAttribute(String name) Removes a session attribute.voidsetAttribute(String name, Object value) Sets a session attribute.voidsetMaxInactiveInterval(int interval) Sets the maximum time interval between requests before the session expires.
-
Method Details
-
getId
String getId()Returns the unique session identifier.- Returns:
- the session ID
-
getCreationTime
long getCreationTime()Returns the time the session was created.- Returns:
- the creation time in milliseconds since epoch
-
getLastAccessedTime
long getLastAccessedTime()Returns the time of last client access.- Returns:
- the last access time in milliseconds since epoch
-
setMaxInactiveInterval
void setMaxInactiveInterval(int interval) Sets the maximum time interval between requests before the session expires.- Parameters:
interval- the interval in seconds
-
getMaxInactiveInterval
int getMaxInactiveInterval()Returns the maximum inactive interval for this session.- Returns:
- the interval in seconds
-
getAttribute
Returns the session attribute with the specified name.- Parameters:
name- the attribute name- Returns:
- the attribute value, or null if not found
-
getAttributeNames
Enumeration<String> getAttributeNames()Returns an enumeration of all attribute names in this session.- Returns:
- enumeration of attribute names
-
setAttribute
Sets a session attribute.- Parameters:
name- the attribute namevalue- the attribute value
-
removeAttribute
Removes a session attribute.- Parameters:
name- the attribute name to remove
-
invalidate
void invalidate()Invalidates this session. -
isNew
boolean isNew()Checks if the session was newly created.- Returns:
- true if the session is new
-