Package org.apache.shiro.web.servlet
Class ShiroHttpSession
- java.lang.Object
-
- org.apache.shiro.web.servlet.ShiroHttpSession
-
- All Implemented Interfaces:
HttpSession
public class ShiroHttpSession extends Object implements HttpSession
Wrapper class that uses a ShiroSession
under the hood for all session operations instead of the Servlet Container's session mechanism. This is required in heterogeneous client environments where the Session is used on both the business tier as well as in multiple client technologies (web, swing, flash, etc) since Servlet container sessions alone cannot support this feature.- Since:
- 0.2
-
-
Field Summary
Fields Modifier and Type Field Description protected HttpServletRequest
currentRequest
static String
DEFAULT_SESSION_ID_NAME
protected ServletContext
servletContext
protected Session
session
-
Constructor Summary
Constructors Constructor Description ShiroHttpSession(Session session, HttpServletRequest currentRequest, ServletContext servletContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterBound(String s, Object o)
protected void
afterUnbound(String s, Object o)
Object
getAttribute(String s)
Enumeration
getAttributeNames()
long
getCreationTime()
String
getId()
protected Set<String>
getKeyNames()
long
getLastAccessedTime()
int
getMaxInactiveInterval()
ServletContext
getServletContext()
Session
getSession()
HttpSessionContext
getSessionContext()
Object
getValue(String s)
String[]
getValueNames()
void
invalidate()
boolean
isNew()
void
putValue(String s, Object o)
void
removeAttribute(String s)
void
removeValue(String s)
void
setAttribute(String s, Object o)
void
setMaxInactiveInterval(int i)
-
-
-
Field Detail
-
DEFAULT_SESSION_ID_NAME
public static final String DEFAULT_SESSION_ID_NAME
- See Also:
- Constant Field Values
-
servletContext
protected ServletContext servletContext
-
currentRequest
protected HttpServletRequest currentRequest
-
-
Constructor Detail
-
ShiroHttpSession
public ShiroHttpSession(Session session, HttpServletRequest currentRequest, ServletContext servletContext)
-
-
Method Detail
-
getSession
public Session getSession()
-
getCreationTime
public long getCreationTime()
- Specified by:
getCreationTime
in interfaceHttpSession
-
getId
public String getId()
- Specified by:
getId
in interfaceHttpSession
-
getLastAccessedTime
public long getLastAccessedTime()
- Specified by:
getLastAccessedTime
in interfaceHttpSession
-
getServletContext
public ServletContext getServletContext()
- Specified by:
getServletContext
in interfaceHttpSession
-
setMaxInactiveInterval
public void setMaxInactiveInterval(int i)
- Specified by:
setMaxInactiveInterval
in interfaceHttpSession
-
getMaxInactiveInterval
public int getMaxInactiveInterval()
- Specified by:
getMaxInactiveInterval
in interfaceHttpSession
-
getSessionContext
public HttpSessionContext getSessionContext()
- Specified by:
getSessionContext
in interfaceHttpSession
-
getAttribute
public Object getAttribute(String s)
- Specified by:
getAttribute
in interfaceHttpSession
-
getValue
public Object getValue(String s)
- Specified by:
getValue
in interfaceHttpSession
-
getKeyNames
protected Set<String> getKeyNames()
-
getAttributeNames
public Enumeration getAttributeNames()
- Specified by:
getAttributeNames
in interfaceHttpSession
-
getValueNames
public String[] getValueNames()
- Specified by:
getValueNames
in interfaceHttpSession
-
afterBound
protected void afterBound(String s, Object o)
-
afterUnbound
protected void afterUnbound(String s, Object o)
-
setAttribute
public void setAttribute(String s, Object o)
- Specified by:
setAttribute
in interfaceHttpSession
-
putValue
public void putValue(String s, Object o)
- Specified by:
putValue
in interfaceHttpSession
-
removeAttribute
public void removeAttribute(String s)
- Specified by:
removeAttribute
in interfaceHttpSession
-
removeValue
public void removeValue(String s)
- Specified by:
removeValue
in interfaceHttpSession
-
invalidate
public void invalidate()
- Specified by:
invalidate
in interfaceHttpSession
-
isNew
public boolean isNew()
- Specified by:
isNew
in interfaceHttpSession
-
-