public class SessionManager extends Manageable
Manageable.State
BOOTSTRAPPED, BOOTSTRAPPING, DEINITIALIZING, INITIALIZING, UNUSABLE, USABLE
Constructor and Description |
---|
SessionManager(API api)
Creates the session manager.
|
Modifier and Type | Method and Description |
---|---|
protected void |
bootstrapImpl(Map<String,String> bootstrapProperties)
Performs the bootstrap procedure (actual implementation).
|
boolean |
getBoolProperty(String name)
Gets the value of a boolean session property.
|
Map |
getProperties()
Gets the session properties.
|
Object |
getProperty(String name)
Gets the value of a session property.
|
String |
getSessionId()
Gets the session id.
|
void |
removeProperties()
Removes all session properties for the customer.
|
void |
removeProperty(String name)
Removes a session property.
|
protected void |
request(HttpServletRequest request)
Method called when the request is received.
|
protected void |
result(boolean successful)
Sets the input parameters in the session is the execution of the function is successful.
|
void |
setProperty(String name,
boolean value)
Adds or sets a new session property.
|
void |
setProperty(String name,
Object value)
Adds a new session property.
|
boolean |
shouldLogIn()
Returns
true if the user needs to log in to access the page. |
assertUsable, bootstrap, deinit, deinitImpl, getState, init, initImpl, isBootstrapped, isUsable
public SessionManager(API api)
api
- the API.protected void bootstrapImpl(Map<String,String> bootstrapProperties) throws MissingRequiredPropertyException, InvalidPropertyValueException, BootstrapException
Manageable
Manageable.bootstrap(Map)
, the state and
the argument will have been checked and the state will have been set to
Manageable.BOOTSTRAPPING
.
The implementation of this method in class Manageable
is
empty.
bootstrapImpl
in class Manageable
bootstrapProperties
- the bootstrap properties, not null
.MissingRequiredPropertyException
- if a required property is not given.InvalidPropertyValueException
- if the value of a certain property is invalid.BootstrapException
- if the bootstrapping failed for any other reason.protected void request(HttpServletRequest request)
request
- the HTTP request, cannot be null
.protected void result(boolean successful)
successful
- true
if the function is successful, false
otherwise.public boolean shouldLogIn()
true
if the user needs to log in to access the page.public String getSessionId()
null
.public Map getProperties()
public void setProperty(String name, Object value) throws IllegalArgumentException
null
, the property is removed.name
- the name of the session property, cannot be null
.value
- the value of the session property, can be null
.IllegalArgumentException
- if name == null
.public void setProperty(String name, boolean value) throws IllegalArgumentException
name
- the name of the session property, cannot be null
.value
- the value of the session property.IllegalArgumentException
- if name == null
.public Object getProperty(String name) throws IllegalArgumentException
name
- the name of the session property, cannot be null
.null
if the property does not exist.IllegalArgumentException
- if name == null
.public boolean getBoolProperty(String name) throws IllegalArgumentException
name
- the name of the session property, cannot be null
.true
if the value of the property is "true" or Boolean.TRUE,
false
otherwise.IllegalArgumentException
- if name == null
.public void removeProperty(String name) throws IllegalArgumentException
name
- the name of the session property, cannot be null
.IllegalArgumentException
- if name == null
.public void removeProperties()
See http://www.xins.org/.