Package com.browserup.bup.filters
Class ServerResponseCaptureFilter
- java.lang.Object
-
- org.littleshoot.proxy.HttpFiltersAdapter
-
- com.browserup.bup.filters.ServerResponseCaptureFilter
-
- All Implemented Interfaces:
org.littleshoot.proxy.HttpFilters
public class ServerResponseCaptureFilter extends org.littleshoot.proxy.HttpFiltersAdapterThis filter captures responses from the server (headers and content). The filter can also decompress contents if desired. The filter can be used in one of three ways: (1) directly, by adding the filter to the filter chain; (2) by subclassing the filter and overriding its filter methods; or (3) by invoking the filter directly from within another filter (seeHarCaptureFilterfor an example of the latter).
-
-
Constructor Summary
Constructors Constructor Description ServerResponseCaptureFilter(io.netty.handler.codec.http.HttpRequest originalRequest, boolean decompressEncodedContent)ServerResponseCaptureFilter(io.netty.handler.codec.http.HttpRequest originalRequest, io.netty.channel.ChannelHandlerContext ctx, boolean decompressEncodedContent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcaptureContentEncoding(io.netty.handler.codec.http.HttpResponse httpResponse)protected voidcaptureFullResponseContents()protected voidcaptureTrailingHeaders(io.netty.handler.codec.http.LastHttpContent lastContent)protected voiddecompressContents()java.lang.StringgetContentEncoding()byte[]getFullResponseContents()Returns the contents of the entire response.io.netty.handler.codec.http.HttpResponsegetHttpResponse()byte[]getRawResponseContents()Returns the raw contents of the entire response, without decompression.io.netty.handler.codec.http.HttpHeadersgetTrailingHeaders()booleanisDecompressionSuccessful()booleanisResponseCompressed()io.netty.handler.codec.http.HttpObjectserverToProxyResponse(io.netty.handler.codec.http.HttpObject httpObject)protected voidstoreResponseContent(io.netty.handler.codec.http.HttpContent httpContent)-
Methods inherited from class org.littleshoot.proxy.HttpFiltersAdapter
clientToProxyRequest, proxyToClientResponse, proxyToServerConnectionFailed, proxyToServerConnectionQueued, proxyToServerConnectionSSLHandshakeStarted, proxyToServerConnectionStarted, proxyToServerConnectionSucceeded, proxyToServerRequest, proxyToServerRequestSending, proxyToServerRequestSent, proxyToServerResolutionFailed, proxyToServerResolutionStarted, proxyToServerResolutionSucceeded, serverToProxyResponseReceived, serverToProxyResponseReceiving, serverToProxyResponseTimedOut
-
-
-
-
Constructor Detail
-
ServerResponseCaptureFilter
public ServerResponseCaptureFilter(io.netty.handler.codec.http.HttpRequest originalRequest, boolean decompressEncodedContent)
-
ServerResponseCaptureFilter
public ServerResponseCaptureFilter(io.netty.handler.codec.http.HttpRequest originalRequest, io.netty.channel.ChannelHandlerContext ctx, boolean decompressEncodedContent)
-
-
Method Detail
-
serverToProxyResponse
public io.netty.handler.codec.http.HttpObject serverToProxyResponse(io.netty.handler.codec.http.HttpObject httpObject)
- Specified by:
serverToProxyResponsein interfaceorg.littleshoot.proxy.HttpFilters- Overrides:
serverToProxyResponsein classorg.littleshoot.proxy.HttpFiltersAdapter
-
captureFullResponseContents
protected void captureFullResponseContents()
-
decompressContents
protected void decompressContents()
-
captureContentEncoding
protected void captureContentEncoding(io.netty.handler.codec.http.HttpResponse httpResponse)
-
captureTrailingHeaders
protected void captureTrailingHeaders(io.netty.handler.codec.http.LastHttpContent lastContent)
-
storeResponseContent
protected void storeResponseContent(io.netty.handler.codec.http.HttpContent httpContent)
-
getHttpResponse
public io.netty.handler.codec.http.HttpResponse getHttpResponse()
-
getFullResponseContents
public byte[] getFullResponseContents()
Returns the contents of the entire response. If the contents were compressed,decompressEncodedContentis true, and decompression was successful, this method returns the decompressed contents.- Returns:
- entire response contents, decompressed if possible
-
getRawResponseContents
public byte[] getRawResponseContents()
Returns the raw contents of the entire response, without decompression.- Returns:
- entire response contents, without decompression
-
getTrailingHeaders
public io.netty.handler.codec.http.HttpHeaders getTrailingHeaders()
-
isResponseCompressed
public boolean isResponseCompressed()
-
isDecompressionSuccessful
public boolean isDecompressionSuccessful()
- Returns:
- true if decompression is both enabled and successful
-
getContentEncoding
public java.lang.String getContentEncoding()
-
-