com.jayway.restassured.filter.log
Class RequestLoggingFilter

java.lang.Object
  extended by com.jayway.restassured.filter.log.RequestLoggingFilter
All Implemented Interfaces:
Filter

public class RequestLoggingFilter
extends Object
implements Filter

Will log the request before it's passed to HTTP Builder. Note that HTTP Builder and HTTP Client will add additional headers. This filter will only log things specified in the request specification. I.e. you can NOT regard the things logged here to be what's actually sent to the server. Also subsequent filters may alter the request after the logging has took place. If you need to log what's actually sent on the wire refer to the HTTP Client logging docs or use an external tool such as Wireshark.


Constructor Summary
RequestLoggingFilter()
          Logs to System.out
RequestLoggingFilter(LogDetail logDetail)
          Logs with a specific detail to System.out
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.
 
Method Summary
 Response filter(FilterableRequestSpecification requestSpec, FilterableResponseSpecification responseSpec, FilterContext ctx)
          Filter the incoming request and response specifications and outgoing response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestLoggingFilter

public RequestLoggingFilter()
Logs to System.out


RequestLoggingFilter

public RequestLoggingFilter(LogDetail logDetail)
Logs with a specific detail to System.out

Parameters:
logDetail - The log detail

RequestLoggingFilter

public RequestLoggingFilter(PrintStream printStream)
Logs everyting to the specified printstream.

Parameters:
printStream - The stream to log to.

RequestLoggingFilter

public RequestLoggingFilter(LogDetail logDetail,
                            PrintStream stream)
Instantiate a logger using a specific print stream and a specific log detail

Parameters:
logDetail - The log detail
stream - The stream to log to.
Method Detail

filter

public Response filter(FilterableRequestSpecification requestSpec,
                       FilterableResponseSpecification responseSpec,
                       FilterContext ctx)
Description copied from interface: Filter
Filter the incoming request and response specifications and outgoing response. You need to call FilterContext.next(com.jayway.restassured.specification.FilterableRequestSpecification, com.jayway.restassured.specification.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.

Specified by:
filter in interface Filter
Parameters:
requestSpec - The incoming request spec
responseSpec - The incoming response spec
ctx - The filter context. You need to call FilterContext.next(com.jayway.restassured.specification.FilterableRequestSpecification, com.jayway.restassured.specification.FilterableResponseSpecification) when you're done otherwise the request will not be delivered.
Returns:
The response


Copyright © 2010-2011. All Rights Reserved.