Class MockPortletSession
- java.lang.Object
- org.springframework.mock.web.portlet.MockPortletSession
- All Implemented Interfaces:
PortletSession
public class MockPortletSession extends Object implements PortletSession
Mock implementation of thePortletSessioninterface.- Since:
- 2.0
- Author:
- John A. Lewis, Juergen Hoeller
Field Summary
Fields inherited from interface javax.portlet.PortletSession
APPLICATION_SCOPE, PORTLET_SCOPE
Constructor Summary
Constructors Constructor Description MockPortletSession()Create a new MockPortletSession with a defaultMockPortletContext.MockPortletSession(PortletContext portletContext)Create a new MockPortletSession.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccess()voidclearAttributes()Clear all of this session's attributes.protected voiddoClearAttributes(Map<String,Object> attributes)ObjectgetAttribute(String name)ObjectgetAttribute(String name, int scope)Map<String,Object>getAttributeMap()Map<String,Object>getAttributeMap(int scope)Enumeration<String>getAttributeNames()Enumeration<String>getAttributeNames(int scope)longgetCreationTime()StringgetId()longgetLastAccessedTime()intgetMaxInactiveInterval()PortletContextgetPortletContext()voidinvalidate()booleanisInvalid()booleanisNew()voidremoveAttribute(String name)voidremoveAttribute(String name, int scope)voidsetAttribute(String name, Object value)voidsetAttribute(String name, Object value, int scope)voidsetMaxInactiveInterval(int interval)voidsetNew(boolean value)
Constructor Detail
MockPortletSession
public MockPortletSession()
Create a new MockPortletSession with a defaultMockPortletContext.- See Also:
MockPortletContext
MockPortletSession
public MockPortletSession(PortletContext portletContext)
Create a new MockPortletSession.- Parameters:
portletContext- the PortletContext that the session runs in
Method Detail
getAttribute
public Object getAttribute(String name)
- Specified by:
getAttributein interfacePortletSession
getAttribute
public Object getAttribute(String name, int scope)
- Specified by:
getAttributein interfacePortletSession
getAttributeNames
public Enumeration<String> getAttributeNames()
- Specified by:
getAttributeNamesin interfacePortletSession
getAttributeNames
public Enumeration<String> getAttributeNames(int scope)
- Specified by:
getAttributeNamesin interfacePortletSession
getCreationTime
public long getCreationTime()
- Specified by:
getCreationTimein interfacePortletSession
getId
public String getId()
- Specified by:
getIdin interfacePortletSession
access
public void access()
getLastAccessedTime
public long getLastAccessedTime()
- Specified by:
getLastAccessedTimein interfacePortletSession
getMaxInactiveInterval
public int getMaxInactiveInterval()
- Specified by:
getMaxInactiveIntervalin interfacePortletSession
clearAttributes
public void clearAttributes()
Clear all of this session's attributes.
doClearAttributes
protected void doClearAttributes(Map<String,Object> attributes)
invalidate
public void invalidate()
- Specified by:
invalidatein interfacePortletSession
isInvalid
public boolean isInvalid()
setNew
public void setNew(boolean value)
isNew
public boolean isNew()
- Specified by:
isNewin interfacePortletSession
removeAttribute
public void removeAttribute(String name)
- Specified by:
removeAttributein interfacePortletSession
removeAttribute
public void removeAttribute(String name, int scope)
- Specified by:
removeAttributein interfacePortletSession
setAttribute
public void setAttribute(String name, Object value)
- Specified by:
setAttributein interfacePortletSession
setAttribute
public void setAttribute(String name, Object value, int scope)
- Specified by:
setAttributein interfacePortletSession
setMaxInactiveInterval
public void setMaxInactiveInterval(int interval)
- Specified by:
setMaxInactiveIntervalin interfacePortletSession
getPortletContext
public PortletContext getPortletContext()
- Specified by:
getPortletContextin interfacePortletSession
getAttributeMap
public Map<String,Object> getAttributeMap()
- Specified by:
getAttributeMapin interfacePortletSession
getAttributeMap
public Map<String,Object> getAttributeMap(int scope)
- Specified by:
getAttributeMapin interfacePortletSession