public class AccessLogHandler extends Object implements HttpHandler
AccessLogReceiver
.
This handler can log any attribute that is provides via the ExchangeAttribute
mechanism. A general guide to the most common attribute is provided before, however this mechanism is extensible.
This factory produces token handlers for the following patterns
In addition, the caller can specify one of the following aliases for commonly utilized patterns:
%h %l %u %t "%r" %s %b
%h %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}"
%o %l %u %t "%r" %s %b
%o %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}"
There is also support to write information from the cookie, incoming
header, or the session
It is modeled after the apache syntax:
%{i,xxx}
for incoming headers
%{o,xxx}
for outgoing response headers
%{c,xxx}
for a specific cookie
%{r,xxx}
xxx is an attribute in the ServletRequest
%{s,xxx}
xxx is an attribute in the HttpSession
Modifier and Type | Class and Description |
---|---|
static class |
AccessLogHandler.Builder |
Constructor and Description |
---|
AccessLogHandler(HttpHandler next,
AccessLogReceiver accessLogReceiver,
String formatString,
ClassLoader classLoader) |
AccessLogHandler(HttpHandler next,
AccessLogReceiver accessLogReceiver,
String formatString,
ClassLoader classLoader,
Predicate predicate) |
AccessLogHandler(HttpHandler next,
AccessLogReceiver accessLogReceiver,
String formatString,
ExchangeAttribute attribute) |
AccessLogHandler(HttpHandler next,
AccessLogReceiver accessLogReceiver,
String formatString,
ExchangeAttribute attribute,
Predicate predicate) |
Modifier and Type | Method and Description |
---|---|
void |
handleRequest(HttpServerExchange exchange)
Handle the request.
|
String |
toString() |
public AccessLogHandler(HttpHandler next, AccessLogReceiver accessLogReceiver, String formatString, ClassLoader classLoader)
public AccessLogHandler(HttpHandler next, AccessLogReceiver accessLogReceiver, String formatString, ClassLoader classLoader, Predicate predicate)
public AccessLogHandler(HttpHandler next, AccessLogReceiver accessLogReceiver, String formatString, ExchangeAttribute attribute)
public AccessLogHandler(HttpHandler next, AccessLogReceiver accessLogReceiver, String formatString, ExchangeAttribute attribute, Predicate predicate)
public void handleRequest(HttpServerExchange exchange) throws Exception
HttpHandler
handleRequest
in interface HttpHandler
exchange
- the HTTP request/response exchangeException
Copyright © 2021 JBoss by Red Hat. All rights reserved.