Constructor and Description |
---|
ResponseLoggingFilter()
Log to system out for all status codes
|
ResponseLoggingFilter(int statusCode)
Log to system out if response status code matches the given status code.
|
ResponseLoggingFilter(LogDetail logDetail)
Instantiate a logger using the supplied log detail.
|
ResponseLoggingFilter(LogDetail logDetail,
boolean shouldPrettyPrint,
PrintStream stream)
Instantiate a logger using a specific print stream for all status codes
|
ResponseLoggingFilter(LogDetail logDetail,
boolean prettyPrint,
PrintStream stream,
int statusCode)
Instantiate a logger using a specific print stream for status codes matching the supplied status code.
|
ResponseLoggingFilter(LogDetail logDetail,
boolean prettyPrint,
PrintStream stream,
org.hamcrest.Matcher<Integer> matcher)
Instantiate a logger using a specific print stream for status codes matching the supplied matcher.
|
ResponseLoggingFilter(LogDetail logDetail,
PrintStream stream)
Instantiate a logger using a specific print stream for all status codes
|
ResponseLoggingFilter(LogDetail logDetail,
PrintStream stream,
int statusCode)
Instantiate a logger using a specific print stream for status codes matching the supplied status code.
|
ResponseLoggingFilter(LogDetail logDetail,
PrintStream stream,
org.hamcrest.Matcher<Integer> matcher)
Instantiate a logger using a specific print stream for status codes matching the supplied matcher.
|
ResponseLoggingFilter(org.hamcrest.Matcher<Integer> matcher)
Log to system out if response status code matches the given hamcrest matcher.
|
ResponseLoggingFilter(PrintStream stream)
Instantiate a logger using a specific print stream for all status codes
|
ResponseLoggingFilter(PrintStream stream,
int statusCode)
Instantiate a logger using a specific print stream for status codes matching the supplied status code.
|
ResponseLoggingFilter(PrintStream stream,
org.hamcrest.Matcher<Integer> matcher)
Instantiate a logger using a specific print stream for status codes matching the supplied status code.
|
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 Filter |
logResponseIfStatusCodeIs(int statusCode)
Create a new logging filter without using the "new" operator.
|
static Filter |
logResponseIfStatusCodeMatches(org.hamcrest.Matcher<Integer> matcher)
Create a new logging filter without using the "new" operator.
|
static Filter |
logResponseTo(PrintStream stream)
Create a new logging filter without using the "new" operator.
|
static Filter |
logResponseTo(PrintStream stream,
LogDetail logDetail)
Create a new logging filter without using the "new" operator.
|
static Filter |
logResponseToIfMatches(PrintStream stream,
org.hamcrest.Matcher<Integer> matcher)
Create a new logging filter without using the "new" operator.
|
static Filter |
responseLogger()
Create a new logging filter without using the "new" operator.
|
public ResponseLoggingFilter()
public ResponseLoggingFilter(int statusCode)
statusCode
- The status codepublic ResponseLoggingFilter(org.hamcrest.Matcher<Integer> matcher)
matcher
- The hamcrest matcherpublic ResponseLoggingFilter(LogDetail logDetail)
logDetail
- The log detailpublic ResponseLoggingFilter(PrintStream stream)
stream
- The stream to log errors to.public ResponseLoggingFilter(LogDetail logDetail, PrintStream stream)
logDetail
- The log detailstream
- The stream to log errors to.public ResponseLoggingFilter(LogDetail logDetail, boolean shouldPrettyPrint, PrintStream stream)
logDetail
- The log detailshouldPrettyPrint
- true
of pretty-printing should be enabled.stream
- The stream to log errors to.public ResponseLoggingFilter(PrintStream stream, int statusCode)
stream
- The stream to log errors to.statusCode
- The status code that must be present in the response if the response body is to be printed.public ResponseLoggingFilter(PrintStream stream, org.hamcrest.Matcher<Integer> matcher)
stream
- The stream to log errors to.matcher
- The matcher that must be fulfilled if the response body is to be printed.public ResponseLoggingFilter(LogDetail logDetail, PrintStream stream, int statusCode)
logDetail
- The log detailstream
- The stream to log errors to.statusCode
- The status code that must be present in the response if the response body is to be printed.public ResponseLoggingFilter(LogDetail logDetail, PrintStream stream, org.hamcrest.Matcher<Integer> matcher)
logDetail
- The log detailstream
- The stream to log errors to.matcher
- The matcher that must be fulfilled if the response body is to be printed.public ResponseLoggingFilter(LogDetail logDetail, boolean prettyPrint, PrintStream stream, int statusCode)
logDetail
- The log detailprettyPrint
- Enable or disable pretty printing of the bodystream
- The stream to log errors to.statusCode
- The status code that must be present in the response if the response body is to be printed.public ResponseLoggingFilter(LogDetail logDetail, boolean prettyPrint, PrintStream stream, org.hamcrest.Matcher<Integer> matcher)
logDetail
- The log detailprettyPrint
- Enable or disable pretty printing of the bodystream
- The stream to log errors to.matcher
- The matcher that must be fulfilled if the response body is to be printed.public static Filter responseLogger()
public static Filter logResponseTo(PrintStream stream)
stream
- The print stream to log topublic static Filter logResponseTo(PrintStream stream, LogDetail logDetail)
stream
- The print stream to log tologDetail
- The log detailpublic static Filter logResponseIfStatusCodeMatches(org.hamcrest.Matcher<Integer> matcher)
matcher
- The matcher that must be fulfilled in order for logging to occurpublic static Filter logResponseIfStatusCodeIs(int statusCode)
statusCode
- The status code that must be present in order for logging to occurpublic static Filter logResponseToIfMatches(PrintStream stream, org.hamcrest.Matcher<Integer> matcher)
stream
- The print stream to log tomatcher
- The matcher that must be fulfilled in order for logging to occurpublic 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.Copyright © 2010–2020. All rights reserved.