public class MockHttpSession extends Object implements HttpSession
HttpSession
for mocking purposes.
Constructor and Description |
---|
MockHttpSession() |
Modifier and Type | Method and Description |
---|---|
static MockHttpSession |
create()
Creates a new HTTP session.
|
Object |
getAttribute(String name) |
Enumeration<String> |
getAttributeNames() |
long |
getCreationTime() |
String |
getId() |
long |
getLastAccessedTime() |
int |
getMaxInactiveInterval() |
ServletContext |
getServletContext() |
HttpSessionContext |
getSessionContext() |
Object |
getValue(String name) |
String[] |
getValueNames() |
void |
invalidate() |
boolean |
isNew() |
void |
putValue(String name,
Object value) |
void |
removeAttribute(String name) |
void |
removeValue(String name) |
void |
setAttribute(String name,
Object value) |
void |
setMaxInactiveInterval(int interval) |
public MockHttpSession()
public static MockHttpSession create()
public long getCreationTime()
getCreationTime
in interface HttpSession
public String getId()
getId
in interface HttpSession
public long getLastAccessedTime()
getLastAccessedTime
in interface HttpSession
public ServletContext getServletContext()
getServletContext
in interface HttpSession
public void setMaxInactiveInterval(int interval)
setMaxInactiveInterval
in interface HttpSession
public int getMaxInactiveInterval()
getMaxInactiveInterval
in interface HttpSession
public HttpSessionContext getSessionContext()
getSessionContext
in interface HttpSession
public Object getAttribute(String name)
getAttribute
in interface HttpSession
public Object getValue(String name)
getValue
in interface HttpSession
public Enumeration<String> getAttributeNames()
getAttributeNames
in interface HttpSession
public String[] getValueNames()
getValueNames
in interface HttpSession
public void setAttribute(String name, Object value)
setAttribute
in interface HttpSession
public void putValue(String name, Object value)
putValue
in interface HttpSession
public void removeAttribute(String name)
removeAttribute
in interface HttpSession
public void removeValue(String name)
removeValue
in interface HttpSession
public void invalidate()
invalidate
in interface HttpSession
public boolean isNew()
isNew
in interface HttpSession
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.