|
Kieker 1.11 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object kieker.monitoring.probe.servlet.SessionAndTraceRegistrationFilter
public class SessionAndTraceRegistrationFilter
For each incoming request via doFilter(ServletRequest, ServletResponse, FilterChain)
, this class
(i) registers session and trace information into the thread-local data structures SessionRegistry
and
TraceRegistry
accessible to other probes in
the control-flow of this request, (ii) executes the given FilterChain
and subsequently (iii) unregisters the thread-local
data. If configured in the FilterConfig
(see below), the execution of the doFilter(ServletRequest, ServletResponse, FilterChain)
method
is also part of the trace and logged to the IMonitoringController
(note that this is the default behavior when no property is found).
The filter can be integrated into the web.xml as follows:
<filter>
<filter-name>sessionAndTraceRegistrationFilter</filter-name>
<filter-class>kieker.monitoring.probe.servlet.SessionAndTraceRegistrationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sessionAndTraceRegistrationFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Field Summary | |
---|---|
protected static ControlFlowRegistry |
CF_REGISTRY
|
static java.lang.String |
CONFIG_PROPERTY_NAME_LOG_FILTER_EXECUTION
|
protected static IMonitoringController |
MONITORING_CTRL
|
protected static SessionRegistry |
SESSION_REGISTRY
|
protected static ITimeSource |
TIMESOURCE
|
protected static java.lang.String |
VM_NAME
|
Constructor Summary | |
---|---|
SessionAndTraceRegistrationFilter()
Create an SessionAndTraceRegistrationFilter and initialize the filter operation signature. |
|
SessionAndTraceRegistrationFilter(boolean logFilterExecution)
Create an SessionAndTraceRegistrationFilter and initialize the filter operation signature. |
Method Summary | |
---|---|
void |
destroy()
|
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
Register thread-local session and trace information, executes the given FilterChain and unregisters
the session/trace information. |
protected java.lang.String |
getFilterOperationSignatureString()
Returns the operation signature of this filter's doFilter(ServletRequest, ServletResponse, FilterChain) operation
to be used when logging executions of this operation. |
void |
init(javax.servlet.FilterConfig config)
|
protected java.lang.String |
registerSessionInformation(javax.servlet.ServletRequest request)
If the given ServletRequest is an instance of HttpServletRequest , this methods extracts the session ID and registers it in the
SESSION_REGISTRY in order to be accessible for other probes in this thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CONFIG_PROPERTY_NAME_LOG_FILTER_EXECUTION
protected static final IMonitoringController MONITORING_CTRL
protected static final SessionRegistry SESSION_REGISTRY
protected static final ControlFlowRegistry CF_REGISTRY
protected static final ITimeSource TIMESOURCE
protected static final java.lang.String VM_NAME
Constructor Detail |
---|
public SessionAndTraceRegistrationFilter()
public SessionAndTraceRegistrationFilter(boolean logFilterExecution)
logFilterExecution
- true enables logging of the filter executionMethod Detail |
---|
protected java.lang.String getFilterOperationSignatureString()
doFilter(ServletRequest, ServletResponse, FilterChain)
operation
to be used when logging executions of this operation.
Extending classes may override this method in order to provide an alternative signature. However,
note that this method is executed on each filter execution. Hence, you should return a final
value here instead of executing expensive String operations.
public void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletException
FilterChain
and unregisters
the session/trace information. If configured, the execution of this filter is also logged to the IMonitoringController
.
This method returns immediately if monitoring is not enabled.
doFilter
in interface javax.servlet.Filter
request
- The request.response
- The response.chain
- The filter chain to be used.
java.io.IOException
- on io errors
javax.servlet.ServletException
- on servlet errorspublic void destroy()
destroy
in interface javax.servlet.Filter
protected java.lang.String registerSessionInformation(javax.servlet.ServletRequest request)
ServletRequest
is an instance of HttpServletRequest
, this methods extracts the session ID and registers it in the
SESSION_REGISTRY
in order to be accessible for other probes in this thread. In case no session is associated with this request (or if the request is
not an instance of HttpServletRequest
), this method returns without any further actions and returns OperationExecutionRecord.NO_SESSION_ID
.
request
- The request.
|
Kieker 1.11 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |