Class SessionAttributeInitializingFilter
java.lang.Object
org.apache.mina.core.filterchain.IoFilterAdapter
org.apache.mina.filter.util.SessionAttributeInitializingFilter
- All Implemented Interfaces:
IoFilter
-
Nested Class Summary
Nested classes/interfaces inherited from interface IoFilter
IoFilter.NextFilter -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance with no default attributes.SessionAttributeInitializingFilter(Map<String, ? extends Object> attributes) Creates a new instance with the specified default attributes. -
Method Summary
Modifier and TypeMethodDescription(package private) booleancontainsAttribute(String key) getAttribute(String key) Returns the value of user-defined attribute.removeAttribute(String key) Removes a user-defined attribute with the specified key.voidsessionCreated(IoFilter.NextFilter nextFilter, IoSession session) Puts all pre-configured attributes into the actual session attribute map and forward the event to the next filter.setAttribute(String key) Sets a user defined attribute without a value.setAttribute(String key, Object value) Sets a user-defined attribute.voidsetAttributes(Map<String, ? extends Object> attributes) Sets the attribute map.Methods inherited from class IoFilterAdapter
destroy, event, exceptionCaught, filterClose, filterWrite, init, inputClosed, messageReceived, messageSent, onPostAdd, onPostRemove, onPreAdd, onPreRemove, sessionClosed, sessionIdle, sessionOpened, toString
-
Field Details
-
attributes
-
-
Constructor Details
-
SessionAttributeInitializingFilter
public SessionAttributeInitializingFilter()Creates a new instance with no default attributes. You can set the additional attributes by calling methods such assetAttribute(String, Object)andsetAttributes(Map). -
SessionAttributeInitializingFilter
Creates a new instance with the specified default attributes. You can set the additional attributes by calling methods such assetAttribute(String, Object)andsetAttributes(Map).- Parameters:
attributes- The Attribute's Map to set
-
-
Method Details
-
getAttribute
-
setAttribute
-
setAttribute
Sets a user defined attribute without a value. This is useful when you just want to put a 'mark' attribute. Its value is set toBoolean.TRUE.- Parameters:
key- the key of the attribute- Returns:
- The old value of the attribute.
nullif it is new.
-
removeAttribute
-
containsAttribute
- Returns:
trueif this session contains the attribute with the specifiedkey.
-
getAttributeKeys
-
setAttributes
-
sessionCreated
Puts all pre-configured attributes into the actual session attribute map and forward the event to the next filter.- Specified by:
sessionCreatedin interfaceIoFilter- Overrides:
sessionCreatedin classIoFilterAdapter- Parameters:
nextFilter- theIoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.session- TheIoSessionwhich has received this event- Throws:
Exception- If an error occurred while processing the event
-