public class HttpSession extends Object
The session can be invalidated and should only be used while it is valid.
Constructor and Description |
---|
HttpSession(String name,
HttpSessionTokensSet tokenNames)
Instantiates a new http session.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
getMessagesMatched()
Gets the number of http messages that matched this session.
|
String |
getName()
Gets the name.
|
HttpSessionTokensSet |
getTokensNames() |
String |
getTokenValue(String tokenName)
Gets the token value.
|
int |
getTokenValuesCount()
Gets the token values count.
|
String |
getTokenValuesString()
Gets the token values string representation.
|
Map<String,org.apache.commons.httpclient.Cookie> |
getTokenValuesUnmodifiableMap()
Gets an unmodifiable view of the token values map.
|
int |
hashCode() |
void |
invalidate()
Invalidates the session.
|
boolean |
isActive()
Checks if it is active.
|
boolean |
isValid()
Checks if the session is still valid.
|
boolean |
matchesToken(String tokenName,
HttpCookie cookie)
Checks if a particular cookie has the same value as one of the token values in the HTTP
session.
|
void |
removeToken(String tokenName)
Removes a given token.
|
void |
setActive(boolean active)
Sets whether it is active.
|
void |
setMessagesMatched(int messagesMatched)
Sets the number of http messages that matched this session.
|
void |
setName(String name)
Sets the name.
|
void |
setTokenValue(String tokenName,
org.apache.commons.httpclient.Cookie value)
Sets a particular value for a session token.
|
String |
toString() |
public HttpSession(String name, HttpSessionTokensSet tokenNames)
name
- the nametokenNames
- the token namespublic HttpSessionTokensSet getTokensNames()
public String getName()
public void setName(String name)
name
- the new namepublic boolean isActive()
public void setActive(boolean active)
active
- the new activepublic void setTokenValue(String tokenName, org.apache.commons.httpclient.Cookie value)
tokenName
- the token namevalue
- the new value of the token, or null, if the token has to be deletedpublic String getTokenValue(String tokenName)
tokenName
- the token namepublic boolean matchesToken(String tokenName, HttpCookie cookie)
tokenName
- the token namecookie
- the cookiepublic void removeToken(String tokenName)
tokenName
- the token namepublic String getTokenValuesString()
public boolean isValid()
public void invalidate()
public int getTokenValuesCount()
public Map<String,org.apache.commons.httpclient.Cookie> getTokenValuesUnmodifiableMap()
UnsupportedOperationException
.public int getMessagesMatched()
public void setMessagesMatched(int messagesMatched)
messagesMatched
- the new messages matched count