Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d673f5cb79
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (26 sloc) 0.822 kb
package co.freeside.betamax.handler
import java.util.logging.Logger
import co.freeside.betamax.Recorder
import co.freeside.betamax.message.*
import static co.freeside.betamax.proxy.jetty.BetamaxProxy.X_BETAMAX
import static java.util.logging.Level.INFO
class TapeWriter extends ChainedHttpHandler {
private final Recorder recorder
private static final Logger log = Logger.getLogger(
TapeWriter(Recorder recorder) {
this.recorder = recorder
Response handle(Request request) {
def tape = recorder.tape
if (!tape) {
throw new NoTapeException()
} else if (!tape.writable) {
throw new NonWritableTapeException()
def response = chain(request)
log.log INFO, "Recording to '$'"
tape.record(request, response)
response.addHeader(X_BETAMAX, 'REC')
Jump to Line
Something went wrong with that request. Please try again.