Factory of Jetty-specific HttpExchange extractor functions for use with GlowrootAuthUserMiddleware and GlowrootRequestIdMiddleware.
More...
Static Public Member Functions | |
| static Function< HttpExchange, String > | authUser () |
Returns an extractor that reads the authenticated user from the JettyAuthHandler#REQ_ATTR_AUTH request attribute set by JettyAuthHandler after successful JWT verification. | |
| static Function< HttpExchange, String > | clientIp () |
Returns an extractor for the client IP address, preferring X-Forwarded-For (set by reverse proxies / load-balancers) over the direct remote address. | |
| static Function< HttpExchange, String > | header (final String headerName) |
| Returns an extractor that reads the value of a specific HTTP request header. | |
| static Function< HttpExchange, String > | xRequestId () |
Returns an extractor for the X-Request-Id header, the de-facto standard for HTTP request correlation. | |
Factory of Jetty-specific HttpExchange extractor functions for use with GlowrootAuthUserMiddleware and GlowrootRequestIdMiddleware.
All extractors safely return null when the exchange is not a JettyHttpExchange (e.g. during unit tests with a test double).
Usage:
// Set authenticated user from JWT auth context
middlewareRegistry.add(new GlowrootAuthUserMiddleware(GlowrootJettyExtractors.authUser()));
// Capture X-Request-Id header (generate if absent)
middlewareRegistry.add(new GlowrootRequestIdMiddleware(GlowrootJettyExtractors.xRequestId(), true));
// Capture any custom header
middlewareRegistry.add(new GlowrootRequestIdMiddleware(GlowrootJettyExtractors.header("X-Correlation-Id"), false));
Definition at line 60 of file GlowrootJettyExtractors.java.
|
static |
Returns an extractor that reads the authenticated user from the JettyAuthHandler#REQ_ATTR_AUTH request attribute set by JettyAuthHandler after successful JWT verification.
The raw context object is converted via toString(); implementors of dev.rafex.ether.http.jetty12.TokenVerifier should ensure the context object returns the user subject from toString().
null Definition at line 79 of file GlowrootJettyExtractors.java.
References dev.rafex.ether.http.jetty12.JettyAuthHandler.REQ_ATTR_AUTH.
|
static |
Returns an extractor for the client IP address, preferring X-Forwarded-For (set by reverse proxies / load-balancers) over the direct remote address.
null Definition at line 123 of file GlowrootJettyExtractors.java.
|
static |
Returns an extractor that reads the value of a specific HTTP request header.
| headerName | the header name (case-insensitive per HTTP spec) |
null if absent Definition at line 96 of file GlowrootJettyExtractors.java.
Referenced by xRequestId().
|
static |
Returns an extractor for the X-Request-Id header, the de-facto standard for HTTP request correlation.
X-Request-Id header value, or null Definition at line 112 of file GlowrootJettyExtractors.java.
References header().