com.atlassian.confluence.core.datetime
Class RequestTimeThreadLocalFilter
java.lang.Object
com.atlassian.confluence.core.datetime.RequestTimeThreadLocalFilter
- All Implemented Interfaces:
- javax.servlet.Filter
public class RequestTimeThreadLocalFilter
- extends java.lang.Object
- implements javax.servlet.Filter
Stores the time of the request in the RequestTimeThreadLocal
, and clears it once
the request completes. Also puts the timestamp in a request attribute, and response header.
- Since:
- 2.7
Method Summary |
void |
destroy()
|
void |
doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain filterChain)
|
protected long |
getTimeForRequest(javax.servlet.ServletRequest servletRequest)
Returns the time of the request which will be stored in the thread-local. |
void |
init(javax.servlet.FilterConfig filterConfig)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RequestTimeThreadLocalFilter
public RequestTimeThreadLocalFilter()
init
public void init(javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
- Specified by:
init
in interface javax.servlet.Filter
- Throws:
javax.servlet.ServletException
doFilter
public void doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain filterChain)
throws java.io.IOException,
javax.servlet.ServletException
- Specified by:
doFilter
in interface javax.servlet.Filter
- Throws:
java.io.IOException
javax.servlet.ServletException
getTimeForRequest
protected long getTimeForRequest(javax.servlet.ServletRequest servletRequest)
- Returns the time of the request which will be stored in the thread-local.
- Parameters:
servletRequest
- the request which was received
- Returns:
- the time of the request measured in milliseconds since the epoch defined by
Date.Date(long)
.
destroy
public void destroy()
- Specified by:
destroy
in interface javax.servlet.Filter
Copyright © 2003-2009 Atlassian Pty Ltd. All Rights Reserved.