| java.lang.Object org.archive.util.HttpRecorder
HttpRecorder | public class HttpRecorder (Code) | | Pairs together a RecordingInputStream and RecordingOutputStream
to capture exactly a single HTTP transaction.
Initially only supports HTTP/1.0 (one request, one response per stream)
Call
HttpRecorder.markContentBegin() to demarc the transition between HTTP
header and body.
author: gojomo |
Constructor Summary | |
protected | HttpRecorder() Constructor with limited access. | public | HttpRecorder(File tempDir, String backingFilenameBase, int outBufferSize, int inBufferSize) Create an HttpRecorder. | public | HttpRecorder(File tempDir, String backingFilenameBase) Create an HttpRecorder. |
HttpRecorder | protected HttpRecorder()(Code) | | Constructor with limited access.
Used internally for case where we're wrapping an already
downloaded stream with a HttpRecorder.
|
HttpRecorder | public HttpRecorder(File tempDir, String backingFilenameBase, int outBufferSize, int inBufferSize)(Code) | | Create an HttpRecorder.
Parameters: tempDir - Directory into which we drop backing files forrecorded input and output. Parameters: backingFilenameBase - Backing filename base to which we'll appendsuffices ris for recorded input stream andros for recorded output stream. Parameters: outBufferSize - Size of output buffer to use. Parameters: inBufferSize - Size of input buffer to use. |
HttpRecorder | public HttpRecorder(File tempDir, String backingFilenameBase)(Code) | | Create an HttpRecorder.
Parameters: tempDir - Directory into which we drop backing files for recorded inputand output. Parameters: backingFilenameBase - Backing filename base to which we'll append sufficesris for recorded input stream andros for recorded output stream. |
cleanup | public void cleanup()(Code) | | Cleanup backing files.
Call when completely done w/ recorder. Removes any backing files that
may have been dropped.
|
close | public void close()(Code) | | Close all streams.
|
closeRecorders | public void closeRecorders()(Code) | | Close both input and output recorders.
Recorders are the output streams to which we are recording.
HttpRecorder.close() closes the stream that is being recorded and the
recorder. This method explicitly closes the recorder only.
|
getCharacterEncoding | public String getCharacterEncoding()(Code) | | Returns the characterEncoding. |
getHttpRecorder | public static HttpRecorder getHttpRecorder()(Code) | | Get the current threads' HttpRecorder.
This threads' HttpRecorder. Returns null if can't find aHttpRecorder in current instance. |
getReplayCharSequence | public ReplayCharSequence getReplayCharSequence() throws IOException(Code) | | A ReplayCharSequence. Call close on the RCS when done w/ it.Will return indeterminate results if the underlying recording streamshave not been closed first. throws: IOException - throws: IOException - |
getResponseContentLength | public long getResponseContentLength()(Code) | | |
inputWrap | public InputStream inputWrap(InputStream is) throws IOException(Code) | | Wrap the provided stream with the internal RecordingInputStream
open() throws an exception if RecordingInputStream is already open.
Parameters: is - InputStream to wrap. The input stream wrapper which itself is an input stream.Pass this in place of the passed stream so input can be recorded. throws: IOException - |
markContentBegin | public void markContentBegin()(Code) | | Mark current position as the point where the HTTP headers end.
|
outputWrap | public OutputStream outputWrap(OutputStream os) throws IOException(Code) | | Wrap the provided stream with the internal RecordingOutputStream
open() throws an exception if RecordingOutputStream is already open.
Parameters: os - The output stream to wrap. The output stream wrapper which is itself an output stream.Pass this in place of the passed stream so output can be recorded. throws: IOException - |
setCharacterEncoding | public void setCharacterEncoding(String characterEncoding)(Code) | | Parameters: characterEncoding - Character encoding of recording. |
wrapInputStreamWithHttpRecord | public static HttpRecorder wrapInputStreamWithHttpRecord(File dir, String basename, InputStream in, String encoding) throws IOException(Code) | | Record the input stream for later playback by an extractor, etc.
This is convenience method used to setup an artificial HttpRecorder
scenario used in unit tests, etc.
Parameters: dir - Directory to write backing file to. Parameters: basename - of what we're recording. Parameters: in - Stream to read. Parameters: encoding - Stream encoding. throws: IOException - An org.archive.util.HttpRecorder. |
|
|