package RSApache::Response::Raw;

use strict;
use warnings;

use Apache2::Const qw(OK);

use lib '/app/tools/common/lib';
use RSApache::Response;
use Common::WriteXML;
use Common::Assert;
use base 'RSApache::Response';

sub _init {
    my ( $self, $output ) = @_;
    assert( defined $output );

    # Assume that if I am passed a hash ref, this contains XML.
    # Otherwise, just pass it along.
    #
    if ( ref($output) eq 'HASH' ) {
        $self->{output} = Common::WriteXML::GetXMLString($output);
    } else {
        $self->{output} = $output;
    }
}

sub respond {
    my ( $self, $apache ) = @_;

    $apache->content_type("text/plain");
    $apache->send_http_header();

    print $self->{output};

    return OK;
}

###
1;    # Play nicely.
###

