Package org.codice.ddf.security.util
Class ThreadContextProperties
java.lang.Object
org.codice.ddf.security.util.ThreadContextProperties
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddClientInfo(String clientIP, String clientHost, String clientPort, URI requestUri) static voidaddClientInfo(javax.servlet.ServletRequest request) Adds the client info map to ThreadContext.static StringAdds the trace context and unique trace id to the ThreadContext.static Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic voidremoves the client info map from the Thread Contextstatic voidremoves the trace context map from the ThreadContext
-
Field Details
-
TRACE_CONTEXT_KEY
- See Also:
-
TRACE_ID
- See Also:
-
CLIENT_INFO_KEY
- See Also:
-
SERVLET_REMOTE_ADDR
- See Also:
-
SERVLET_REMOTE_HOST
- See Also:
-
SERVLET_REMOTE_PORT
- See Also:
-
SERVLET_SCHEME
- See Also:
-
SERVLET_CONTEXT_PATH
- See Also:
-
-
Method Details
-
addTraceId
Adds the trace context and unique trace id to the ThreadContext.- Returns:
- traceId in ThreadContext
-
getTraceId
- Returns:
- trace-id from ThreadContext if it exists otherwise returns null
-
removeTraceId
public static void removeTraceId()removes the trace context map from the ThreadContext -
addClientInfo
public static void addClientInfo(javax.servlet.ServletRequest request) Adds the client info map to ThreadContext. The Client Info can include the client's IP address, client host, client port, and the request context path.- Parameters:
request- the servlet request containing the client address info
-
addClientInfo
public static void addClientInfo(String clientIP, @Nullable String clientHost, @Nullable String clientPort, @Nullable URI requestUri) - Parameters:
clientIP-clientHost-clientPort-requestUri-
-
getRemoteAddress
- Returns:
- the client IP address or null if not present
-
getRemotePort
- Returns:
- the client Port address or null if not present
-
getRemoteHost
- Returns:
- the client host name or null if it not present
-
getContextPath
- Returns:
- the context path of the request if available or null if not present
-
getScheme
- Returns:
- the scheme of the request if available or null if not present
-
removeClientInfo
public static void removeClientInfo()removes the client info map from the Thread Context
-