public class SessionAttributeInitializingFilter extends IoFilterAdapter
IoFilter.NextFilter| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,java.lang.Object> |
attributes |
| Constructor and Description |
|---|
SessionAttributeInitializingFilter()
Creates a new instance with no default attributes.
|
SessionAttributeInitializingFilter(java.util.Map<java.lang.String,? extends java.lang.Object> attributes)
Creates a new instance with the specified default attributes.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) boolean |
containsAttribute(java.lang.String key)
Returns true if this session contains the attribute with
the specified key.
|
java.lang.Object |
getAttribute(java.lang.String key)
Returns the value of user-defined attribute.
|
java.util.Set<java.lang.String> |
getAttributeKeys()
Returns the set of keys of all user-defined attributes.
|
java.lang.Object |
removeAttribute(java.lang.String key)
Removes a user-defined attribute with the specified key.
|
void |
sessionCreated(IoFilter.NextFilter nextFilter,
IoSession session)
Puts all pre-configured attributes into the actual session attribute
map and forward the event to the next filter.
|
java.lang.Object |
setAttribute(java.lang.String key)
Sets a user defined attribute without a value.
|
java.lang.Object |
setAttribute(java.lang.String key,
java.lang.Object value)
Sets a user-defined attribute.
|
void |
setAttributes(java.util.Map<java.lang.String,? extends java.lang.Object> attributes)
Sets the attribute map.
|
destroy, exceptionCaught, filterClose, filterWrite, init, inputClosed, messageReceived, messageSent, onPostAdd, onPostRemove, onPreAdd, onPreRemove, sessionClosed, sessionIdle, sessionOpened, toStringpublic SessionAttributeInitializingFilter()
setAttribute(String, Object) and setAttributes(Map).public SessionAttributeInitializingFilter(java.util.Map<java.lang.String,? extends java.lang.Object> attributes)
setAttribute(String, Object) and setAttributes(Map).public java.lang.Object getAttribute(java.lang.String key)
key - the key of the attributepublic java.lang.Object setAttribute(java.lang.String key,
java.lang.Object value)
key - the key of the attributevalue - the value of the attributepublic java.lang.Object setAttribute(java.lang.String key)
Boolean.TRUE.key - the key of the attributepublic java.lang.Object removeAttribute(java.lang.String key)
boolean containsAttribute(java.lang.String key)
public java.util.Set<java.lang.String> getAttributeKeys()
public void setAttributes(java.util.Map<java.lang.String,? extends java.lang.Object> attributes)
public void sessionCreated(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
sessionCreated in interface IoFiltersessionCreated in class IoFilterAdapternextFilter - the IoFilter.NextFilter for this filter. You can reuse this
object until this filter is removed from the chain.session - The IoSession which has received this eventjava.lang.Exception