public class RequestLoggingFilter extends Object implements Filter
Constructor and Description |
---|
RequestLoggingFilter()
Logs to System.out
|
RequestLoggingFilter(LogDetail logDetail)
Logs with a specific detail to System.out
|
RequestLoggingFilter(LogDetail logDetail,
boolean shouldPrettyPrint,
PrintStream stream)
Instantiate a logger using a specific print stream and a specific log detail
|
RequestLoggingFilter(LogDetail logDetail,
boolean shouldPrettyPrint,
PrintStream stream,
boolean showUrlEncodedUri)
Instantiate a logger using a specific print stream and a specific log detail
|
RequestLoggingFilter(LogDetail logDetail,
PrintStream stream)
Instantiate a logger using a specific print stream and a specific log detail.
|
RequestLoggingFilter(PrintStream printStream)
Logs everyting to the specified printstream.
|
Modifier and Type | Method and Description |
---|---|
Response |
filter(FilterableRequestSpecification requestSpec,
FilterableResponseSpecification responseSpec,
FilterContext ctx)
Filter the incoming request and response specifications and outgoing response.
|
static RequestLoggingFilter |
logRequestTo(PrintStream stream)
Syntactic sugar for doing
new RequestLoggingFilter(stream) |
public RequestLoggingFilter()
public RequestLoggingFilter(LogDetail logDetail)
logDetail
- The log detailpublic RequestLoggingFilter(PrintStream printStream)
printStream
- The stream to log to.public RequestLoggingFilter(LogDetail logDetail, PrintStream stream)
logDetail
- The log detailstream
- The stream to log to.public RequestLoggingFilter(LogDetail logDetail, boolean shouldPrettyPrint, PrintStream stream)
logDetail
- The log detailshouldPrettyPrint
- true
if pretty-printing of the body should occur.stream
- The stream to log to.public RequestLoggingFilter(LogDetail logDetail, boolean shouldPrettyPrint, PrintStream stream, boolean showUrlEncodedUri)
logDetail
- The log detailshouldPrettyPrint
- true
if pretty-printing of the body should occur.stream
- The stream to log to.showUrlEncodedUri
- Whether or not to show the request URI as url encodedpublic Response filter(FilterableRequestSpecification requestSpec, FilterableResponseSpecification responseSpec, FilterContext ctx)
Filter
FilterContext.next(FilterableRequestSpecification, FilterableResponseSpecification)
when you're done otherwise the request will not be delivered.
It's of course possible to abort the filter chain execution by returning a Response
directly.filter
in interface Filter
requestSpec
- The incoming request specresponseSpec
- The incoming response specctx
- The filter context. You need to call FilterContext.next(FilterableRequestSpecification, FilterableResponseSpecification)
when you're done otherwise the request will not be delivered.public static RequestLoggingFilter logRequestTo(PrintStream stream)
new RequestLoggingFilter(stream)
stream
- The stream to log the request to.RequestLoggingFilter
.Copyright © 2010–2019. All rights reserved.