public class MdcInjectionFilter extends CommonEventFilter
session.getTransportMetadata().getAddressType() == InetSocketAddress.class
the following properties will also be set:
Modifier and Type | Class and Description |
---|---|
static class |
MdcInjectionFilter.MdcKey |
IoFilter.NextFilter
Constructor and Description |
---|
MdcInjectionFilter() |
MdcInjectionFilter(java.util.EnumSet<MdcInjectionFilter.MdcKey> keys)
Use this constructor when you want to specify which keys to add to the MDC.
|
MdcInjectionFilter(MdcInjectionFilter.MdcKey... keys)
Use this constructor when you want to specify which keys to add to the MDC
You could still add custom keys via
setProperty(IoSession, String, String) |
Modifier and Type | Method and Description |
---|---|
protected void |
fillContext(IoSession session,
java.util.Map<java.lang.String,java.lang.String> context)
write key properties of the session to the Mapped Diagnostic Context
sub-classes could override this method to map more/other attributes
|
protected void |
filter(IoFilterEvent event) |
static java.lang.String |
getProperty(IoSession session,
java.lang.String key) |
static void |
removeProperty(IoSession session,
java.lang.String key) |
static void |
setProperty(IoSession session,
java.lang.String key,
java.lang.String value)
Add a property to the context for the given session
This property will be added to the MDC for all subsequent events
|
exceptionCaught, filterClose, filterWrite, messageReceived, messageSent, sessionClosed, sessionCreated, sessionIdle, sessionOpened
destroy, filterSetTrafficMask, init, onPostAdd, onPostRemove, onPreAdd, onPreRemove
public MdcInjectionFilter(java.util.EnumSet<MdcInjectionFilter.MdcKey> keys)
setProperty(IoSession, String, String)
keys
- set of keys that should be added to the MDCsetProperty(org.apache.mina.core.session.IoSession, String, String)
public MdcInjectionFilter(MdcInjectionFilter.MdcKey... keys)
setProperty(IoSession, String, String)
keys
- list of keys that should be added to the MDCsetProperty(org.apache.mina.core.session.IoSession, String, String)
public MdcInjectionFilter()
protected void filter(IoFilterEvent event) throws java.lang.Exception
filter
in class CommonEventFilter
java.lang.Exception
protected void fillContext(IoSession session, java.util.Map<java.lang.String,java.lang.String> context)
session
- the session to mapcontext
- key properties will be added to this mappublic static java.lang.String getProperty(IoSession session, java.lang.String key)
public static void setProperty(IoSession session, java.lang.String key, java.lang.String value)
session
- The session for which you want to set a propertykey
- The name of the property (should not be null)value
- The value of the propertypublic static void removeProperty(IoSession session, java.lang.String key)
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.